Last updated: 2021-11-15
Setting up your API Library in the Assist bot
The Assist bot's builder allows you to make extensive API calls to any external/internal 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.
Every single API call that needs to be made from a dialog can be configured in the API library and can be invoked by choosing the ' Trigger API' option from the Actions tab for the required dialog.
A quick guide to creating a new API:


Configuring the API:



For example, if you want to display the status ID of an order, 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:
- Under Message or Question: Type out the message or question to be displayed to the agents 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 fetching the order status, you can set up an API call to connect to your order management system and reference the order status 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.
For example: If you are configuring an API response to get the URL of a page, you can reference that API under actions so the agents 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 agents to a different dialog/flow if the status is unpaid or set up a dialog to display a simple message to the agents if the status is paid so they can communicate the same to the customers.