JSON API for Messenger

JSON API is an advanced component providing powerful flexibility and functionality. With JSON API, you can connect your bot to a backend service, completing a highly flexible responses.

You can make many kinds of HTTP requests for your bot to analyze your backend and make the appropriate responses.

To be specific, you can run:

  1. Create dynamic messages

  2. Execute “postbacks”

  3. Obtain and set up user arguments (coming soon)

  4. Redirecting to other messages (coming soon)

Response reference:

We will parse the JSON response and send a message to the customer based on the response. For more information, please visit https://developers.facebook.com/docs/messenger-platform/reference/send-api/

Sending Text

The response below will be sent as text messages.

{
  "messages": [
    { "text": "Welcome to the smartest bot building tool ever —— YOCTOL.AI" },
    { "text": "what kind of bot do you want  to build?" }
  ]
}

Sending Image

Image formats of JPG, PNG and GIF are supported as messages from JSON requests.

You can also send out messages of Facebook pictures so you won’t need to upload the image again.

Sending Video

The following response is an example of using a video as message. Currently, Messenger only supports MP4 files with size less than 25MB.

You can also use existing Facebook video posts as messages!

Sending Voice Memos

The following response will send a voice memo file. Currently, Messenger only supports memo files under 25MB of size with extensions of MP3, OCG, and WAV.

Sending Files

The following response will prompt a file as message. Messenger at the moment only supports files under 25MB with no restricted file type.

Sending Carousels

The following response will create a carousel message. Please note that every element of the carousel includes an image, a description, and a button.

Sending List Templates

The following response will return a list template message. For more information, visit https://developers.facebook.com/docs/messenger-platform/send-messages/template/list/

Sending Buttons

The following response will send a button template. You can manually set up the actions for each button, for example prompting to another website. For more usages of buttons, visit https://developers.facebook.com/docs/messenger-platform/send-messages/buttons

You can also send special buttons for actions, such as dialing a number.

Sending Quick Reply

The following response provides a text with quick reply buttons.

Last updated

Was this helpful?