![]() ![]() We can do anything we want to in Node – looking up information, contacting other APIs – triggered by messages from Slack. Using these APIs, we can respond to almost any sort of activity – slash commands, regular messages, people joining a channel – and interact. Slack slash commands are documented and set up separately from the Events API, but operate using the same principal – Slack makes a web request to our server when a slash command is made by a user. The primary part of the API we will use is the Events API, which causes a web request to be made to my Glitch instance (or other server) whenever certain events happen. There is a Real Time Messaging (RTM) API which acts much more like a logged-in user, but it requires WebSockets, which we won’t use here. I’m sticking with the Web and Events APIs, both of which operate using plain web requests. There are multiple ways to build bots for Slack and they have different capabilities. When developing a bot for Slack, you can pop back and forth between Glitch and Slack and see changes in real time. ![]() Using this, you can iterate on your application quickly. If you haven’t used Glitch before, it’s an online code editor for Node.js that automatically saves and restarts your application on edit and hooks it up to a domain. I have spent some time recently building bots for Slack using Glitch, and it is one of the most fun experiences I have had writing code. ![]()
0 Comments
Leave a Reply. |