Giter Site home page Giter Site logo

phonebot's Introduction

phonebot

Slackbot that lets users make phone calls within a Slack channel. Users can dial a phone number, with the phone call audio converted to text and sent to the channel. Channel message replies are converted to speech and sent over the phone call.

Twilio is used to make phone calls and capture call audio. IBM Watson's "Speech To Text" service is used to translate the audio into text. NodeJS web application handles incoming messages from Slack, IBM Watson and Twilio.

Bluemix button

Build Status js-standard-style

Phonebot

Usage

Once the Phonebot application is registered for a Slack channel, the following commands are available:

@phonebot call PHONE_NUMBER <-- Dials the phone number
@phonebot say TEXT <-- Sends text as speech to the call 
@phonebot hangup <-- Ends the active call
@phonebot verbose {on|off}<-- Toggle verbose mode
@phonebot duration NUMBER <-- Set recording duration
@phonebot help <-- Show all commands usage information 

Deployment Instructions

Phonebot is a NodeJS application designed for deployment to IBM Bluemix, a Cloud Foundry Platform-as-a-Service instance.

Before deploying the application, we need to...

Slack Webhooks

Phonebot can be registered on multiple channels.

Every channel you want Phonebot to join needs both an outgoing incoming and outgoing webhook.

Set up Outgoing Slack Webhooks

Outgoing Webhooks are used to notify Phonebot when messages for the bot (@phonebot command) are sent to the channel. Visiting the Service Integration page will allow you to create a new webhooks that posts all messages starting with a keyword to an external URL.

The following parameters must be configured:

  • Channel - Channel for Phonebot to listen on
  • Trigger Words - @phonebot
  • URL - http://<INSERT_APP_NAME>.mybluemix.net/slackbot

Outgoing Webhooks

Set up Incoming Slack Webhooks

Incoming Webhooks are used by Phonebot to post the translated call audio as channel messages. We need an incoming webhook for each channel with a registered outgoing webhook. Visiting the Service Integration page will allow you to create a new incoming webhook URL to post channel messages.

Incoming Webhooks

Copy the generated URL that exposes the webhook, you will need to pass this into the application as explained in the section below.

Deploy to IBM Bluemix

Before we can deploy the application, we need to create the service credentials the application relies on within IBM Bluemix.

These credentials will be bound to the application at runtime.

Twilio

Register for a developer account at Twilio.

Connect an external phone number to the account, this will be used as the caller id when making phone calls.

Authentication credentials for Phonebot will be available here.

Run the following CF CLI command to expose your developer account credentials to the platform. Replace the ACCOUNT_SID and TOKEN values with credentials from your account settings page.

$ cf cups twilio -p '{"accountSID":"ACCOUNT_SID","authToken":"TOKEN", "url": "https://api.twilio.com"}'

Note: Phonebot will work with a Twilio trial account, however outgoing calls are only allowed to verified numbers. See here for more details.

IBM Watson

This "Speech To Text" service will be automatically created using the "Free Plan" when the application is deployed. To change the service instance the application uses, modify the manifest.yml.

Slack channels

Run the following CF CLI command to register your Slack channel webhooks within Phonebot.

$ cf cups slack_webhooks -p '{"channel_name":"incoming_webhook_url",...}'

Replace the channel_name and incoming_webhook_url with the actual values for the channel name and incoming webhooks found at your Slack integrations page.

You have to register each channel as a separate property.

Deploy!

Phew, you're now got everything configured! Deploying the application is easy, just run this command:

$ cf push --name your_random_identifier 

Modify your_random_identifier to a name relevant for your Phonebot instance.

Once the application has finished deploying, Phonebot will be listening to requests at http://your_random_identifier.mybluemix.net.

This address must match the URL registered with the outgoing webhooks.

... and you're done! Phonebot should post a message to each registered channel to confirm it's ready for action.

Development Mode

