Zendesk Flow Builder API Call
Zendesk announced the ability to add an API call step to their Messaging Flow Builder. This allows you to get external data and show it your users. So what's possible? Let's build a quick mockup and find out!

Zendesk announced the ability to add an API call step to their Messaging Flow Builder. This allows you to get external data and show it your users. So what's possible? Let's build a quick mockup and find out!
Zendesk just announced the ability to add an API call step to their Flow Builder. This allows you to get, post, update or delete data on a remote server or API as a step in the Bot flow.
As usual, their documentation is very clear, but lacks some real world examples or detailed steps.
Concept
We have a Support widget on our website. We notice that customers often contact us with questions regarding the status of our systems.
So instead of pointing them to an external status page, we'll let the bot get the current system status, and hopefully return an "All good, we're online". Or if not, we let them know we're offline with a link to more information.
Setup
For this example we'll use GitHub Status API. It has a Summary endpoint we can use to retrieve the current status of GitHub:
Endpoint
GET curl https://www.githubstatus.com/api/v2/status.json
Response
{
"page":{
"id":"kctbh9vrtdwd",
"name":"GitHub",
"url":"https://www.githubstatus.com",
"updated_at": "2022-05-30T10:27:36Z"
},
"status": {
"description": "Partial System Outage",
"indicator": "major"
}
}
So how do we set this up?
First we go to our Flow Builder setup and setup some boilerplate.We've created a Bot flow that basically asks the customer if they need to know the current status, or need help.

Make an API call
Next we add a step underneath the "Are all your systems online?" question, and choose an API step.
Enter the following and press Make API Call
- Subject: Get System Status
- Description: This retrieves the status of the GitHub systems.
- Request Method: GET
- Endpoint URL: https://www.githubstatus.com/api/v2/status.json


If all goes well the system returns a valid response and a list of variables returned.
For our example, we're only interested in the status > description value. Go to this entry via the dropdown and click Save. Choose system_status as the variable name.


We've now:
- Retrieved the current status from GitHub
- Saved the status description as a variable for later reuse.
Each time your customers open the widget and select "Get System Status", the Bot will pull in the current status and save it for reuse.
Showing the status
What's left is showing that status to the customer.
- Under the Success option select the "[This will be the API step]" message and edit the text to say "Our current status is: "
- Click the "Select Variable" button and choose the recently created system_status option.
- The text should now say "Our current status is: {{system_status}}"
- Similarly, under the Fail option, add a text block that handles the scenario where we can't retrieve the status.



The result
You can test out the flow by going to support.internalnote.com.


Improvements we'd like to see
- The ability to retrieve an array, and use those as values in an options list.Example: list items in a customers' order, and have them select the item before going forward
- Ask for the name of the currently JWT authenticated user and use that to personalise replies
Ask For Details
This article was written before Zendesk enabled Ask for Details in Flow Builder. See this other article if you want to find out about more complex API calls

Comments ()