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:
- Create an index.js file in the root directory of the project.
- Install the express and body-parser libraries. These libraries will be used to make a web app:
npm install body-parser --save
npm install express --save
- Create a web app in index.js:
// Two-way SMS Bot
const express = require('express')
const bodyParser = require('body-parser')
const twilio = require(...