Skip to content

nicolasrouanne/smsbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SMS Bot

TL;DR

SMS Bot is an application to send and receive SMS (text messages) in Slack.

Credits: it is greatly inspired by TalkBot by SlackApi (Slack Dev Team)

Setup pre-requisites

You need to create a Slack application that users will be able to add to their workspace. This setup process will provide you credentials for smsbot.

Slack

  • Create a new Slack application

You should retrieve the following credentials

SLACK_CLIENT_ID=<your-client-id>
SLACK_CLIENT_SECRET=<your-client-secret>
SLACK_VERIFICATION_TOKEN=<your-verification-token>
  • Add a Bot User, for instance smsbot
  • Add the Bot to your team, by clicking on Install App. You should be provided with 2 tokens for your bot, the OAuth Access Token and the Bot User OAuth Access Token.
SLACK_BOT_TOKEN=xoxb-<your token>
SLACK_AUTH_TOKEN=xoxp-<your token>
  • Add permissions scope to your bot. Into OAuth & Permissions > Scopes add the following scopes
    • bot - Add a bot user with the username @smsbot
    • channels:read - Access information about user’s public channels
    • chat:write:bot - Send messages as SmsBot
    • im:read - Access information about user’s direct messages
    • im:write - Modify user’s direct messages

First run

You should know have a complete .env file. Install the dependencies:

$ yarn install

You can start your project 🚀

$ npm start

Deployment

You can virtually deploy this Node.js application anywhere you like; although here is some guides on how to deploy it on Heroku and Google App Engine.

Heroku

Create a Heroku app and deploy it (see Deploying with git).

$ git push heroku master

Then set your environment variables in .env file. We will use the heroku-config plugin to set those environment variables in Heroku.

# install `heroku-config`
$ heroku plugins:install heroku-config
# push your config in .env to heroku
$ heroku config:push

Google App Engine

If you deploy on Google App Engine, you must specify a app.yaml file with all your configuration options, including environment variables. As this contains secrets, the app.yaml is not checked in source control.

A good start for an app.yaml file is to copy the app.yaml.example and replace placeholder values with your actual credentials

# copy the example app.yaml into your app.yaml file
$ cp app.yaml.example app.yaml
# edit the file and replace dummy credentials by actual ones
$ nano app.yaml

You need to set up Google Cloud SDK on your machine, as well as create an App Engine application. Then you can deploy your application

$ gcloud app deploy

About

Send & Receive SMS with Slack

Resources

License

Stars

Watchers

Forks

Packages

No packages published