A chatbot API ( Application Programming Interface) is essentially a bridge that facilitates communication between two applications, or a computing interface that allows information sharing between different software components.
The use of API can help deliver your message to the application you’re accessing and send the response back to you. Developers can use a chatbot API to build an even smarter chatbot with the ability to take in the request, extract the intent of the message, and deliver the response.
When you do chatbot API integration, it allows the expansion of the system functionalities. It also lets you leverage the interfaces that define the kind of requests you want to make, how to make, and the type of data formats to be used.
Step – 1
There are two types of requests you can add for the API in chatbot module.
You can choose GET/POST type from the method dropdown list.
Step – 2 Then, you have to insert an API URL in the API Endpoint field. After that, you can add one or more headers.
Suppose, you want to add a username as a request header, then it will look like this.
If your method type is GET, then you can also add one or more parameters for calling your API based on your necessity.
Suppose, you want to pass name & email using parameters, then it will look like this.
Or, If your method type is POST, then you can use the body for passing the value to the API endpoint.
Here, you can pass values in two ways. You can pass the body as X-WWW-Form. Using this form, you can send one or more key-value pairs like this.
Or you can send the body as a json.
Using these fields, you can make request for the API endpoint. Then, your API will return a response based on your request.
Step – 3
Now, you can jump to another node based on your response. For doing this, you can use add a condition which looks like this:
Let suppose, your response has a field named ‘status’ and this attribute may have different values. For this instance, when you get a successful response that is notified by the status attribute and its field-value is ‘success’, then you will jump to a node, otherwise, you will jump to another node.
Here the value of status is success which is a string.
Or, you can show some values from the response. For doing this, you can use the Add Response field like this.
For example:
The response is a nested json looks like this:
Then you can show the value of ‘d2’ by this:
The response may be an array of json object.
If you want to show the name & result of them at college level, the response rule will look like this: