Here, you will find a basic introduction to the JSON API. For the more technical, in-depth details and tutorials, you can check out this article.
What is JSON API?
JSON API allows you to send data from your bot over an HTTP request. You can use it to easily:
Save user attributes to your CRM sheets or database.
Send notifications to your system.
Act for the user, such as place an order for them.
Automate actions in your system according to the user’s behavior.
You can easily set up a JSON API request through its dedicated button in any flow.
Before we dig deeper into the JSON API, below are some crucial definitions you’ll need to understand in advance fully. (If you’re a programmer, you probably already know this.):
API: ِAn API, put, is how two applications or softwares communicate together.
User attribute: A piece of information you want to save about your user—for example, their first name. Learn more about attributes.
Endpoint: The URL that your API will use to communicate the request.
Header: Extra information about the request. A header has a key and a value, where the key is its name, and the value is its content.
Body: The content that is inside the Post/Put request, which is in JSON format.
API response: The API’s response to the request. It could be data or just a confirmation that the request was received.
Callback request: Used when there is no response or the response would take longer than the time out. This could optionally be using a new URL and token that can be considered a new request as a response.
Fallback: This is what you set up when the request has completely failed.
How can you use JSON API?
You can use the JSON API integration in one of the four methods in the table below. The table will also tell you how much you can customize the request in each method.
Using any of the methods above will send a request to your API with the values you set, and your API will automatically handle the rest. However, please note that:
The maximum number of characters for a JSON API request is 500 characters.
The maximum size for a JSON API response is: 4 MB
Your request will time out if there is no response after 10 seconds.
After the API is done with your request, you can set your bot up to follow up with any of the below actions:
Set a value for an attribute
Send a customized Facebook message.
Go to a specific flow.
Do nothing at all
You can also customize this by setting a body for API response or creating a callback request.