A Simple Example
The purpose of this example is purely to give you a feeling for what it takes to build out flows in Flow XO.
The video below explains the process:
If you would rather read the instructions, continue below:
Even for simple bots, it's a great idea to diagram out the structure of your flows before you begin. Here's the diagram of our simplistic friend Simple Bot:
From the flowchart, we can see that this flow will be composed of a trigger and three actions. We'll be using a New Message trigger, which allows us to respond to simple keywords or keyword phrases, an Ask a Question task which allows us to send the user a message with some pre-defined options and wait for a response, and two Send a Message actions, which simply sends the user a message.
This bot is so simple we can easily fit it into one flow. This flow will have the following components:
- A 'New Message' Trigger
All flows start with a trigger. In this case, we want the bot to present this menu whenever a user launches it for the first time (thus 'start' and '/start') or types in 'menu'
- An 'Ask a Question' Task
The first thing the bot will do is present its menu, which is just the specific phrases it knows how to respond to.
- Two 'Send a Message' tasks
We will add two 'Send a message' tasks to represent the different branches of the flowchart. One of the tasks will have a filter that matches the first menu option, and the other tasks will have a filter that matches the second menu options.
Let's get started.
If you want to install this flow into your account to examine it, rather than building it from scratch, you can click here.
1. Create a new flow from the home page by clicking on 'New'
2. Choose 'Flow' (You can also create a new flow from the 'Flows' tab).
1. Click on 'Blank Flow'. We're building this flow from scratch. We don't need no stinking template.
1. Next we'll need to select a trigger type. From our design work, we already know we need a New Message trigger.
Next we'll be asked if we want to limit our trigger to a specific bot, or have the trigger listen to All Bots. For our purposes, we can just go with the default of 'Connect to all bots'
1. We need to fill in the trigger phrases that will activate this flow. From our design, we know we want to respond to 'start' or '/start' or 'menu'. Type these phrases, one per line, into the Words or Phrases box.
2. Click next
It's generally a good idea to give your flow a descriptive name right away, so you don't forget. As you build more and more flows, you really don't want to be digging through a dozen 'Untitled Flow's looking for the one you want.
1. Now, we need to add our actions to build our flow according to our flowchart. First up is to create an Ask a Question task that will ask the user how they are feeling about building a chatbot. To do that, click on the blue plus at the bottom of your flow.2. Choose 'Ask a Question'
3. Enter the text for the question
4. Add the two choices. We will set both a label and a value for our choice, to make our filter simpler later on.
5. Click Next
6. Click Save
Now that we have the users answer to our question, we need to provide one of two responses, depending on the answer. Since we will not be expecting a response to the next message we send, we will use Send a Message rather than Ask a Question.
1. Click + to add a new task, then choose 'Send a Message'
2. Enter the text of the message
3. Click 'Next'
Now, before we finish adding the Send Message, we need to add a filter. This is because this message should only be displayed if the user chose answer number 1 as a response to our Ask a Question.
1. Click 'Add a Filter'
2. Click the Flow XO logo to access a dropdown menu of variables.
3. Find the 'Present Menu' task, and choose 'Answer'.
4. In the 'Value' text box, enter the value of the first choice, which we configured to be the number 1
When using filters, 'Answer' will refer to the 'Value' of a choice and 'Choice' will refer to the label. Usually, you will want to filter on 'Answer' and match the choice 'Value'. 'Choice' can be useful if you want to refer to the label of a users selection when composing a message.
5. Click 'Save'
Now we will do the same thing for the next message, which the bot should send when a user chooses option # 2:
That's it! Our flow is finished. We have a New Message trigger that will listen for the keyword 'menu', or will launch whenever a user first installs or interacts with our bot.
We used an Ask a Question task to ask the user a question, and provided two canned answers.
Based on the response to our question, we branched our flow to send a customized messaged based on the users response.
Finally, we will need to test our flow in the Test Console. Click the 'Chat Bubble' icon at the bottom of the screen.
Also, don't forget to enable your Flow before testing:
All Done! You've just built your first Flow XO flow in just a couple of minutes. If you run into trouble, let us know at email@example.com, we're always happy to help!