JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
images
.gitignore
LICENSE
README.md
handler.js
package.json
serverless.yml

README.md

smsbot - ☎️🤖

what?

smsbot provides an integration with Slack that connects SMS messages into channels.

People can text an external number and have their messages posted into the channel. Channel users can respond to the messages and have their response sent back to the sender using SMS.smsbot

how?

smsbot was developed in under a few hours and less than one hundred lines of code using a serverless platform and cloud services.

More details in this blog post: https://medium.com/@jamesthom.as/building-an-sms-bot-for-slack-d52b5bc397e4

setting it up

Follow the steps below to create your own instance of smsbot.

openwhisk

Register for an account with an OpenWhisk provider, e.g. IBM Bluemix.

Set up the wsk CLI and run the command to authenticate against the platform endpoint.

wsk property set --apihost openwhisk.ng.bluemix.net --auth SECRET

serverless framework

Install the The Serverless Framework and the OpenWhisk provider plugin.

npm install --global serverless serverless-openwhisk

source code

Download the source code from Github and install the project dependencies.

$ git clone https://github.com/ibmets/smsbot.git
$ cd smsbot
$ npm install

Create a new file called credentials.yml with the following content.

twilio:
    account:
    auth:
    number:
numbers:
slack:
    webhook:

twilio

Register an account with Twilio and provision a new phone number. Make a note of the phone number. Retrieve the account identifier and auth token from the Twilio console.

Fill in the account identifier, auth token and phone number in the credentials.yml file.

twilio:
    account: AC_USER_ID
    auth: AUTH_TOKEN
    number: '+441234567890'

Important: the twilio.number property value must be a quoted string.

phone numbers

During Twilio's free trial, you will need manually verify each phone number that you want to send messages to.

Fill in all verified numbers in credentials.yml.

numbers:
    '+441234567890': Joe Smith
    '+441234567891': Jane Smith

Important: the numbers property values must be a quoted strings.

incoming webhook

Create a new Incoming Webhook integration for the Slack channel messages should appear in.

Fill in the slack.webhook property in credentials.yml with this url.

slack:
    webhook: https://hooks.slack.com/services/XXXX/YYYY/ZZZZ

deploy application

Use The Serverless Framework to deploy your application.

$ serverless deploy
Serverless: Packaging service...
Serverless: Compiling Functions...
Serverless: Compiling API Gateway definitions...
Serverless: Compiling Rules...
Serverless: Compiling Triggers & Feeds...
Serverless: Deploying Functions...
Serverless: Deployment successful!

Service Information
platform:	openwhisk.ng.bluemix.net
namespace:	_
service:	smsbot

actions:
smsbot-dev-incoming    smsbot-dev-reply

triggers:
**no triggers deployed**

rules:
**no rules deployed**

endpoints:
**no routes deployed**

twilio webhook

On the Phone Numbers page in the Twilio console, configure the "Messaging" webhook URL.

Use this Web Action URL, replacing user@host.com_dev with your namespace.

https://openwhisk.ng.bluemix.net/api/v1/experimental/web/user@host.com_dev/default/smsbot-dev-incoming.http

outgoing webhook

Create a new Outgoing Webhook integration for the Slack channel messages should appear in. Use smsbot as the Trigger Word.

Use this Web Action URL, replacing user@host.com_dev with your namespace.

https://openwhisk.ng.bluemix.net/api/v1/experimental/web/user@host.com_dev/default/smsbot-dev-reply.json

usage

Send a text message to the phone number you registered through Twilio. smsbot should post the contents into Slack and send an SMS response with the message "Thanks for letting us know!".

smsbot

If you send a channel message starting with the trigger word (smsbot), the phone number should receive a new SMS message with the message text.

smsbot

Awesome-sauce 😎.

issues / feedback / feature requests?

If you have any issues, comments or want to see new features, please file an issue in the project repository:

https://github.com/ibmets/smsbot

Made by IBM Emerging Technology Services.