Running Phonebot on your development machine is possible provided you follow these steps...

  • Copy VCAP_SERVICES and VCAP_APPLICATION to local development environment.
  • Run node app.js to start application
  • Ensure application running on localhost is available at external URL, e.g. ngrok
  • Modify Slack outgoing webhooks to point to new URL

phonebot's People

Contributors

cphrmky avatar jsloyer avatar jthomas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

phonebot's Issues

Issue with phonebot implementation.

Hi,

I am using phonebot with slack and having some issues. I configured twilio, watson (Speech to Text) on bluemix. I can see a phonebot icon on my slack channel. I can make calls to verified numbers using trial account but it does not recognize my voice, it is unable to convert speech to text.

Can i call using slack/phonebot from my pc. I mean i want talk to other user using my headphone mic.

How does the conferencing works ? Please suggest !

Error while trying to Deploy to IBM Bluemix

Hey,
I was following the guide step by step.
but I'm getting the same error over and over agian while trying to deploy to IBM Bluemix.
When i do the command :

$ cf cups twilio -p '{"accountSID":"ACCOUNT_SID","authToken":"TOKEN", "url": "https://api.twilio.com"}'

I'm getting the error of:

FAILED
No API endpoint set. Use 'cf login' or 'cf api' to target an endpoint.

And when i'm trying to set the api endpiont withe the command:

cf api "https://api.twilio.com"

I'm still getting the same error....

what can i do?

Phonebot doesn't detect voicemail

If the user sends the incoming call to voicemail, phonebot assumes the user picks up.
We need to use Twilio to detect this, cancel the call and inform the channel.

Add support for "interim results" from text to speech service

Watson Speech To Text service supports returning interim translation results, showing you the partial translation results as they are received. We are currently using batch mode, returning only the full result.
If this mode returns partial results faster than the batch mode, give the user to option to turn it on.
Interim results should be updated in the channel as they come in.

TypeError: Cannot read property 'sid' of null

2015-11-27T16:30:16.575-0500[App/0]ERR at Layer.handle [as handle_request] (/home/vcap/app/node_modules/express/lib/router/layer.js:95:5)
2015-11-27T16:30:16.575-0500[App/0]ERR at Layer.handle [as handle_request] (/home/vcap/app/node_modules/express/lib/router/layer.js:95:5)
2015-11-27T16:30:16.575-0500[App/0]ERR at /home/vcap/app/node_modules/express/lib/router/index.js:277:22
2015-11-27T16:30:16.575-0500[App/0]ERR at PhoneBot.phone_message (/home/vcap/app/lib/phonebot.js:170:29)
2015-11-27T16:30:16.575-0500[App/0]ERRTypeError: Cannot read property 'sid' of null
2015-11-27T16:30:16.575-0500[App/0]ERR at CallManager.is_message_valid (/home/vcap/app/lib/call_manager.js:186:58)
2015-11-27T16:30:16.575-0500[App/0]ERR at /home/vcap/app/routes/index.js:42:18
2015-11-27T16:30:16.575-0500[App/0]ERR at CallManager.process (/home/vcap/app/lib/call_manager.js:149:29)
2015-11-27T16:30:16.575-0500[App/0]ERR at Route.dispatch (/home/vcap/app/node_modules/express/lib/router/route.js:112:3)
2015-11-27T16:30:16.575-0500[App/0]ERR at next (/home/vcap/app/node_modules/express/lib/router/route.js:131:13)
2015-11-27T16:30:16.575-0500[App/0]ERR at CallManager.update_call_status (/home/vcap/app/lib/call_manager.js:44:13)

Took forever and a day to configure. Super annoying how Bluemix won't let you update credentials. Would be much cooler of a package without the Bluemix dependency.

Did @phonebot call verified_twilio_number, got the Twilio trial message, pressed a number to start the call, and it says "An application error has occurred" and that's in the stack.

Plivo

Anyone ha tried it with Plivo ?

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.