Building a two-way chatbot

So far, we have built a bot that can send SMS notifications to users at set time intervals. Although proactive, it is only communicating one way. The user is not able to send any request to the bot to change the nature or content of the message it is sending. Let's work on that.

To build a chatbot that can communicate both ways we need to do two things: build the chatbot into the web app and modify setup configurations in Twilio. To do these, follow these steps:

  1. Create an index.js file in the root directory of the project.
  2. Install the express and body-parser libraries. These libraries will be used to make a web app:
npm install body-parser --savenpm install express --save
  1. Create a web app in index.js:
// Two-way ...

Get Hands-On Chatbots and Conversational UI Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.