Demo of integration Slack with Bandwidth Messaging
Clone or download
Latest commit 54e831c Nov 22, 2017

README.md

Catapult Slack Bot

A demo bot which allows to use Bandwidth services inside Slack chat

Build

Deploy

Requirements:

  • Node 7.5+ and MongoDb 3.0+ OR Docker 1.10+ and Docker Compose
  • External https access (via port forwarding like ngrok, VPS, etc)

Install

If you use Node directly install dependencies by

# Install dependencies (Node-way only)
npm install

# or via yarn
yarn install

Go to Slack Apps console and create new Slack application. Fill environment variables SLACK_CLIENT_ID, SLACK_CLIENT_SECRET and SLACK_VERIFICATION_TOKEN by values from created application (section App Credentials).

# For Node-way
export SLACK_CLIENT_ID = <your-slack-app-client-id>
export SLACK_CLIENT_SECRET = <your-slack-app-client-secret>
export SLACK_VERIFICATION_TOKEN = <your-slack-app-verification-token> 

oauth2

Go to tab Slack Commands and add command /sms like in the picture. Use url like https://your-remote-host/slack/commands as Request Url.

commands

Go to Catapult dashboard and copy User Id, Api Token and Api Secret. They will be required later.

Now you can run the app by

# Node-way (Mongo should be ran before this step, set DATABASE_URL to with valid url to your mongo db instance)
npm start

# Docker-way
PORT=3000 docker-compose up -d # web app will be available on port 3000

Configure port forwarding to open external access if need (like ngrok http 3000).

Authorization

Open in browser next link (replace SLACK_CLIENT_ID by your Slack App client id)

https://slack.com/oauth/pick?scope=incoming-webhook%2Ccommands%2Cusers:read&client_id=SLACK_CLIENT_ID

Select team where you would like to use this application. On next page select channel for incoming messages.

permissions

After that you will be redirected to this app site to fill Catapult auth data. Press "Save" to complete authorization and see your new phone number for messages.

Sending SMS

Send in Slack

/sms <phone_number> <message_text>

If team member filled phone number in profile you can send SMS using user name like

/sms @user_name Hello there

Receiving SMSes

All incoming SMSes will be shown in special channel which you entered on authorization phase.