The bot builder allows you to make extensive API calls to any external system to fetch or push data and have it displayed as part of the bot conversation. What’s more, as Admins, you do not have to pass the parameters each time you trigger an API call from a dialog, instead, be able to reuse them from a previous or any other dialog, and also modify them quite easily by configuring all of them in the API Library.


A quick guide in creating a new API:

  • Login to your bot builder as an Admin/Owner

  • Select the bot you want to edit from the bot list page

  • Click on the ‘API Library’ icon from the right navigation bar

  • The '+ New API' button will allow you to configure a new API call

Configuring the API:

  • Name: Give your API call a suitable name.
  • URL/JS function name: Provide the Callback URL here. The content picker option [+] in this field will allow you to append values from the conversations to the callback URL. 
  • Method: Configure the type of API call you’re looking to make - GET, PUT, POST, DELETE, or a JS function and then pass the payload accordingly. For example, to create a ticket in your Freshdesk account, pass the email, priority, status, subject, and description in JSON. The [+] option will enable you to fetch values from the conversation.

  • Add Headers: You can authorize your APIs in this field, and also pass any additional parameters as headers in this section.

  • Test: To make sure the API call has been configured correctly, you can perform a sample test run, pass test values for the dynamic fields you have configured in the payload (for PUT, POST, and JSON methods) and verify the response headers.

  • Add the required response parameters: Attributes from the response headers can be referenced in any dialog in the chatbot conversation.
    For example, if you want to display the ticket ID once it's created, the ID field from the headers can be added to this field and be used in the consequent dialogs.

    If an array of elements are needed, square brackets should be appended to that field, for the below example: data[].id, data[].name

    For a particular element in an array, using the index number will display the corresponding value in that field: data[1].id will display the second value in the field, from the above example: 60002

API list page:

From the API library list page, you can search for the APIs you’ve configured using its name. The listed APIs will tell you the type of action the API has been set up to perform - GET or POST etc, show when the API was created and when it was last modified. Clicking the ‘more’ icon against an API will allow you to edit or delete it.

A quick guide to using the APIs:

  • Login to your bot account as an Admin/Owner
  • You can add an API's response under 'Message or Question' or 'Actions' or the 'Conditions' tab based on your use-case
    • Under Message or Question: Type out the message or question to be displayed to the customer in the text box and click on the content picker icon [+], and choose 'APIs'. You'll see the list of all the APIs configured under the API library for that bot. Choose the required API to append it to the text box.

      For example: If you are creating a ticket for the bot conversation, you can set up a 'create ticket' API call and reference the ticket ID from the response parameters.

    • Under Actions: Set the 'Action type' to 'Trigger API' and then go on to select the required API from the list of all the APIs configured under the API library of that bot. If your API trigger is not dependent on the customer's input, you can choose the Before Dialog in the Execution dropdown. If it is dependent on the customer's input, pick After Dialog in the Execution dropdown. 

      If you want to trigger the API before the dialog loads without getting the customer's input, pick 

      For example: If you are configuring an API response to get a URL of a page, you can reference that API under actions so the customer can access the URL from the bot.

    • Under Conditions: Go to the 'Conditions' tab for the required dialog in the bot flow and click on the content picker [+] icon, and choose 'APIs' from the drop-down. You will be able to see the list of all the APIs configured under the API library for that bot. Select the required API call and then proceed to choose the response value. The API's response can be used both in the body of the condition and in the condition's value section.

      For example: In the case of a simple subscription flow, you can get the 'status' of the payment from the API response and redirect customers to a different dialog/flow if the status is unpaid or set up a dialog to display a simple message to the customers if the status is paid.
Note: API requests will time out after 10 seconds if a response is not received.