Sponsored Messages Reference

Graph API v2.11 Required

This API is available only in Graph API v2.11 and above.

The sponsored_message_ads endpoint gives you the ability to send sponsored messages, which are a type of paid ad that is sent directly to everyone who currently has an open chat with your Facebook Page. The sponsored_message_ads endpoint is an interface for using the sponsored message feature of the Facebook Marketing API.

For more information on using the sponsored_message_ads endpoint, see Sending Sponsored Messages.

Contents

Request URI

Create Message Creative

https://graph.facebook.com/v2.11/me/message_creatives?access_token=<PAGE_ACCESS_TOKEN>

Send Sponsored Message

https://graph.facebook.com/v2.11/act_<AD_ACCOUNT_ID>/sponsored_message_ads

Example Request

Create Message Creative

curl -X POST -H "Content-Type: application/json" -d '{    
  "messages": [  
    {
      "dynamic_text": {
          "text": "Hi, {first_name}! Here is a generic template:",
          "fallback_text": "Hi! Here is a generic template:",
      }       
    },
    {
      "attachment":{
        "type":"template",
        "payload":{
          "template_type":"generic",
          "elements":[
             {
              "title":"Welcome to Our Marketplace!",
              "image_url":"https://www.facebook.com/jaspers.png",
              "subtitle":"Fresh fruits and vegetables. Yum.",
              "buttons":[
                {
                  "type":"web_url",
                  "url":"https://www.jaspersmarket.com",
                  "title":"View Website"
                }              
              ]      
            }
          ]
        }       
      }
    }
  ]
}' "https://graph.facebook.com/v2.11/me/message_creatives?access_token=<PAGE_ACCESS_TOKEN>"

Send Sponsored Message

curl \
  -F 'message_creative_id=938461089' \
  -F 'daily_budget=100' \
  -F 'bid_amount=400' \
  -F "targeting={'geo_locations': {'countries':['US']}}" \
  -F 'access_token=<USER_ACCESS_TOKEN>' \
  "https://graph.facebook.com/v2.11/act_<AD_ACCOUNT_ID>/sponsored_message_ads"

Properties

Create Message Creative

Property Type Description

messages

Array

The messages to send.


For information on supported message types, see Sending Sponsored Messages.

Send Sponsored Message

Property Type Description

message_creative_id

Integer

The ID of the Message Creative you want to send.

daily_budget

Integer

The maximum daily budget of the ad campaign for sending the sponsored message.

bid_amount

Integer

Maximum amount to bid for each message.

targeting

String

Refer Targeting Spec to set targeting.

Fields that are pre-assigned and should be excluded from targeting:

  • publisher_platforms: messenger
  • messenger_positions: sponsored_messages
  • flexible_spec: custom_audiences

access_token

String

User Access Token

Response

Create Message Creative

{
  "message_creative_id": 938461089,
}
Property Type Description

message_creative_id

Integer

The unique ID of the message creative.

Send Sponsored Message

{
  "ad_group_id": "6088387928148",
  "broadcast_id": "754911018029273",
  "success": true
}
Property Type Description

ad_group_id

Numeric

The unique ID of the advert set. An advert set is a group of adverts that share the same budget, schedule, delivery optimisation and targeting.

broadcast_id

Numeric

The unique ID of the Broadcast object

success

Boolean

Response status