The Make an API call step allows you to configure an API call out to another system, such as an internal CRM or ERP, or to push conversation details to an external endpoint, like Amazon Event Bridge or Google Analytics.
In this article, we’ll walk you through the procedures involved in including and configuring the step in a bot flow.
For an overview of the Make an API call step and its configuration rules, see Understanding bot step types: Make an API call.
This article includes the following sections:
Adding a Make an API call step to your bot
Adding the Make an API call step to your bot includes a number of distinct tasks.
The procedures below assume you have already created a bot flow, and are adding this step to that bot.
To add a Make an API call step
- Open the bot in Flow Builder.
- Click the Add new icon where you want to insert the step, either at the end of a branch, or between two existing steps.
- In the Configuration panel, click Make an API call.
- Enter descriptive information for the step. Note that this is only visible to your team – customers will not see the information entered here:
- Name: A name for the call that makes it easy for your team to identify.
- Description (optional): A short description of the action taken by the call.
- Continue with the procedure described in Adding API details, below.
Adding API details
Use the API details section to configure the HTTP call you want to make, including the HTTP request method, location of the external resource, and adding headers if needed. The steps below are a continuation of the procedure in the previous section.
To add the API details
- In the Configuration panel, click API details.
- Use the dropdown to select a Request method:
- GET retrieves data from a server at the external resource. This is the most commonly used method.
- POST sends data to create or update a resource at an external site. If the resource already exists, the data sent modifies the resource.
- PUT sends data to update or create a resource. If the resource already exists, the data sent replaces the resource.
- PATCH sends data to update a resource at an external site. It is used to apply partial modifications to the resource.
- DELETE removes the resource at the external location.
- Enter an Endpoint URL. The endpoint URL is the location of the external resource you are connecting to. The endpoint URL supports both Http:// and Https://
- If needed, enter the key and value for an optional header.
- To make the call, click the Make Test API Call button. Please note this creates a real request to the configured end-point and any saved variables.
Saving the API response as a variable
A variable is a way to store API responses. For example, you can save a customer's name as a variable and refer to it in a bot message. Saved variables can be used anywhere in the flow after the Make an API call step in which the variable was created, in any step that includes a configurable message:
If a variable becomes invalid (if the API schema is changed, for example) the bot will skip the variable when displayed to the end user. You can add up to eight variables per step.
After configuring the API details and testing the API call, you can use the returned Response data to create your variables. The steps below are a continuation of the procedure in the previous section.
To create a variable to save data from external system
- In the Configuration panel, click Make API call.
- Expand the accordion and identify the data from external system that you want to turn into a variable.
Tip: Switch to the Response body tab to view the raw response that has came back from the external system.
- Click Save.
- Give the new variable a name. Variable names must only include lowercase letters, numbers, and underscores.
About the step branches
The Make an API call step is a branching step. Adding this step splits the bot responses depending on whether API was successfully executed
At bot run time, any 200 response codes will have the bot moving down the successful branch. All 400,500 response codes will have the bot moving down the failed branch. Please note that if the API returned 200 with an empty response, any variables saved from this step will be skipped at run_time.
12 Comments
This is awesome Aimee Spanier! Will it be possible to request information from the user in order to use their input as parameters in API request (e.g. validate email address on external CRM)?
Yes Pedro Rodrigues - this is on the roadmap to be delivered in the next few months.
Awesome, thanks for the follow up!
This is great. Can we use this to get info from our own ZD instance? I would love to get messaging ticket count and display that to customers. This would help set wait time expectations since we can't do that natively. I tried but keep getting unauthorized 401 errors. I also tried setting the user and pwd - key and value.
Hi @Jason , at the moment it is not possible to collect this information, as we were not able to use the parameters of the other requests to use in the new request.
Follow the example images
I saved the userid as a variable, and I can't use this variable in another API call like this.

And for your 401 error, you need to create a global token or use a Base64 token with your username and password, and you need to enable that within Zendesk.
You can follow this instruction https://developer.zendesk.com/api-reference/ticketing/introduction/#security-and-authentication
Hey there! I am currently working on including an external API into our bot. I am trying to do a POST request, but having troubles with the request body.
The format that I enter for the request body is normal JSON, like for example
{"test": "hello"}
Now the problem I encounter is that the external API that I use is returning that the request is invalid. When sending the exactly same request manually (for example through a browser console) the request is being processed correctly.
So my question is, do I have to format the JSON body in any specific way for Zendesk to correctly forward the request to the external API?
I have checked the Integration logs and it appears that the request body is being sent to the Zendesk servers as a string. Is it possible that when parsing the JSON string later into JSON some error occurs on your side?
The above seems like what is happening here to me, because when I checked the logs of one of our APIs that I tried to call using the tool, the request body contains not the actual JSON, but a stringified version of the JSON (with escaped quotation marks).
Any thoughts?
Can you provide us a code snippet of the request so we can take a look?
Thanks!
How can I do API Call with database json And redirect to a específic group?
Eric Nelson
Sorry for the late response, but let me give you an example. In this example I am calling an API hosted on AWS, I will share the request logs to demonstrate the problem.
Let's start with the Zendesk request. This is what I put in Zendesk (Note that I added all implicitly required headers, they are just not in the screenshot and they are not relevant for the problem)
The above request leads to this being logged in our API:
You can see that the quotes are double escaped. Also I am not exactly sure where that \n at the end is coming from, I don't think I have entered a new line, but it's probably not relevant anyway.
Now when I send a request using Javascript directly the outcome is different. A request example:
This yields the following logs:
Here it just logs the JSON as a string, the way it was sent. This is also what is expected and correct.
So my question would be, am I using the API call in the flow builer wrong and the JSON should be entered in a different format? Or is there a problem in the software that breaks the JSON when sending the HTTP requests?
Please let me know if you have any other questions about the example I provided.
Hi there,
How can we pass variables stored in the chat to an API request URL?
For example, is it possible to store the customer question as a variable to pass as a param in the URL?
Thank you in advance
Unfortunately there currently is a bug where we stored variables are not translated when used in text.
This is quite detrimental to the end user experience.
Hi Zendesk team,
Can you add the info:
- how to make API calls to the Zendesk instance to :
1- get info
2- do updates on the ticket?
- what should we put as key and value to be able to connect to our proper Zendesk Instance?
Thank you
Please sign in to leave a comment.