<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Steve Tingiris</title>
    <description>The latest articles on Forem by Steve Tingiris (@tingiris).</description>
    <link>https://forem.com/tingiris</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F334124%2F8b590452-fbe3-45a5-a1a5-f7af141efe3c.png</url>
      <title>Forem: Steve Tingiris</title>
      <link>https://forem.com/tingiris</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/tingiris"/>
    <language>en</language>
    <item>
      <title>Building Autopilot Bots with the Twilio CLI</title>
      <dc:creator>Steve Tingiris</dc:creator>
      <pubDate>Fri, 14 Feb 2020 17:32:53 +0000</pubDate>
      <link>https://forem.com/twilio/building-autopilot-bots-with-the-twilio-cli-3hbd</link>
      <guid>https://forem.com/twilio/building-autopilot-bots-with-the-twilio-cli-3hbd</guid>
      <description>&lt;p&gt;&lt;iframe src="https://player.vimeo.com/video/388082136" width="710" height="399"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Hey, this is Steve with Dabble Lab and in this tutorial, I'll show you how to quickly create an Autopilot bot using the Twilio CLI and the Dabble Lab Autopilot Plugin for the Twilio CLI.&lt;/p&gt;

&lt;p&gt;For starters, &lt;a href="https://twilio.com/autopilot" rel="noopener noreferrer"&gt;Twilio Autopilot&lt;/a&gt; is a platform for building ai bots that work with Facebook Messenger, Amazon Alexa, WhatsApp, Google Assistant, SMS messaging, Telephone Systems, and just about any other conversational channel you can think of. Getting started with Autopilot is super easy and with the Twilio CLI, you can jump-start your learning with fully-functional templates to get you going.&lt;/p&gt;

&lt;p&gt;That's what we'll cover today and here's what you'll need to get setup.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;To follow along, you'll need a Twilio account, the Twilio CLI, and the Dabble Lab Autopilot plugin for the Twilio CLI. &lt;/p&gt;

&lt;h3&gt;
  
  
  Getting a Twilio Account
&lt;/h3&gt;

&lt;p&gt;If you don't have a Twilio account you can use &lt;a href="//www.twilio.com/referral/0ziFtf"&gt;my referral link&lt;/a&gt; to get one. If you use that link, we'll both get a $10 Twilio credit. That's more than enough for you to complete this tutorial and for me to fund my next tutorial. So, it's a win/win :-)&lt;/p&gt;

&lt;h3&gt;
  
  
  Installing the Twilio CLI
&lt;/h3&gt;

&lt;p&gt;The Twilio CLI lets you work with Twilio from your command line. To install the Twilio CLI, you'll need a recent version of Node.JS (10.x or later) and NPM (which is installed with node). You can verify that node is installed and get the version number by running the following command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;node &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you don't have node installed, or you don't have a current version, visit &lt;a href="https://nodejs.org" rel="noopener noreferrer"&gt;nodejs.org&lt;/a&gt; to download and install the latest version for whatever OS you're using (Mac,Linux,Windows).&lt;/p&gt;

&lt;p&gt;With node installed, you can now proceed to install the &lt;a href="https://www.twilio.com/docs/twilio-cli/quickstart" rel="noopener noreferrer"&gt;Twilio CLI&lt;/a&gt;. The CLI install process is simple. You can just run the following command in most cases.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-g&lt;/span&gt; twilio-cli
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you have any issues with the CLI installation, refer to the install documentation at &lt;a href="https://twilio.com/cli" rel="noopener noreferrer"&gt;twilio.com/cli&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Setting up a CLI Profile
&lt;/h3&gt;

&lt;p&gt;After the Twilio CLI is installed you'll need to set up a profile so the CLI can access your Twilio account. To do that, you'll need your Twilio &lt;code&gt;ACCOUNT SID&lt;/code&gt; and &lt;code&gt;AUTH TOKEN&lt;/code&gt;. You can get those from the dashboard page of the &lt;a href="https://twilio.com/console" rel="noopener noreferrer"&gt;Twilio Web Console&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F0uvbyvdot543oteyyb8m.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F0uvbyvdot543oteyyb8m.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After locating your &lt;code&gt;ACCOUNT SID&lt;/code&gt; and &lt;code&gt;AUTH TOKEN&lt;/code&gt; run the following command from your terminal or command prompt.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;twilio login
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You'll be asked for your &lt;code&gt;ACCOUNT SID&lt;/code&gt; and &lt;code&gt;AUTH TOKEN&lt;/code&gt;. Copy and paste the values from the web console when prompted. This will set up a default profile for the CLI.&lt;/p&gt;

&lt;h3&gt;
  
  
  Installing the Autopilot Plugin
&lt;/h3&gt;

