David Built a Serverless Slack Bot 🔗
How David Built a Serverless Slack Bot
If you use Slack for work or school, you know that team members and/or instructors answer many of the same questions repeatedly, thus reducing their productivity. What is needed is a solution that allows team members/classmates/instructors to grow a knowledge base and have these questions answered by a bot in Slack. This project aims to do just that!
Wise-Guy, a Serverless Slack Bot, aims to help alleviate that stress, and will help boost productivity. It works by using slash commands in Slack to update the knowledge base. The bot then monitors whatever channel it is added to for keywords. If it recognizes one of the keywords, it will reply with a threaded conversation.
My name is David Tetreau. I am a career changer aiming to transitioning into a career in web development. I have many years of experience in the government and military sectors in non-technical roles. Although I do have a great deal of formal education, I have also taken several non-traditional training programs on my path to being a Web Developer. One of these programs was Bit Project. I learned a great deal about serverless technologies, and I discovered that I enjoy sharing knowledge with others who have the same goal! Here is a project I built during the program.
Behind the scenes (include and describe flowchart)#
The chart above was the initial project plan. It included a much more complex architecture. The architecture was simplified and includes a Node.js app deployed to a serverless platform, the Slack Bolt Framework, and a JSON file which acts as a simple database. The conversation channel that interacts with the bot was simplified to only interact with Slack.
Slack Bolt Framework#
Web Sockets can be used to develop a Slack App and this offers a much faster development experience. While developing this project and prior to deployment, all requests to my development server were made via WebSockets.
Simple mini database using a JSON file#
By using a JSON file with keywords, questions, and answers, this project can run without a complicated database. If the data requirements become very complex, other technologies like MongoDB could be added.
The Slack platform was used to create the Slack App along with the slash commands that are used to update, delete, and list the knowledge base. The app is added to a workspace and then to specific channels where it monitors messages and responds if there is a keyword from it's database recognized in the conversation.
Azure Web App#
After this project is finalized, it can be deployed to an Azure Web App by using WebHook Integration. In the meanwhile, it is run locally using Node.
There are a number of additional features which can be added to this bot. The bot can DM channel members if the bot doesn't know the answer to their question, there is a block builder kit to include features such as buttons and modals. Who knew you could customize and automate Slack to do exactly what you want it to do? What's more, who knew that you can incorporate serverless technologies such as Azure to host such a solution? I can't wait to see what you build with it!
Thanks and Acknowledgements#
Thanks to Bit Project for devoting their talent, time, and expertise to teaching students from all walks of life the value of using serverless technologies.