In this post, I'll explain how to set up and run a Node.js application that augments Twilio Autopilot with Facebook Messenger features that Autopilot doesn’t currently support out-of-the-box.
This code is just a baseline for your own enhancements. It can be enhanced or changed to create something more complete and robust, expanding to any number of channels and adapting to their APIs.
- A Twilio Account - create one here for free
- A Twilio Autopilot bot set up - you can create one here. The relevant Twilio Docs are a handy source of information on how to build your bot
- ngrok (optional) - in case you are running and testing locally at first
1. Clone the Node app repo and set .env values
You can find the GitHub repo for this post here.
Then, the following values will be required in your .env file.
Twilio variables to set …
In this article, I will show you one of the many possible ways to build an Image Classifier using Twilio Autopilot in your flow. We will use Node.js with TensorFlow and show the final result on WhatsApp.
Let's get started.
Our Image Classifier is based on Transfer Learning using TensorFlow. Transfer Learning is a great way to build on top of thousands of existing training models that are already available, saving you valuable development time and resources. To learn more about it and apply your own logic, check out this TensorFlow image retraining tutorial.
Install TensorFlow by following these relevant steps.
The Main Components
The building blocks for this demo code are the following:
- A Node.js Express-based app to handle all incoming requests (for example, getting the name of the new set of images you want to train the bot with; e.g. "polar bear")
- Script for …
When working with Twilio Functions, you might need to create resources you'd like to store locally for one-off activities. For example, you might like to create a file with user-provided data and send it onto the next step in a flow based on your business needs.
In Functions, anything that you create on-the-fly gets stored in the
temporary folder, which may not be obvious at first.
In this quick tutorial, I'll show you how to access and utilize the temporary storage under Functions for your purposes. Let's get started.
Temporary Storage in a Twilio Function
If you try to perform operations anywhere other than the temporary folder in the underlying OS filesystem you will see something like:
Below I show a Twilio Function writing to and retrieving from the relevant temp folder:
/** * * This Function shows you how to reach and utilise the temporary storage under the …
When working with Twilio Autopilot, dealing with FAQs is not as straightforward as with typical user Intents and Tasks.
Let's get started.
Components and architecture of our FAQ integration
In our case, we use the following components to build an FAQ integration:
- Autopilot Tasks - to direct to the FAQ module. For example, we can make an “unresolved” case, which means Autopilot could not match an existing Intent to the user input (and we then try to see if the query corresponds to something in the FAQ)
- Twilio Function - to take the specific user input that was not matched to an intent and send it to the backend for analysis.
- Elasticsearch - to link the backend of …