Echo Dot (3rd Gen) - Smart speaker with Alexa - Charcoal

Use your voice to play a song, artist, or genre through Amazon Music, Apple Music, Spotify, Pandora, and others. With compatible Echo devices in different rooms, you can fill your whole home with music.

Buy Now

Wireless Rechargeable Battery Powered WiFi Camera.

Wireless Rechargeable Battery Powered WiFi Camera is home security camera system lets you listen in and talk back through the built in speaker and microphone that work directly through your iPhone or Android Mic.

Buy Now

Creating an SMS Bot with Flow XO

0
412


I recently took on some freelance web developer work and my recent client asked me to build an SMS bot. Considering my current abilities, I was somewhat intimidated by this request. However, they wanted me to use a platform called Flow XO to build the bot which would make the process a lot simpler than expected.

In this article I’m going to explain the basics of how to setup Flow XO and how to get started with building your first SMS bot.

Flow XO is a platform that allows you to build, host, and manage chatbots for messaging platforms, such as Messenger, Slack and Telegram. This complete platform provides “flows” which are scripts for your hosted bot to run and use for interacting with consumers. Flow XO has done a pretty good job of abstracting away the code needed to build the “flows” and provided a friendly user interface for creating your custom scripts.

Getting Setup with Twilio

For this article I’m going to be using Twilio to provide the phone number for our SMS bot. You can use any other service that works best for you but Twilio does allow you to purchase a phone number for free. The only catch is that if you want to interact with your bot through a smartphone, you do have to put in credit card information.

If you don’t already have a Twilio account, head over to their site (I provided a hyperlink in the paragraph above) and signup. Once signed, go to the dashboard and navigate to All Twilio Products > Numbers section, and click on Phone Numbers. Click Buy a Number and make sure to tick the SMS capability, then hit search.

Find the number that works best and buy the number. You will then need to head back to Flow XO and setup your bot.

Attach Twilio Account to Flow XO Bot

Now we need to setup your bot which will handle the “flows” you create later. For it to be an SMS bot we need to attach your new Twilio number to the bot itself. Head over to the bot tab on your Flow XO account and select the Twilio SMS platform. Give your bot a name and add some welcome text if you want, it’s optional.

To continue, you’ll need to go back to your Twilio dashboard and find the necessary info to connect it.

Copy the Account SID and Auth Token from the Account Summary section in Twilio into the same fields in Flow XO. With those submitted, head to the List Phone Numbers button and select the phone number you purchased with Twilio. Click save and your bot is now setup to receive messages.

Flows are the main feature of Flow XO and it’s where you get the opportunity to either use pre-built flows or create custom flows that your bot will utilize for interactions. Let me just say now that there are a lot of different way to create flows and I’m going to be focused on a basic example that just touches on some of the main features. I highly suggest playing around with pre-built flows to see how they can be configured.

Let’s get started!

Triggering a Flow

The main idea behind creating a bot is to basically have a dedicated individual (our bot) that can handle certain requests for our user and also collect data about that specific user for future use. We use flows to create a script that our bot will follow based on the users interactions. To get this script running we need to first create a trigger.

On your flows tab in Flow XO, you’ll see a new button at the top right which will pop up the above image. Here are some of the pre-built flows that I mentioned earlier. These can help you get an idea of what Flow XO is capable of and once fully comfortable, you can build custom flows with complex functionality. For my example I’ll show you a very basic custom flow.

When selecting a trigger for you custom flow, you most likely will go with something like “New Message” or “Catch-all”. These triggers when executed by the user, will help start your custom flow and allow your user to interact with the bot. Let’s set our trigger.

We’re going to use the “New Message” trigger so that when a user wants to join our service they send any of these key words to our Twilio number and it will start the interaction. We can save this trigger and then we’ll be redirected to our entire flow.

This is the flows interface it lets us see what we expect from the user and also what our bots responses will be.

Asking Questions

Now that our flow is triggered we need to ask our user some questions so we can collect their info and get an idea of what exactly they want.

Above you can see that we used the “Ask a Question” action which lets us prompt the user with a question. These actions are very useful because their response will now be saved within the interaction and can then be used within the flow. We’ll see an example of this with the next action.

When creating flows, we sometimes want to retrieve data from the user that can then be reused within the same flow. Such as getting their name and then using their name in the next message. Flow XO allows us to use variables that can represent this data. Within the Question input for this action you will see the Flow Xo logo at the far right. When clicked you will see a bunch of options for values and if you scroll far enough you’ll see a section specifically for the previous question you asked. There you can select the users answer and interpolate it into your text. The variable is represented with Flow XO’s syntax {{ask_a_question.parsed_answer}}.

Filters

Let’s talk about another important feature in Flow XO. Filters are basically conditional logic that allows us to create more complex functionality. It can be very helpful in making sure our user doesn’t abuse the bot or accidentally respond with incorrect info.

In the previous question we built, we used the users response to show their name in the message. We can add a filter to that action which will make sure that the value we want is actually present. By adding this filter you are making sure that the user enters their name or any value that they wish to respond with. There are more options with this feature but you can already see how powerful it is for customizing your flows logic.

The flow we just built is very simple and there are countless ways we could customize it to achieve what we want, but I’ll let you take the time to play around with different flows you are interested.

I’m also going to quickly go over some additional features that I think could be beneficial to know.

Google Sheets

Naturally, we want to collect data from our users and if you were using this SMS bot for a subscription service you could easily get data from our user using the bot. Well Flow XO allows you to connect a pre-made Google Spreadsheet which then allows your bot to add rows of data for you. This automation can greatly improve your overall service and can reduce the amount of work you need to do.

Webhooks & HTTP

Flow XO also allows you to make requests to external API’s which can serve similar functionality as our Google Sheets. This can be useful for bots that might live on your website and can have access to more functionality that is provided by your API.

Test Console

If during this article you were wondering, how do I test this? Then here is your answer. Flow XO provides a Test Console bot which can run directly next to your flow.

You can see on the far right that you’re provided with a window to interact with your flow in real-time. In my opinion, this feature is crucial the testing/debugging your flows. It makes the process of building a bot significantly more enjoyable and makes updating it much quicker.

Creating a bot can honestly be a lot of fun. Flow XO has made this an enjoyable experience and I would definitely recommend this platform for someone who has never built one before. Along with the interactive UI, Flow XO also provides quite a bit of documentation to help you figure out how to build more complex flows. They also provide good customer support for issues that can’t be solved by the documentation.

So if you’re looking for a quick, reliable way to build yourself a bot, give Flow XO a try and I’m pretty sure you won’t be disappointed.

Happy Coding!



Read More

LEAVE A REPLY

Please enter your comment!
Please enter your name here