Twilio autopilot

Twilio autopilot DEFAULT

Build a competition entry chat bot with Twilio Autopilot and Facebook Messenger

The Apprentice is back on TV screens around Asia, and Twilio is the official technology partner. Throughout the series Twilio APIs have supported the show and candidates; delivering notification messages to the teams, powering their solutions in episode 11, and running a Watch & Win competition for the viewers.

The Watch & Win competition was implemented as a chatbot over Facebook Messenger. In this post we will look at how you can build your own competition bot using Twilio Autopilot, Twilio Functions and Airtable.

A screen grab of talking with a bot over Facebook Messenger. It asks a question, I respond with the answer, then it asks for my name which I also respond to.

Defining the competition

To build a watch and win competition bot, we need a few parameters for how the bot will work:

  • The competition will run every week that the show is broadcasting, with a new question per episode
  • The question will include a phrase that was said during the week's episode and three options for who said it
  • Viewers can enter the competition by chatting with a bot on Facebook Messenger and answering the question
  • We also need to capture some details from the user, such as their name, their email address and whether they agree with the terms of the competition
  • If the viewer has entered before we don't need to ask them for the details again, so we should store that information

With those details in mind, let's get building.

What you need to build this bot

To build this bot we're going to use Twilio Autopilot, Twilio Functions and Airtable. Twilio Autopilot will allow us to collect users' answers in a conversational manner and Airtable will be used to store the answers. Check out this post on using Airtable and Twilio for an introduction on how this works. Twilio Functions will let us return the right questions to be asked and connect Autopilot to the Airtable API to store the answers.

To follow along with this tutorial you will need:

With those accounts to hand, let's get started.

Setting up Airtable to store the data

Let's get our database in shape first. Open your Airtable account and create a new base from scratch. Your new base will have one table with a few columns. We don't want to use those columns, but we can edit them into shape.

A view of the default base that Airtable gives you. It has columns for Name, Notes, Attachments and Status

Start by renaming the table to "Users". We'll make the primary column the user's Facebook Messenger ID. Change the first column, the primary field, from "Name" to "ID". We still want the user's name, so change the "Notes" column from a "Long text" field to a "Single line text" field and change the column name to "Name". We need the user's email address so that we can contact them if they win, so change the third column to an "Email" field called "Email". Finally we want to know that the user agreed to the terms, so change the fourth column to a "Single line text" field and change the name to "Terms". Now we can add slots for the user's answers, add a "Single line text" field and call it "week1" then add as many more fields as you want to ask questions.

An updated Airtable base with columns for ID, Name, Email, Terms and Week1.

Once you're done with that, open up the Airtable API documentation and choose your base. At the top of the documentation will be the ID of your base. Open up another browser tab and head to your Airtable account. Here you can generate an API key. We'll need both the ID and the API key later.

Building the bot

Next up, we're going to create and train our Autopilot bot to ask the competition questions. Log in to the Twilio console and navigate to the Autopilot section. There are plenty of bot templates, but we'll start this bot from scratch, so click on Build from scratch. Give your bot a unique name, like ‘watch-and-win-bot’, and click Create bot.

When the bot is created you will see a number of tasks already set up for you: a greeting and goodbye that can be used at the start and end of conversations, and two fallback tasks. We will keep all of these tasks and add a couple more to ask the questions for our competition.

Let's update the greeting task, we want it to greet users and ask them whether they want to enter the competition. Click on Programnext to the greeting task. You will find a JSON object that looks like this:

Autopilot tasks are trigger actions which are defined in JSON like the above. You can either define your actions statically, within the Autopilot interface, or you can trigger a webhook to your own application and respond dynamically. We are going to use both types of response in this bot. You can read more about actions in Autopilot in the documentation.

Update the "say" action to ask the user whether they want to enter the competition. Since we are asking a yes or no question, we can also restrict the tasks that can be triggered by the answer. Update the "listen" action to listen for the tasks "goodbye" and "enter_competition". Your actions JSON should look something like this:

