The Send API is the main API used to send messages to users, including text, attachments, templates, sender actions, and more.
Create and send messages to your customers or people interested in your Facebook Page.
You will need:
MESSAGE
task on the Pagepages_messaging
permissionNote that the Send API does not include recipient_id
in the response for messages sent using recipient.user_ref
or recipient.phone_number
to identify the message recipient.
To send a message to a person, send a POST
request to the /PAGE-ID/messsages
endpoint with the messaging_type
and recipient
parameters set, and the message content.
The following example is a response to a person's message where the message your Page is sending is text only.
curl -X POST "https://graph.facebook.com/v21.0
/{PAGE_ID}/messages" \
-d "recipient={'id':'{PSID}'}" \
-d "messaging_type=RESPONSE" \
-d "message={'text':'hello, world'}" \
-d "access_token={PAGE_ACCESS_TOKEN}"
On success, your app will receive the following JSON response:
{ "recipient_id": "PAGE-SCOPED-ID", "message_id": "AG5Hz2U..." }
Parameter | Description |
---|---|
| The type of message your Page is sending. Either
|
Required | The type of message being sent
|
| Type of push notification a person will receive
|
Required | The person who will receive the message your Page is sending
|
| The action icon shown in the messaging window representing the action taken by the Page on a message the Page has received from a person.
Can only be sent with the |
| A tag that enables your Page to send a message to a person outsde the standard 24 hour messaging window.
|
The following table lists the types of messaging for each message tag.
Message Tag | Usage |
---|---|
| Allowed Usages
Disallowed Usages (non-exhaustive)
Not available for Instagram Messaging API. |
| Allowed Usages
Disallowed Usages (non-exhaustive)
Not available for Instagram Messaging API. |
| Allowed Usages
Disallowed Usages (non-exhaustive)
Not available for Instagram Messaging API. |
| Allowed Usages
Disallowed Usages (non-exhaustive)
Required for Instagram Messaging API. |
| Allowed Usages
Disallowed Usages (non-exhaustive)
Not available for Instagram Messaging API. |
You can't perform this operation on this endpoint.
To get information about conversations your Page are a part of visit the Page Conversations Reference.
You can't perform this operation on this endpoint.
You can't perform this operation on this endpoint.