Top 10 Ways to Utilize the Slack Bot API — Boost Your Productivity

Jennie Lee
4 min readMar 30, 2024

--

Looking for a Postman alternative?

Try APIDog, the Most Customizable Postman Alternative, where you can connect to thousands of APIs right now!

Introduction

Building a Slack bot can be a fantastic way to boost productivity and streamline communication within your team or organization. As a software testing engineer, I have had the opportunity to explore the world of Slack bot development and build my own bot called Snack. Snack is a chatroulette-like platform that allows colleagues to have video conversations in a remote work setup. The user experience is simple: join a specific channel, type a command, and start a video conversation with a randomly assigned colleague. However, behind the scenes, the complexity of building a Slack bot was beyond my expectations.

The Complexity Behind the Scenes

When I initially set out to build Snack, I thought it would be a relatively straightforward task. Little did I know that the development process would involve a massive amount of code, exceeding 70,000 lines. The complexity stemmed from integrating various functionalities, such as video hosting, user presence detection, and effective communication with Slack users. Each of these elements posed its own set of challenges and required careful consideration and implementation.

Using a Framework: Slack Bolt

One of the biggest lessons I learned while building Snack was the importance of using a framework for building a Slack bot. Frameworks provide a solid foundation and streamline the development process by offering built-in functionalities and simplifying interactions with the Slack API. An excellent example of such a framework is Slack Bolt. Unfortunately, I was unaware of Slack Bolt at the time and opted to use the Slack SDKs instead. Looking back, I realize that using Slack Bolt would have greatly simplified the development process and saved me a significant amount of time and effort.

Hosting Video with the Slack Bot

Integrating video functionality into Snack was a crucial aspect of the bot’s development. Initially, I integrated the Zoom API to start and end video meetings, as well as to subscribe to events such as participant joining and leaving. While the Zoom API served its purpose, I later switched to using Twilio WebRTC due to its ability to provide a more flexible and customizable video experience. Twilio WebRTC allowed me to tailor the video functionality to better suit the unique needs of Snack users and enhance their overall video communication experience.

Finding Active Slack Users

One of the challenges I encountered while building Snack was determining which Slack users were actively present in the workspace. The Slack API does not provide a scalable way to check if users are present. To overcome this hurdle, I requested Slack permissions to read the list of workspace users. With access to this information, I implemented randomized checks of user presence using the rate-limited getPresence API. By periodically checking user presence, Snack can ensure a higher likelihood of matching colleagues for video conversations when they are available.

Effective Communication with Slack Users

Communicating with Slack users through the Slack API presented its own set of difficulties. I had to find creative solutions to effectively convey information and updates to bot users. One approach I used was leveraging the response_url feature for the initial interaction, allowing more dynamic and interactive conversations. As the conversation progressed, I relied on ephemeral messages to provide private updates to individual users, regular messages for general updates, and threading for organizing meeting-related discussions. This mix of techniques ensured efficient and clear communication with Snack users.

Conclusion

Building Snack, a Slack bot for video conversations, was a challenging yet fulfilling project. Despite the unexpected complexity and the massive amount of code required, the end result has been rewarding. Snack has gained traction within various Slack organizations, facilitating over 400+ snack meetings to date. The bot continues to evolve, benefiting from the valuable feedback received from users. If you’re interested in building a Slack bot to boost productivity and enhance communication within your team or organization, I encourage you to give it a try. And remember, don’t forget to leverage the power of frameworks like Slack Bolt and explore the numerous capabilities provided by the Slack Bot API. Happy bot-building!

Looking for a Postman alternative?

Try APIDog, the Most Customizable Postman Alternative, where you can connect to thousands of APIs right now!

--

--