We now need a task that will start the competition questions. We want to trigger this task by either responding positively to a welcome message or by asking to enter the competition.

Click Add a task, name the new task enter_competition and click Add. Click on Train for your new task. Here is where you enter the phrases you want to trigger this task. The phrases should be in response to the greeting question, so enter some sample phrases that you expect your users will say, from simple, like "Yes", to a bit more complicated, like "I want to enter the competition". The more sample phrases you can think of, the more accurately the bot will be able to determine your users' intentions.

Setting up samples for the task. There are samples like

We'll update what the task does when it is triggered later. Save the task and click on Build model. This takes all the work we've just done and trains the bot to respond to any potential incoming phrase. Now open the Simulator from the navigation, here you can test that your bot is working as expected so far.

Testing the bot in the simulator, there is a chat panel on the left where I am talking to the bot and on the right it shows the matched task.

We need to have the bot return real questions and save them to our Airtable base, so we'll tackle that next using Twilio Functions.

Dynamic responses using Twilio Functions

Autopilot allows you to respond to tasks with static JSON, as we've seen so far, or by sending a webhook to a URL. Twilio Functions is an easy way to create endpoints that can respond to webhooks, hosted within the Twilio platform. We can develop our Twilio Functions locally using the Twilio CLI and Twilio Serverless Toolkit.

Follow the instructions to install the Twilio CLI and log in to your account and then install the Serverless Toolkit with:

Generate a new Twilio Functions project with the following command:

The flag means you don't get a bunch of example files. Once the project is created, open it in your favourite editor.

Responding to the bot with Functions

Let's start our work on these functions by responding to the bot with a "say" action. Create a new file called in the directory of the project. (A function with in the file name will only respond to requests that have a valid header.) Open and enter the following code:

So far this function is returning static JSON like before, but this is just the start. Change the current directory to the root of the project, and run the functions project with the terminal command:

This will start your functions. We also need to make the functions available from a publicly accessible URL so that they can receive webhooks from Autopilot. Open up a new terminal window and start up ngrok with the following command.

The terminal will show you a URL that looks like . Copy this URL and return to your bot in the Twilio console. Go to the tasks, click on Program next to the enter_competition task. At the top you can choose between using an ActionBin or Actions URL, check Actions URL and enter . Leave ngrok running as you build and test the rest of this application.

Save the model and build it again. Once the model is built, open the simulator again and start a conversation with the bot. This time when you say "Yes" to entering the competition, Twilio will make a request to your Functions project and the bot will respond with "Hello from your function.". You can also inspect the request with ngrok by opening localhost:4040 in your browser. In this request inspector you can see all the parameters that Twilio sends.

The ngrok dashboard showing the incoming request and all of its parameters.

Now our bot is connected to our function we can get down to the work of creating a dynamic response.

Loading question and user data

We'll store our questions as a private asset in our Functions project. Create a file in the directory called . Each question will belong to a week, have some text for the question, three options and a time in the future that it is live until. This time will allow us to pick the currently active question.

Add the questions to like this:

We are going to load and save user data in Airtable, so install the Airtable npm module with:

You collected your Airtable API key and base ID earlier. Add those to the file:

In this function we are going to find out if the user is already in our database and has answered this week's competition question. If they have already answered then we turn them away until the next episode has aired. If they are in the database but haven't answered we can greet them by name and ask them this week's question. If they aren't in the database then we greet them and ask them the current question, their name, their email address and whether they accept the terms.

Let's first load the questions and select the current one in . In the Twilio Function environment we can require private assets into our function by retrieving its path from the function and then requiring it as normal. Once we have loaded the questions, we find the latest question. If there are no questions left, we can exit the entry and tell the user the competition is over.

Next we need to try to load the user details from the Airtable base. In the Autopilot webhook request there is a parameter. This parameter contains a JSON string of details about the user we are interacting with as well as their responses to questions we ask and other arbitrary data that we tell the bot to remember. The has a property that stores details about the user and when we interact with the bot using the simulator the object has a property. When we interact with the bot via Facebook Messenger, as we will later, the object will have a property. Both the and objects have a property that identifies the user, so we will use that as the ID.

