Skip to main content

Facebook Messenger Send Api

Run in Postman

Please refer to send api objects in Facebook Messenger's documentation.

curl --include \
--request POST \
--header "Authorization: Token BOTANALYTICS_CHANNEL_TOKEN" \
--header "Content-Type: application/json"
--data "{
   'messages': [
      {
         'message': {
           
         }
      }
   ]
}" \
https://api.beta.botanalytics.co/v2/messages

Field Descriptions

  • messages (array): An array containing messages.
    • message (object): Represents an individual message.

Please note that the message object within messages array above has the Facebook Messenger's native send api format.

Example of single message payload in JSON format

{
  "messages": [
    {
      "message": {
         "messaging_type": "RESPONSE",
         "message": {
            "text": "Simple text message"
         },
         "recipient": {
            "id": "1968991829825082"
         }
      }
    }
  ]
}

Example of multiple messages payload in JSON format

{
  "messages": [
    {
      "message": {
        "messaging_type": "RESPONSE",
         "message": {
            "text": "Simple text message"
         },
         "recipient": {
            "id": "1968991829825082"
         }
      }
    },
    {
      "message": {
        "messaging_type": "RESPONSE",
        "message": {
           "text": "Simple text message",
           "quick_replies": [
               {
                  "content_type": "text",
                  "title": "Red",
                  "payload": "<POSTBACK_PAYLOAD>",
                  "image_url": "http://example.com/img/red.png"
               },
               {
                  "content_type": "text",
                  "title": "Green",
                  "payload": "<POSTBACK_PAYLOAD>",
                  "image_url": "http://example.com/img/green.png"
               }
           ]
         },
         "recipient": {
             "id": "1968991829825082"
         }
      }
    }
  ]
}