Fetching variable steps in Flow Builder

In this guide, you'll learn how to use the fetch variable step in Flow Builder. Watch the video below for a quick overview, then head to step one for detailed step-by-step instructions.

Step one: Get set up

Before you start to use the fetch variable step, you'll need to choose a flow to use the step in. For this guide, we'll be working with a basic flow that end-users can communicate with to check the status of their ticket. The flow looks like this:

  1. Omnichannel message - the flow receives a message from an end-user on one of MessageBird's channel offerings

  2. Reply to channel message - the flow sends the following automatic message response "Welcome to MessageBird! In order to check the status of your ticket, please reply with your ticketID"

  3. Wait for a response - the flow will wait for the end-user to respond with their ticket ID

Step two: Use the fetch variables step

Once you have your flow set up, it's time to add the fetch variables step.

  1. Navigate to your flow in Flow Builder

  2. Underneath the Wait for a response step, add the Fetch variables step by dragging and dropping from the menu on the left

  3. Open the step settings and navigate to the URL field. Enter the URL of the system from which you want to fetch the variable

The GET method

Now, you can choose to use the GET method as follows, or skip ahead to use the POST method

    1. Use the Method drop-down menu to select the GET method

    2. In the Variables field, click Add a variable and enter a variable name in the text field that appears, ensuring that it matches the keys on the JSON object in the response

    3. Click Save to save the step settings

The POST method

To use the POST method, follow these steps:

  1. Use the Method drop-down menu to select the POST method

  2. Toggle the button in the Body field to on

  3. In the Body field, we're going to use the JSON format to fetch the ticket ID variable. Format it as follows. The bold text is the ticketID variable that the user returned, dragged and dropped from the Available variables section:

    {"ticket":"ticketID"}
  4. Use the Set Content-Type header drop-down-menu to select application/json

  5. If your system needs to use an authentication method, fill in the Add Header section as required

  6. In the Variables field, click Add a variable and enter a variable name in the text field that appears. For this guide, we used ticketStatus

  7. Click Save to save the step settings

HTTP Request step

Sometimes, you don't need to fetch variables, but you do need to push information. To do this, you can use the HTTP request step in exactly the same way as you use the POST method in the fetch variables step.

Last updated