We need to load any data we have about this user from Airtable. Require the Airtable library and load the base and the table using the API Key and Base ID you stored in the environment earlier.

You can find rows in the Airtable table by ID, but we don't know that ID. Instead, we filter the results by the ID column, limit it to one record and load the first page. Now we know if we have the user details already if there is a record in the array. There are three scenarios now, the user hasn't answered any questions before, they have answered other questions, but not the current one, or they have answered the current question. Based on this, we need to build up our JSON response to send back to Autopilot.

Let's add a response object that has an property which starts as an empty array. At the end of the function, we'll return this response to the function.

Let's start by taking the case where we don't already have a user in our database. We want to welcome the new user and then ask them all the questions (this week's question, their name, email address and whether they accept the terms). We use the Remember action to remember the question week we are working with. We ask the questions using Autopilot's Collect action, which includes validations for some answers and uses built-in field types to recognise things like names, email addresses and yes/no answers. Note also that we name the questions the same as our Airtable column names, which will make it easy for us to insert them later.

Ok, what if we already have a user? We need to check whether they have already answered this week's question and if they have, tell them to come back next week. And if they haven't, we'll greet them by name, remember the ID of their user record and only ask the question. Since we have already built up a question object, we can refactor that out of the new user block and use it here too.

Here's the complete code:

At the end of each of the Collect actions you see an block. When the user has finished answering all the questions successfully this action is evaluated. Our action will redirect the bot to a new URL, a function we are yet to write. This function will store the answers in Airtable and thank the user for entering.

Let's build that function now. Create a new file in the directory called and open it in your editor.

To start with we access our Airtable Users table, parse the Memory object and load our user identifier the same as the last function.

This is some repetition, but there are only two functions and there's more overhead to refactoring this than just repeating ourselves twice. If we started another function which used the same functions it would become worth refactoring, but we will leave it for now.

We need to get the answers out of the memory object and into a format that we can pass to the Airtable API. The answers aren't an object of keys and strings, but keys and objects with more data about the answer. You can see some examples in the documentation here. This code formats the answers into a simple object:

After formatting the data, all that's left to do is either update the existing user or create a new one in the Users table.

Before we test this out in the simulator, we need to make one change to the environment. Even though Twilio will be requesting the functions through the ngrok URL, the functions environment still considers its domain name, exposed as , to be . Add the following line to your file.

Restart the server then head back to the Autopilot simulator. Start a conversation with the bot and it should take you through all the competition questions. Try again after that and it will tell you that you have already entered. Check your Airtable base and you will find your answers.

Testing the quiz in the simulator again. This time it goes through all the questions we need to ask.

Deploying the Functions

Head back to your code and remove from the file. On the command line, run:

Your Functions will be deployed to a new Twilio Runtime service and at the end you will be given a URL. In your Autopilot bot, update the URL for the enter_competition task to point to this new URL and build the model again.

We've written our bot, the way to handle storing and loading data from Airtable and deployed it all to the Twilio Runtime. The last thing to do is connect the bot to Facebook Messenger.

Connect the bot to Facebook Messenger

The best advice I have here is to follow the instructions in the documentation for connecting your Autopilot bot to Facebook Messenger. Once you've completed that, you will be able to talk to your bot through Messenger.

A screen grab of talking with a bot over Facebook Messenger. It asks a question, I respond with the answer, then it asks for my name which I also respond to.

We built a competition bot

In this post we've seen how you can use Twilio Autopilot, Twilio Functions and Airtable to build a bot very similar to the bot behind the The Apprentice: ONE Championship Edition watch and win competition. The only thing left to do is decide on your winner!

All the code for this bot is available in this GitHub repo. The bot is deployed to Facebook Messenger, but you could also hook this up to an SMS number, a voice call, WhatsApp, or your own custom channel. There's more you can build with Autopilot and these channels, from the serious, like helping people get involved in local issues, to the silly, like making BuzzFeed style quiz bots.

I'm not sure this bot would win me a spot in The Apprentice final, but hopefully it's inspired you to build something. Are you building your own bots? Let me know by dropping me an email at [email protected] or shooting me a message on Twitter.

Sours: https://www.twilio.com/blog/build-competition-entry-chat-bot-twilio-autopilot-facebook-messenger

Introducing Twilio Autopilot — A conversational AI platform to build bots that work


There’s a huge gap between the promise and reality of bots. Bots tend to get stuck in loops and fail to achieve the task at hand. If they do manage to break out of the loop and handoff to agents, they often lose the context of data collected to that point.

Today, developers have to choose between software-as-a-service bot builders focused on particular use cases with limited customizability or, natural language understanding services that are essential but not sufficient to build a complete conversational flow.

Today, we're announcing Twilio Autopilot— a conversational AI platform to build intelligent bots, IVRs, and Alexa apps that work.

Twilio Autopilot is made up of three building blocks:

  1. A Natural Language Understanding engine that analyzes user intent.
  2. A Conversational Application Platform to build sophisticated workflows.
  3. An Omnichannel Hub for broader reach across channels such as SMS, Voice, Whatsapp, FB Messenger, Alexa, and more.

Get started with Autopilot today.

A New Approach — Decoupling Business Logic and Style

We've modeled Autopilot separating business logic from style, similar to best practices for building web and mobile applications. Decoupling the two reduces the complexity of coding for all edge cases. Developers can focus on business logic on one side and styling/personalizing a bot on the other side. With this unique approach, developers can create bots that can have a tone a voice that defines their personality.

Autopilot features such as the Natural Language Router and Autopilot Actions handle business logic, while Stylesheets can be used to define the factors that give bots a personality.

Autopilot Features

A. Analyze intent with Natural Language Router to redirect issues

Some inquiries could be entirely self-service, such as, “I want to book a flight.” Others are partly self-service, like “I want to buy life insurance.” More critical inquiries such as “I need advice on what kind of mortgage I should take ” need immediate agent support. Autopilot's Natural Language Router takes customer issues and chooses the right task for the job.

B. Control the flow of conversations with Autopilot Actions.

Autopilot Actions are JSON commands or instructions that tell Autopilot what to do. With Autopilot actions, your virtual assistants can say something to the user, show something to the user if the device has a visual display, remember something for context, collect data, or redirect so you can control the flow of your dialogue.

Here are some examples of Autopilot Actions:

1. { Collect }

Data collection is one of the most common tasks that bots perform. The { Collect } action enables you to ask questions to users and efficiently collect answers.

Here’s an example of how to use { Collect } to collect answers to multiple questions:

2. { Hand Off }

The Autopilot { Hand Off } action enables you to transfer a user from an Autopilot session to a human agent, passing along all the context of the conversation.

Here’s an example of how to use { Hand off } to transfer the Autopilot session to a Programmable Voice TwiML URL:

Build AI-Powered Assistants

Use Twilio Autopilot to build, train, and deploy bots that work.

Bots that are intelligent. Build intelligent IVRs, bots, and Alexa apps that are powered by Twilio built Natural Language Understanding and Machine Learning frameworks.

Bots that keep learning. Autopilot provides the training pipeline and interfaces to train your bots using real-time data, making your bot smarter over time.

Bots that can contextually handoff to a human. Smoothly transition a bot conversation to a conversation with agents when necessary, passing along the full context of the interaction.

Bots for every channel. Autopilot responses are adapted to provide the best experience on nearly any channel including IVRs (Interactive Voice Response), SMS, Chat, Alexa, Slack, and Google Assistant. Developers can build once and deploy across multiple channels instantly.

Join us on Nov 1st, at 10 AM PT for Keeping it Human: Bots, AI, and Customer Experience, a live webinar with the Autopilot team. We’re talking about delivering better customer service with artificial intelligence.

How Does it Work?

Introducing Twilio Autopilot — now in Beta

Autopilot uses a request/response model similar to TwiML. When a request comes in it performs the natural language analysis to route the user to a task. Tasks are configured with URLs that point to your application. Your application then responds using the Actions, and Autopilot does the work to make sure they work across all channels.

Getting Started

Want links? We’ve got links. To learn more, visit the Twilio Autopilot homepage. Autopilot’s pay-as-you-go pricing model ensures that you only pay for what you use.

We’ve also put together docs that include quickstarts and full API reference documentation so that you don’t get lost along the way ;)

