Code Monkey home page Code Monkey logo

intercom-nodejs's Introduction

Overview

Intercom allows users to remotely chat with representatives using Watson Speech to Text technology. The representatives are notified via text and can reply directly to the user by SMS using the Twilio APIs. All of this is kicked off at the push of a bttn, enabling users to comminute with ultimate ease by completely avoid manual input into the app.

Deploy to Bluemix

How it Works

  1. Push the bttn to start a conversation

  2. Once the mic is flashing red, start recording your message. The app will automatically detect when you are done speaking and send the message. Your chat will be automatically assigned to an available representative.

  3. Using Twilio, the rep will respond to your inquiry

  4. This manner of communication can continue as long as either party would like. Once the rep has decided that they have addressed the user's concerns, they will end the chat.

  5. Rinse and repeat to your heart's content!

Architecture Diagram


This an architectural overview of the systems that make this app run.

Getting Started

  1. Create a Bluemix Account

    Sign up in Bluemix, or use an existing account.

  2. Download and install the Cloud-foundry CLI tool

  3. Edit the manifest.yml file and change the <application-name> and <application-host> to something unique.

applications:
- name: Intercom-user1
  framework: node
  runtime: node10
  memory: 512M
  instances: 1
  host: intercom-user1

The host you use will determinate your application url initially, e.g. <application-host>.mybluemix.net.

  1. Connect to Bluemix in the command line tool and follow the prompts to log in.
$ cf api https://api.ng.bluemix.net
$ cf login
  1. Create the Cloudant service in Bluemix.
$ cf create-service cloudantNoSQLDB Shared cloudant-service
  1. Create the Speech to Text service in Bluemix.
$ cf create-service speech_to_text free speech-to-text-service
  1. Push it to Bluemix. This will initially fail, but don't worry! The next steps will get your app up and running!
$ cf push
  1. Create a Twilio service by adding it in the catalog, inputting your Account SID and Auth Token, and binding the service to your app.

  2. Create a user provided service to store your DB reset credentials

$ cf cups CloudantCleanser -p '{"host":"https://YOUR_HOST_NAME.mybluemix.net/db/reset","username":"YOUR_USER_NAME","password":"YOUR_PASSWORD"}'
  1. Enter the Cloudant dashboard and do the following:
       a. Create a DB called 'intercom'
       b. Create the following design docs:
          i. Bttns
          Document: _design/bttns
          Index name: bttns_index
          Map function:
    function(doc) {
        if (doc.type === 'bttn') {
          emit(doc._id, {
            uniqueId : doc._id,
            revNum : doc._rev,
            name : doc.bttnName,
            bttnId : doc.bttnId
          });
        }
      }

      ii. Chats
      Document: _design/chats
      Index name: chats_index
      Map function:
function(doc) {
        if (doc.type === 'chat') {
          emit(doc._id, {
            uniqueId : doc._id,
            revNum : doc._rev,
            startTime : doc.startTime,
            chatStatus : doc.chatStatus,
            bttn : doc.bttnId,
            rep : doc.repId
          });
        }
      }

iii. Messages
      Document: _design/messages
      Index name: messages_index
      Map function:
function(doc) {
          if (doc.type === 'message') {
            emit(doc._id, {
              uniqueId : doc._id,
              revNum : doc._rev,
              chatId : doc.chatId,
              message : doc.messageText,
              date : doc.dateTime,
              subType : doc.subType
            });
          }
      }

      iv. Reps
      Document: _design/reps
      Index name: reps_index
      Map function:
function(doc) {
        if (doc.type === 'rep') {
          emit(doc._id, {
            uniqueId : doc._id,
            revNum : doc._rev,
            name : doc.repName,
            phoneNumber : doc.repPhoneNum,
            state : doc.state
          });
        }
      }

Troubleshooting

To troubleshoot your Bluemix app the main useful source of information are the logs, to see them, run:

$ cf logs <application-name> --recent

intercom-nodejs's People

Contributors

jakepeyser avatar jsloyer avatar

Watchers

James Cloos avatar Patrick R avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.