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:
Omnichannel message - the flow receives a message from an end-user on one of MessageBird's channel offerings
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"
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.
Navigate to your flow in Flow Builder
Underneath the Wait for a response step, add the Fetch variables step by dragging and dropping from the menu on the left
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
Use the Method drop-down menu to select the GET method
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
Click Save to save the step settings
The POST method
To use the POST method, follow these steps:
Use the Method drop-down menu to select the POST method
Toggle the button in the Body field to on
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:
Use the Set Content-Type header drop-down-menu to select application/json
If your system needs to use an authentication method, fill in the Add Header section as required
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
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