If you want to see Autopilot in action, join us for a webinar on Nov 1st, 10 AM.

Head over to your Twilio Console to start using Autopilot.

We can’t wait to see what you build!

Sours: https://www.twilio.com/blog/introducing-twilio-autopilot-a-conversational-ai-platform-to-build-bots-that-work
  1. Furniture glide
  2. Values sql server
  3. Free eucalyptus svg
  4. Altice on demand
  5. Rock buggy frame

Twilio Autopilot Introduction, Advantages and Latest Pricing 2021

With the introduction of Twilio everywhere, the platform has made a great impact and upsurge the communication level with each customer. For the communication purpose, every client’s first priority on the list is only Twilio. Well, we already highlighted Twilio in our previous blog and even about the Twilio Flex regarding reinforcing communication level for mid and large scale organization. Now we are going to share one more new introduction which Twilio has shared globally and it is related to Artificial Intelligence chatbots and that is Twilio Autopilot. The blog is going to be very informative but before going to explain other aspects, we are going to share first “What is Twilio Autopilot”.

What is Twilio Autopilot?

The Autopilot is considered to be the conversational Artificial Intelligence platform which is well-known for building up, training and also even deploying artificially intelligent chatbots. There is a big opportunity to adopt this platform as it can train task-driven conversations which is basically to automate data collection flows and also intent-based routing. Its features are:

  • Its main focus is on deploy as conversation IVR on a phone number and the best part is it deploy chatbots on SMS, FB Messenger and on WhatsApp too.
  • You all heard about the Alexa Skill, so let us aware you here that Autopilotdeploys chatbots on Alexa skill or Google assistant action.
  • One of the best features regarding Autopilot is it learn from a real conversation as it easily reforms your assistant learning from the real conversations and also with real-time analytics.
  • With the assistance of AutopilotTwilio, it handoff to the human agents when there is a requirement in a programmable voice or if the requirement is in messaging channels.

