API Call
  • 16 May 2024
  • 1 Minute to read
  • PDF

API Call

  • PDF

Article summary

We developed the Call API skill to help you quickly call an API within your flow. You can then save and use the responses received from the external API in your chatbot's code and flows.

Figure: Call API

Request Options

Calling an API involves making an HTTP request from Digital Agent to a named host on a server. The request aims to access a resource on the server. The following are the components of your request through which you will supply information to an API.

Body

The request body is set in the interface below. Please ensure that your request body adheres to the syntax specified for the API you are calling.

Figure: Request body

Headers

The request headers can be set here and should respect the JSON format.

Figure: Request Header

Response

All APIs respond to every request with an HTTP status indicating whether the request was successful. The response typically comes along with a json response which may contain additional information. The Call API skill supports receipt and storage of this response in the following manner.

Memory

We use memory to save the response given by the API we are calling. By default, Digital Agent will save the response in temp.response, but you can use the memory of your choice according to the use-case.

Figure: Memory

The saved response object looks like this:

{
  "body": <Response Body>,
  "status"200
}

Success / Failure

When a response returns a status code 400 and above, the request will fail and will execute the On failure transition. All other status codes will result in success and will execute the On success transition.

Templating

Digital Agent supports templating in the body and the headers to access variables stored in memory. All bot, user, session, temp, and event memory types are accessible via templating.

Figure: Templating


Was this article helpful?

What's Next
Changing your password will log you out immediately. Use the new password to log back in.
First name must have atleast 2 characters. Numbers and special characters are not allowed.
Last name must have atleast 1 characters. Numbers and special characters are not allowed.
Enter a valid email
Enter a valid password
Your profile has been successfully updated.