How to Create a Chat Bot in Ruby Using Slack API
https://medium.com/@spikeburton/how-to-create-a-chat-bot-in-ruby-using-slack-api-209591dfff1f
Photo by Franck V. on UnsplashWhen I first started out at a coding bootcamp a few months ago, classmate Dana Simmons and I decided it would be great fun to create a bot for our cohort’s Slack channel. Since we were learning Ruby at the time, I searched across the web on how to get started and came across this article which describes how to interact with Slack API using a couple of gems. Although this proved to be a great entry point, much more work was required to get everything running smoothly. I thought it would be beneficial to share our experience and create a simple new bot from scratch.
First, you will need a Slack workspace in which you can develop your bot. Go here to create a new workspace if you do not have access to a space in which you can do ample testing. The next step is to head here and click on Create an App. Give the app a descriptive name, and choose the development workspace from the previous step. Under the Add features and functionality header, choose the Bots option. Follow the instructions to add a bot user, and then on the left hand side under settings choose Install App and then Install App to Workspace. You will be prompted to authorize the bot user at this point, and then will be presented with two authorization tokens: a general access token and a token for the bot user. Make sure to hold onto the bot user token, prefixed with xoxb — we will need that in a later step.