How Twilio Autopilot fulfill your needs

You all have understood about the features of the Twilio platform and even about Twilio Flex that how it may strengthen your business objectives. It’s time to understand now the advantages of AutopilotTwilio, that how it is best for your assistance.

advantages of twilio autopilot

Build up a great and advanced Bots

If you want to hone your goals to make more smarter and great bots for your work then you can do this by using Autopilot Twilio. We believe that you shared your extra efforts for making bots but going for Autopilot your efforts will be saved while using built-in capabilities.

It plays an essential role to convert speech into text and then just feed it on Autopilot’s NLU engine. Now if we talk about the data purposes then it safely stores the entire data collected from customers.

Assist you to analyze and annotate the conversation swiftly

Basically, Autopilot may assist all of you to annotate fields in real customer’s conversations as it is a part of the task that your bots need to get access to.

If there is a requirement from your side to analyze the performance of Autopilot then you quickly do that and monitor it too. You can get to know when the tasks were performed or when the entire data was collected.

Best to transfer conversation between Bots and Human

This is what you actually should believe as its prominent method to transfer conversation and it can happen as you can transfer from bot to human and there is zero percent chance to lose conversation text.

Information can be regarding customer’s details or about customers provided but feel free it will remain safe. Now let us aware you that you can add up your customer channel and also integration is possible via WhatsApp, Facebook Messenger and Google Assistant.

Big support of DTMF to interact with Bots

Reading out about the advantages of Autopilot Twilio, add this too which can help you regarding caller options. If you build IVR with Autopilot, it’s easy for you now to provide callers option just for using the DTMF for the interaction with the bot.

