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:

  1. Save user attributes to your CRM sheets or database.

  2. Send notifications to your system.

  3. Act for the user, such as place an order for them.

  4. 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:

  1. The maximum number of characters for a JSON API request is 500 characters.

  2. The maximum size for a JSON API response is: 4 MB

  3. 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:

  1. Set a value for an attribute

  2. Send a customized Facebook message.

  3. Go to a specific flow.

  4. Do nothing at all

You can also customize this by setting a body for API response or creating a callback request.

Did this answer your question?