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)
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
.
- 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 @smsbotchannels:read
- Access information about user’s public channelschat:write:bot
- Send messages as SmsBotim:read
- Access information about user’s direct messagesim:write
- Modify user’s direct messages
You should know have a complete .env
file. Install the dependencies:
$ yarn install
You can start your project 🚀
$ npm start
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.
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
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