Do you want to know more why it is useful for you? If there is a requirement of providing a long numerical sequence like you can save a Bank account number. For your help, make sure to go for “Listen” and “Collect” actions by adding DTMF support.

Interact with the caller by using pre-recorded audio

You have a chance to use pre-recorded audio with the assistance of Play action only as you can use for text-to-speech for the interaction with the caller.

Before going for this, make sure you have the perfect IVR script and need to use pre-recorded voices. We heard many want the best method to interact with the caller so it’s a great holistic method introduced by Twilio in Autopilot for you all.

Industries where Twilio Autopilot can rule easily

Using a most advanced platform then how can it not help in the industries. You all have read out about the CRM Software one of the most trending industries as we shared too, where it can play an essential role in the day to day business. Now it’s time to understand about Autopilot Twilio on which industries it is suitable for. Have a look

Retail and E-Commerce

First we are going to share with you about Retail and E-Commerce as using this Autopilot in your work you can share more and more promotional offers for your organization. Big deal!

e-commerce and retail industry

Wait, not only you but also your customers too which allow all of them to search the products more quickly and easily. Using this Autopilot, you can grab many such features like checking delivery status, work profile status and much more so go for it.

Travel Industry

Now the second industry where this platform can play a big role and that is theTravel Industry. You all have understood earlier about CRM software in the Travel Industry that how the software gives much better functionality.

travel industry

Let us clear your doubt about Autopilot Twilio that when you apply for it and make use of this industry then it is going to help you self-service offer changes or even you can send promotional offers for your industry growth. You can answer every question of FAQ too.

Real Estate

Hope every entrepreneur of Real Estate is reading this blog as we are going to share now about this industry that how Autopilot may strengthen their whole industry. Every real estate worker always thinks twice and thrice to choose a software or even a platform to hone their goals.

real estate industry

But let us tell you that Twilio Autopilot can really assist you for generating leads in your work and make a good connection with customers. You are able to answer every question about listings. Moreover, scheduling every appointment with the help of this platform is an easy job.

Hospitality Industry

Now the last but not least as we are going to introduce here to the Hospitality industry. We are sure that Autopilot can help you in a better way and can completely change the way of your business by giving better features.

hotel industry

Going for Autopilot, you have a chance to present and offer virtual concierge services and yes, you can answer to every FAQ properly. How about conducting a survey? You can perfectly conduct a customer satisfaction survey if you want to.

Three Primary components of Autopilot

We shared what actual Autopilot is and its role in some of the greatest industries. Now you need to keep your eyeballs here and understand the core components of Autopilot. We have jotted down some points below-

  • The first component and most well-known in the Twilio industry is “Natural Language Understanding” which is a perfect choice for each and every developer for building up the custom model. It’s a great idea for Artificial Intelligence as it will go to enable them to understand use cases or grammar.
  • Moving on to the next core component of Autopilot and the name is Conversational Application Platform which is well-known for a name called a Style sheet. The role of this component is to handle the dialogue and state management too. It is responsible for that and also the component who handles the errors is this CAP component. You want to have full control of bot’s tone and language then it is possible.
  • The third and the final core component is Omni-channel Hub that plays an essential role in translating JSON into protocol just for selected communication channels. Let me share the parts of these components and those were handoff action and data collection and instruction regarding communication.

Current Twilio Autopilot Pricing 2021

You can say that this is the crux of this blog as you are using something, so you must be aware of its latest pricing. Well, talking about Twilio Autopilot Pricing 2021 then let us tell you that the pricing is based on the channels of it. Allow us to share the names of the channel and Twilio Autopilot Pricing 2021.

twilio autopilot pricing

Voice: $0.04 per minute
Messaging: $0.001 per message
Chat: $0.001 per message
Google Assistant/Alexa: $0.001 per utterance

Concluding Note

Thanks to Twilio for once again showing a greater format for all such users who want a platform like Autopilot which is the perfect choice to build up the chatbots for you. We are sure that reading out about the advantages of the Autopilot you get to know how dominant the platform it is for your work activities. But the platform is useless if the user doesn’t know about its pricing. We find this accurate for you by sharing Twilio Autopilot Pricing 2021so that you can choose the channel whichever you like or which one is most suitable. Sharing in brief about the Twilio Calls and SMS, it’s time to shake hands with Autopilot now.

