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.
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
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...
Phonebot can be registered on multiple channels.
Every channel you want Phonebot to join needs both an outgoing incoming and outgoing webhook.
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:
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.
Copy the generated URL that exposes the webhook, you will need to pass this into the application as explained in the section below.
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.
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.
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.
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.
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.
Running Phonebot on your development machine is possible provided you follow these steps...