Send Instagram messages with product information that you have uploaded to the your product catalog using the product template. Product details (image, title, price) will automatically be pulled from the product catalog. You can create messages that have one product or a horizontally scrollable carousel of products using the product template. |
This guide assumes you have read the Messenger Platform Overview and implemented the needed components for sending and receiving messages and notifications.
You will need:
To send a product message to a person, send a POST
request to the /PAGE-ID/messages
endpoint with the recipient.id
property set to the Instagram-scoped ID of the person receiving the message. Include the type
and payload
properties in the message.attachment
object. Set type
to template
and set the payload.template_type
property to product
and payload.elements
to a list of product ID key-value pairs.
curl -X POST -H "Content-Type: application/json" -d '{ "recipient":{ "id":"INSTAGRAM-SCOPED-ID" }, "message":{ "attachment":{ "type":"template", "payload": { "template_type": "product", "elements": [ { "id": "PRODUCT-ID" } ] } } } }' "https://graph.facebook.com/LATEST-GRAPH-API-VERSION/PAGE-ID/messages?access_token=PAGE-ACCESS-TOKEN"
To send a product carousel, add more product key-value pairs to the payload.elements
property. You can include up to 10 products in your request.
... "payload": { "template_type": "product", "elements": [ { "id": "PRODUCT-ID-1" }, { "id": "PRODUCT-ID-2" }, { "id": "PRODUCT-ID-3" } ] } ...
On success your app will receive the following JSON object with the recipient ID and the message ID.
{ "recipient_id": "1254477777772919", "message_id": "AG5Hz2Uq7tuwNEhXfYYKj8mJEM_QPpz5jdCK48PnKAjSdjfipqxqMvK8ma6AC8fplwlqLP_5cgXIbu7I3rBN0P" }
To send an opt in request to a person to receive recurring marketing messages, send a POST
request to /PAGE-ID/messages
endpoint with the recipient.id
property set to the Instagram-scoped ID of the person receiving the message. In the message
attachment.payload
property set template_type
to notification_messages
. In the payload.elements
property include the image_url
, title
, payload
, notification_message_frequency
, and notification_messages_cta_text
.
curl -X POST -H "Content-Type:application/json" -d '{ "recipient": { "id": "INSTAGRAM-SCOPED-ID" }, "message": { "attachment": { "type": "template", "payload": { "template_type": "notification_messages", "elements": [ { "image_url": "IMAGE-URL", "title": "TEXT-TO-DISPLAY", "payload": "INFORMATION-ABOUT-THIS-MESSAGE", "notification_messages_frequency": "DAILY", "notification_messages_cta_text": "GET_UPDATES" } ] } } } }' "https://graph.intern.facebook.com/LATEST-GRAPH-API-VERSION/PAGE-ID/messages?access_token=PAGE-ACCESS-TOKEN"
Property | Value |
---|---|
| The URL for the image to display in the template |
ALLOW ,
FREQUENCY ,
GET ,
GET_UPDATES ,
OPT_IN ,
SIGN_UP }
| Text that appears on call to action button is set by using one of the following values:
|
DAILY ,
WEEKLY ,
MONTHLY }
| Message frequency for this recurring notification opt in request.
|
| The type of recurring notification, such as promotional messaging or product release messaging, for this recurring notification opt in request |
| The title to display in the template, can not exceed 65 characters. If no value is assigned, the value defaults to "Updates and promotions" |
Now that you people have opted in to receiving recurring marketing messages, learn how to send your marketing messages.