Sours: https://store.outrightcrm.com/blog/twilio-autopilot-introduction-advantages-and-latest-pricing/
How to build a chatbot using Twilio Autopilot

Prerequisites:

Autopilot is a conversational AI platform offered by Twilio to build, train, and deploy artificially intelligent chatbots, Conversational IVRs (voice-driven phone menus), and Alexa skills using natural language understanding and machine learning.

This blog contains a step-by-step tutorial to create your first virtual assistant with Twilio Autopilot.

1) You need to sign up for a Twilio account or sign into your existing account. You can sign up for a free Twilio trial account here.

2) Install Flask, you can install it using the following command:

pip install Flask

3) Install ngrok.

Once you have logged in to the Twilio, and if it’s your first time, you need to select few things including the programming language(select python), then it will take you to the Twilio console (i.e. dashboard), select the three dotted circle from your left hand as shown in the figure.

Now select the AutoPilot option from the menu as shown below.

Click on “Build a bot” option from the left panel as shown below.

1. 3 Tips for your Voice and Chatbot Program from Gartner’s Customer Service Hype Cycle 2020

2. Deploying Watson Assistant Web Chat in Salesforce Lightning Console

3. Are Chatbots Vulnerable? Best Practices to Ensure Chatbots Security

4. Your Path to AI — An IBM Developer Series

You will see some pre-trained templates on the screen, you can even use those templates to build your project if it fulfills your requirement Here we will create a bot from scratch, for that scroll down, and select the “start from scratch” option.

Provide name to the bot and select the “create bot “ option.

Once you have created a new bot, you will see the below like screen, which has some predefined task. We will create a new task, for that click on the “Add a task” buttons.

Provide the task name and then click on the “Add” button to create a new task.

Now we will add the training phrases, for that click on the “Train” option of the booking task, as shown in the figure.

Add the training phrases which the user can use to invoke the task, add minimum 8 to 10 sample data as shown in the figure.

Now unzip the package in some folder and run the following command in the terminal

Open new terminal and run the ngrok on port 5000

ngrok http 5000

Now copy the https url from the ngrok screen as shown below.

Go back to the Twilio, select the “program” option of the booking task as shown in the figure.

Now remove the default code and copy and paste the below code over there as shown in the figure.

{
"actions": [
{
"redirect": "https://ae54546f.ngrok.io/dynamicsay"
}
]
}

Where “https://ae54546f.ngrok.io” is the ngrok address, you need to paste the address which you get on your terminal with /dynamicsay.

Once you have changed the code, now “Save” it and then “build” the model.

You need to make change in the code file named “dynamicsay.json”, change the ngrok URL in that file with your ngrok address as shown below.

Stop the flask app and again run it using the following command

Now come back to the Twilio, and select the “Simulator” option from the left-hand side menu.

Initiate the conversation using “Hello” followed by the “booking”, bot will continue to ask you some questions.

1) Go to your Console Phone Numbers page.

2) Now buy or select the phone number you want to use for your Assistant, we already had a number, hence we have selected it. If you don’t have a number you can select on the “+” icon to buy a new number.

3) Once you click on the number, you will see the below like screen.

4) Now scroll down the page to the Messaging Section as shown below. In Messaging Configuration select Webhooks, TwiML Bins, Functions, Studio, or Proxy option, and fill the URL in the following format https://channels.autopilot.twilio.com/v1/<ACCOUNT_SID>/<ASSISTANT_SID>/twilio-messaging.

If you are not been able to find the URL see step 5 & 6, otherwise continue with step 7.

5) Go to your Autopilot bot, Select the “Channels” tab from the Assistant menu, From channels select the “Programmable SMS” option.

6) You will get the Messaging URL, copy that, and paste it in the URL section.

7) Once you have entered the Messaging URL, now SAVE the setting as shown below.