&lt;p&gt;After the CLI is setup you'll need to install the &lt;a href="https://www.npmjs.com/package/@dabblelab/plugin-autopilot" rel="noopener noreferrer"&gt;Dabble Lab Autopilot Plugin&lt;/a&gt; for the Twilio CLI. You can do that by running the following command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;twilio plugins:install @dabblelab/plugin-autopilot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After the plugin installation completes, you can verify the installation by running the following.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;twilio autopilot &lt;span class="nt"&gt;--help&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see a list of the commands provided by the autopilot plugin. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fbhlbp8lafkv4wq8zez15.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fbhlbp8lafkv4wq8zez15.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you see that, we're ready to start building!&lt;/p&gt;

&lt;h2&gt;
  
  
  Using Autopilot Project Templates
&lt;/h2&gt;

&lt;p&gt;The Autopilot plugin provides a ton of functionality but in this tutorial, we're just going to focus on creating and publishing a bot from a pre-built template. &lt;/p&gt;

&lt;p&gt;The command we'll be using is the &lt;code&gt;twilio autopilot:init&lt;/code&gt; command. When you run that command, you'll be presented with a list of available templates. &lt;/p&gt;

&lt;p&gt;For this tutorial, select the &lt;code&gt;Appointment Schedule&lt;/code&gt; template and hit enter.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F9xa0e5lm78sekmmq0qpy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F9xa0e5lm78sekmmq0qpy.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When the command completes, you'll notice a new local project folder named &lt;code&gt;twilio-appointment-scheduling-bot-template&lt;/code&gt; is created.&lt;/p&gt;

&lt;p&gt;That folder contains all of the bot's backend source code and a schema for creating the bot's conversational user interface. So, all you need to do is deploy the template and you'll have a bot that's ready for testing. To deploy the template, move into the project directory (&lt;code&gt;cd twilio-appointment-scheduling-bot-template&lt;/code&gt;) and then run the following command to start the deployment process.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;twilio autopilot:deploy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The deployment process might take a minute or two but after it completes, you can run the following command to confirm it's deployed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;twilio autopilot:list
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see your bot listed in the results. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fbztzoqtp4nrwmmu3ev53.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fbztzoqtp4nrwmmu3ev53.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you do, you're ready to start testing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Testing Your Bot with the Autopilot Simulator
&lt;/h2&gt;

&lt;p&gt;After your bot is deployed, you can test it with the Autopilot simulator. You can access the simulator through the &lt;a href="https://www.twilio.com/console/autopilot/list" rel="noopener noreferrer"&gt;Autopilot Web Console&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fupvijw1iy65j98pf0022.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fupvijw1iy65j98pf0022.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Exploring what was Deployed
&lt;/h2&gt;

&lt;p&gt;The Autopilot Plugin deployed Twilio Functions using the &lt;a href="https://www.twilio.com/docs/runtime/functions-assets-api" rel="noopener noreferrer"&gt;Twilio Serverless API&lt;/a&gt; for the bot's backend along with an Autopilot bot.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Faj1e4zsgbs72kcka3npw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Faj1e4zsgbs72kcka3npw.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can view everything that was deployed through the Twilio Web Console but any changes should be made locally then deployed again using the CLI.&lt;/p&gt;

&lt;p&gt;In fact, changes to the backend (Twilio Functions) code can't be made through the web console at this time. &lt;/p&gt;

&lt;h2&gt;
  
  
  Making Changes to Your Bot
&lt;/h2&gt;

&lt;p&gt;To make changes to your bot's Twilio Functions, you'll need to modify the code in your local project folder then use the &lt;code&gt;autopilot:deploy&lt;/code&gt; command again to deploy the changes. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F3ua4iie4cungd7ojt88k.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F3ua4iie4cungd7ojt88k.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;All of the source code for the Twilio Functions can be found in the &lt;code&gt;./function/functions/&lt;/code&gt; folder, inside the project root directory.&lt;/p&gt;

&lt;p&gt;Changes to the bot can be made by modifying the bot's schema file which is located at &lt;code&gt;./model/schema.json&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;The goal of this tutorial was to just provide a quick introduction to using the Twilio CLI and the Dabble Lab Autopilot plugin to create bots from the command line. In future tutorials, I'll dive deeper into the bot code but hopefully, this was helpful.&lt;/p&gt;

&lt;p&gt;For 200+ related tutorials on building bots and voice assistants, check out &lt;a href="https://dabblelab.com/tutorials" rel="noopener noreferrer"&gt;dabblelab.com/tutorials&lt;/a&gt; and &lt;a href="https://youtube.com/dabblelab" rel="noopener noreferrer"&gt;youtube.com/dabblelab&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks for reading (or watching) and keep dabbling! &lt;/p&gt;

</description>
      <category>twilio</category>
      <category>javascript</category>
      <category>autopilot</category>
      <category>serverless</category>
    </item>
  </channel>
</rss>
