Using Response Paths in Flow XO

In Flow XO, every user of your bot on each platform has a unique response path. Like a phone number or email address, the response path is a unique identifier that you can use to contact that user whenever you need.

If you don’t already have a free Flow XO account, get yours now.

Say you want to build a bot that takes custom cake orders. With response paths, you can take an order and later send the customer a status update. In this tutorial, you’ll learn the most common use for response paths in Flow XO. You’ll also learn how to capture a response path in Google Sheets then access it later. Then, using the webhooks feature, you can notify your customer when you update the order status.

Basic Response Path

Every user of any of your bots has a response path. Flow XO automatically generates a response path ID for you. So, to create the initial response path, all you need to do is set up a regular flow.

For this example, you might have the customer start a cake order with the phrase, “Place an order”. When a customer triggers this flow, your bot will assign a unique ID as the response path. Now we can use that same ID to send a message to the user (or ask them a question) whenever we want.

Create a Flow

To generate a response path, first create a flow. Follow these steps to set up the trigger for your flow:

  1. On your Flows page, click + New Flow, then select Blank Flow.
  2. Click + to add a trigger. Select Bot → New Message and click Next.
  3. Under Words and Phrases, type “Place an order”. This is the text that will trigger the flow. Click Next.
  4. Give your trigger a clear name, like “Custom cake order”. In later actions, this will be how the response path is labelled:

Next, continue the flow with an action. Have your bot ask the user what type of cake they’d like:

  1. In your flow, add an action. Select Bot → Ask a Question, then click Next.
  2. The Response Path should match the name that you gave your trigger, in this case “Custom cake order”. Most of the time, Flow XO will choose the right response path for you. You’ll rarely need to change this field.
  3. For the Question Type, select Choice. Type your Question, and list your Choices. Your action should look something like this:

Add a few more actions to this flow. You might ask if the customer wants to write a message on the cake and when they would like to pick up their order.

You now have a flow with a continuous response path. When a customer triggers this flow, each action will happen on the same response path (back to the user who originally triggered the flow).

Test Your Bot and Check the Log

To see how the response path works, the next step is to test your bot.

  1. Turn on your flow and run your bot.
  2. Go to the Interactions page, which lists every interaction with your bot.
  3. Click Details to see the log for an interaction:

The log for an interaction will look something like this. Note that the Response Path has the same ID for the trigger and each action in the flow. Your bot uses this ID to identify the user:

This is the basic operation for response paths in Flow XO. As you’ll discover in the next part of this tutorial, response paths are an extremely useful tool for interacting with users.

Send a Status Update Message

After you receive a custom cake order, you’ll want to forward the customer’s input to an external application for order fulfillment. Then, when the order status changes, you can have your bot automatically notify the customer by triggering a flow with a webhook. To send this message, your bot will need to access the original response path.

Follow the steps below to set this up.

1. Set Up Google Sheets

To capture a response path, the first step is to create a spreadsheet in Google Sheets. You must create your spreadsheet before you can access it in a flow. If you’re new to Google Sheets, you might want to see our other tutorial, Using Google Sheets in Flow XO.

Give your spreadsheet an Order Number column and a Response Path column.

Now your spreadsheet can store the order number and response path for every order you receive through your bot.

2. Send the Order to an External Application

Next, you’ll need to send the customer input to an external application that will process the order. At the same time, you’ll need to get an order number from your application. Later, when you receive a status update via webhook, you’ll use the order number to tell your bot what to respond to.

There are numerous applications for order processing, so you’ll need to choose one and set it up to receive HTTP requests from Flow XO. While we can’t tell you how your external application will work, we can describe what to do in Flow XO:

  1. At the end of the flow you’ve started, click + to add an action. Select Webhook & HTTP → Make an HTTP Request.
  2. Connect your external application and Flow XO. You want your bot to send order details from Flow XO to the application. Then, the application should respond with the order number.

Finish and save the HTTP Request action. The next step is to store the order number and response path in Google Sheets.

3. Capture an Order Number and Response Path in Google Sheets

You can capture the order number and response path in the Google Sheets spreadsheet that you’ve already set up. To do this:

  1. At the end of the same flow, click + to add an action. Select Google Sheets → Add a Row. Then click Next.
  2. If you’ve authorized your Google account, select Choose a connected account. Otherwise you’ll need to Connect a New Account. Click Next when you’re ready for the next step.
  3. In the Settings window, select the Spreadsheet and Worksheet that you just created.
  4. The Order Number and Response Path fields correspond to the columns in your spreadsheet. In the Order Number field, capture the order number that you received from your external application. Type {{ and find the previous HTTP request action in the drop-down. Then select the order number output below that.
  5. In the Response Path field, capture the response path for the current interaction. Type {{ and select Response Path from the drop-down menu.

The Settings window should look something like this:

Click Next to finish and save the action. You’re done with the first flow. It should look similar to this:

Now, when a customer places an order, Flow XO will capture the order number and unique response path for the interaction. After an order is placed, your spreadsheet should look something like this:

Now that you have the order number and original response path, you can send status updates to your customer.

4. Create a New Flow to Send Status Updates

Next, create a new flow that will notify your customer when there is a status update. The flow should follow this sequence:

  1. Receive a status update via webhook.
  2. Get the response path from Google Sheets.
  3. Use the response path to send a message to your customer.

First, you need to send a webhook to Flow XO from your external application. For example:

https://flowxo.com/hooks/a/53ewaej7?ordernumber=12345&orderstatus=confirmed&pickup=20/07/2017

This webhook contains some information about the order. It tells us the order number (12345), the order status (confirmed) and the pick up date (20/07/2017).

To use this data, create a new flow with a webhook trigger:

  1. Click + to add a trigger. Select Webhook & HTTP → Receive a Webhook, then click Next.
  2. Paste the webhook URL into the external service that you’ll be sending your webhook from. Click Next to finish and save the trigger.
  3. Have your bot read the original response path that you captured in Google Sheets. To do this, click + to add an action. Select Google Sheets → Search Rows, then click Next.
  4. In the Settings window, have your bot take the order number from the webhook. Then it should find the matching value in the Order Number column. Here’s what this should look like:

Click Next to finish and save the action.

Finally, send a status update message along the original response path. To set up this action:

  1. In your flow, click + to add an action. Select Bot → Send a Message and click Next.
  2. In the Response Path field, tell your bot to look back to the Search Rows action (you’ll need to click the pencil icon to the right hand side of the response path field, this lets you use an output rather than select the response path from the trigger). Then use the response path from the row that it found.
  3. In the Message field, type your status update. Use the order status and pick up date from the webhook.

The Send a Message window should look like this:

Click Next to finish and save the action. The complete flow should look like this:

You should now have two flows. The first takes the customer order and stores the order number and original response path in Google Sheets. The second is triggered by a webhook, and sends a status update along the original response path.

Conclusion

In this tutorial, you learned how response paths work in Flow XO. Now you can store a response path, and later send a message to the same user along the same response path. Response paths are one of the many flexible tools for building user interactions in Flow XO.

Want to find out more? We have full documentation on Flow XO over at our Help Center, or get help & advice from other Flow XO users on the Community Site.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.