8) Now send the SMS from that number, you will get the response.

9) If you face this error “Permission to send an SMS has not been enabled for the region indicated by the ‘To’ number:” then please enable the relevant permissions on your account using the Messaging Geographic Permissions page.

10) If you face this erorr “ The ‘to’ phone number provided is not yet verified for this account.” then please add that number in the Verified caller IDs from this page.

First, we need to set up the sandbox:

1) Follow these step-by-step instructions for setting up your Sandbox of the WhatsApp console menu. When you click on the link you will see the below like screen. Save the number in your cell, and send the code as a whatsapp message on that number.

2) Once you send the code as a message in the whatsapp you will see “Message Received” on the screen.

3) Once configured, you can see all the configuration details in the Sandbox page of the WhatsApp menu. You’ll need these for the next set of steps.

Once you have successfully configured your Sandbox, you’ll need to connect it to your Autopilot Assistant.

1) Go to the Autopilot menu in the console and click into the Assistant you want to connect to WhatsApp.

2) Go to the Channels tab in the Assistant Menu and select WhatsApp.

3) Copy the URL displayed in the Configuration tab. This is the callback URL used to send incoming messages to your Assistant.

4) Go back to the Sandbox page in the WhatsApp console menu. Paste the callback URL where it says ‘When a message comes in’.

5) Now scroll down to the page and Save it.

Now that you have WhatsApp configured it’s time to test!

1) Open the WhatsApp app

2) Tap into the chat window with your WhatsApp bot

3) Send your first message, you should get a response from Autopilot, as shown below.

Feel free to comment your doubts/questions. We would be glad to help you.

If you are looking for Chatbot Development or Natural Language Processing services then do contact us or send your requirement at [email protected] We would be happy to offer our expert services.

Sours: https://chatbotslife.com/build-twilio-autopilot-chatbot-for-sms-and-whatsapp-using-python-4808dc9a90d8

Autopilot twilio

Twilio Autopilot Templates

Templates for creating Twilio Autopilot Bots, Actions, StyleSheets, and Functions.

About Twilio Autopilot

Twilio Autopilot is a conversational AI platform to build AI-powered bots that can be deployed across Phone IVRs, messaging channels such as SMS, Whatsapp, FB Messeger or Slack, or Smart assistants such as Alexa and Google Assistant.

You can find out more about Twilio Autopilot here:

Twilio Autopilot documentation

Twilio Autopilot website

Twilio Autopilot Quest mission (Hands on learning)

Templates

Templates provide samples for creating Twilio Autopilot Bots, Actions, StyleSheets, and Functions.

Bots

A bot is a conversational application designed to simulate conversation with human user using machine learning and natural language understanding.

Autopilot Assistants

Actions

Autopilot Actions instruct an Autopilot virtual assistant how to perform a given Task. The templates provide examples of different ways to use actions to implement tasks and craft different conversational experiences.

Twilio Autopilot Actions

StyleSheets

StyleSheets enable you to give your Assistant a style by specifying its voice, error messages, success messages, and data collection validation behavior.

The templates are the different personalities you can use for your virtual assistant or bot.

Autopilot StyleSheets

Functions

The Function Templates provide examples of backend implementations for Autopilot Tasks using Twilio Serverless Functions.

Autopilot Function Library

NOTE: Templates are sample code that is provided as is.

Sours: https://github.com/twilio/autopilot-templates
How to Use Twilio Functions with Twilio Autopilot

I even wanted to marry him. Marusya laughed, hugging my shoulders and looking into my eyes with a crazy look. And in the meantime, I pulled off the thug's boots and long gray socks like leggings. He pulled the breeches off Marusya on the floor. And she was left standing in ridiculous pink trousers with ruffles.

Now discussing:

He took a loud sip from a cup and naturally asked: Where is your tongue. Was there a command to stop licking me. " There was no threat in his tone. The threat was in the situation itself. I perfectly understood that having caused the displeasure of the man, I could well get a couple more blows.



656 657 658 659 660