Backend processing
Conversational tasks usually need to be backed up by backend tasks. For instance, booking a table in a restaurant is not just a conversation, it also involves the action of booking a table. This is a backend task where the information concerning the booking is sent over to a booking server as an HTTP request. In this section, we will explore how to use the JSON API card to enable backend tasks.
Before we start using a JSON API card, we need a URL that can take a few parameters and carry out a backend task. Let's build a dummy backend service that can book a table given the restaurant name, number of people, and the time. To do this, we have to build a Node.js web app and host it on the cloud:
- Create a directory called
Eddie-bot
. In this directory, we need three files:index.js
,package.json
, andProcfile
. - Create the package file,
package.json
, which declares the packages necessary for the app, as shown here:
{ "name": "eddie-server", "version": "1.0.0...