Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training,
learning paths, books, tutorials, and more.

Chapter 3. Adding Complexity

With the first bot done, it's time to learn how to extend our bot with the use of other application program interfaces (APIs). This means teaching our bot how to listen for keywords, respond to commands, and deal with errors (human or otherwise). In this chapter, we will cover the following:

Responding to keywords

Bot commands

External API integration

Error handling

Responding to keywords

In the previous chapter, we used regular expressions to test the contents of the message against some predefined keywords. Once the keywords were confirmed, we could perform actions and return the results. This worked well; however, it can lead to a large if else block for more feature-rich bots. Instead, we will now look at refactoring ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training,
learning paths, books, interactive tutorials, and more.