Product Template for Instagram Messaging

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.

Before You Start

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:

  • The ID, or IDs, for the product from your Facebook catalog – You can get IDs from via Catalog API or Commerce Manager
  • A Page Access Token from the Page that owns the products in the catalog
  • The ID for your Instagram Professional account
  • The ID for the Page linked to your Instagram Professional account
  • The Instagram Scoped ID for the person to whom you are sending the message

Send a Product Message

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"  

Send a Carousel

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"
}  

Send an Opt In Request

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"

Notification Messages Elements Reference

PropertyValue

image_url

string

The URL for the image to display in the template

notification_messages_cta_text

enum { 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:

  • ALLOW – set optin message button text to Allow messages
  • FREQUENCY - set optin message button text to Get daily messages
  • GET – set optin message button text to Get messages
  • GET_UPDATES – set optin message button text to Get updates, this is also default if notification_messages_cta_text is not set
  • OPT_IN – set optin message button text to Opt in to messages
  • SIGN_UP – set optin message button text to Sign up for messages

notification_messages_frequency

enum { DAILY, WEEKLY, MONTHLY }

Message frequency for this recurring notification opt in request.

  • DAILY – Opt in to receive one notification per 24 hour period for 6 months
  • WEEKLY – Opt in to receive one notification per 7 day period for 9 months
  • MONTHLY – Opt in to receive one notification per 1 month period for 12 months

payload

string

The type of recurring notification, such as promotional messaging or product release messaging, for this recurring notification opt in request

title

string

The title to display in the template, can not exceed 65 characters. If no value is assigned, the value defaults to "Updates and promotions"

Next Steps

Now that you people have opted in to receiving recurring marketing messages, learn how to send your marketing messages.