Chapter 2. Your First Bot
Readers will be amazed at how few lines of code are required to get a basic bot up and running in their Slack environment. This chapter will walk the reader through the basics of building a Slack bot:
- Preparing your environment
- Creating a Slack API token
- Connecting your bot
- Joining a channel
- Sending a message to a channel
- Basic responses
- Sending a direct message
- Restricting access
- Debugging your bot
Although some of the concepts first outlined will be known to a more advanced reader, it is still recommended to read through the first few sections of this chapter to ensure that your environment is up and ready to go.
In this chapter, we will build a bot that performs the following actions:
- Connects to your Slack team
- Says hello to all the members of a channel after successfully connecting, distinguishing between real users and bot users
- Responds to users saying hello
- Sends a direct message to users who ask for the total amount of time the bot has been running (also known...