A bot is a piece of software designed to execute scripts to automate tasks that you would normally do on your own, such as make a dinner reservation, or update calendar appointment information. While they have been around for a while, running various tasks wherever they are needed, bots are increasingly being used to simulate conversations as ‘chatbots’.
Often deployed inside messaging apps, chatbots are a popular way of handling customer service requests. As an example, Taco Bell released a bot that allows customers to place and pay for orders via an automated conversation. In this tutorial on Full Stack Python, Matt Makai shows followers how to build their first bot using the Slack API and Python.
To follow along and build this Slack Bot, readers will need Python 2 or 3, Pip and Virtualenv, a free Slack account, the Python slackclient code Library and a Slack API testing token. The tutorial begins with establishing the environment and accessing Slack’s messaging channels via the Slack Real Time Messaging (RTM) API, and creating a new bot for Slack Integration.
Followers then get to write some Python code to obtain the bot’s ID before beginning to code the actual bot, connecting the Slack client to the Slack RTM API WebSocket to begin returning basic messages.
This simple chatbot can be enhanced with whatever features you want to build, such as retrieving information or issuing automatic responses. The author provides all of the code you need to build this Slack Bot, making this an ideal tutorial for first-time bot builders.