ADVERTIZE task on the Pageads_managementpages_manage_adspages_read_engagementpages_show_listPOST request to the act_ad_account_id/campaigns endpoint where ad_account_id is the ID for your Meta ad account. Your request must include:
access_tokenbuying_typenameobjective – set to OUTCOME_TRAFFIC, or OUTCOME_LEADS for lead ads
special_ad_categoriesstatus| Parameter | Value |
|---|---|
access_token | Your Page access token |
buying_type | Set to AUCTION (the default) for Messenger Ads for Leads |
name string | The name for your ad campaign |
objective enum | Campaign’s objective. OUTCOME_TRAFFIC for CTS.OUTCOME_LEADS for Messenger Ads for Leads.OUTCOME_ENGAGEMENT, OUTCOME_SALES, and OUTCOME_TRAFFIC for general CTM Ads. |
special_ad_categories array[enum] | |
status array[enum] | PAUSED – the campaign is not ready yet |
curl -X POST "https://graph.facebook.com/v25.0/act_ad_account_id/campaigns" \
-H "Content-Type: application/json" \
-d '{
"access_token":"Your_page_access_token",
"buying_type":"AUCTION",
"name":"Messenger_ad_campaign_name",
"objective":"OUTCOME_TRAFFIC",
"status":"PAUSED",
"special_ad_categories":["NONE"],
}'
{
"id": "campaign_id"
}
POST request to the act_ad_account_id/adsets endpoint where ad_account_id is the ID for your Meta ad account. Your request must include:
access_tokenbid_amountbilling_event set to IMPRESSIONScampaign_iddaily_budgetdestination_type set to MESSENGERnameoptimization_goal set to CONVERSATIONS, IMPRESSIONS, or LEAD_GENERATION or QUALITY_LEAD for lead adspromoted_object – set to the ID for your business’ Facebook Page.status set to PAUSEDtargeting| Parameter | Value |
|---|---|
access_token | Your Page access token |
bid_amountint | The maximum amount you want to pay for a result based on your optimization_goal |
billing_eventenum | Must be set to IMPRESSIONS. Meta bills you when your ad is shown to people |
campaign_idint | The ID for your campaign from Step 1 |
daily_budgetint | The amount you want to spend per day |
destination_typestring | Must be MESSENGER for Messenger Ads for Leads. Required for Messenger Ads for Leads |
name string | The name of your ad set |
optimization_goalenum | Can be either CONVERSATIONS or CONVERSIONS for CTM or CTS. Can be either LEAD_GENERATION or QUALITY_LEAD for Messenger Ads for Leads. |
promoted_objectenum | Set to the ID for your business’ Facebook Page ID. Required for Lead Ads for Messenger
|
statusenum | PAUSED |
targeting object | An object that defines the audience to whom you want to show your ads
|
curl -X POST "https://graph.facebook.com/v25.0/act_ad_account_id/adsets"
-H "Content-Type: application/json"
-d '{
"access_token":"Your_page_access_token",
"bid_amount":"Your_bid_amount",
"billing_event":"IMPRESSIONS",
"campaign_id":"Your_campaign_id",
"daily_budget":"Your_daily_budget",
"destination_type":"MESSENGER",
"name:"Your_messenger_adset_name",
"optimization_goal:IMPRESSIONS",
"status:PAUSED",
"targeting":{
"geo_locations": { "countries":["US","CA"] },
"device_platforms": ["mobile", "desktop"],
"publisher_platforms": ["messenger"]
}
}'
{
"id": "adset_id"
}
object_story_id are not supported
POST request to the /act_ad_account_id/adcreatives endpoint where ad_account_id is the ID for your Meta ad account. Your request must include:
access_tokennameobject_story_spec – Requiredprivacy_url – Required for lead adsstandard_enhancements.enroll_status – Required for ad creatives that are eligible for standard enhancements.| Parameter | Value |
|---|---|
access_token | Your Page access token. Required |
name | The name for your ad creative. For example, “Click to Messenger for September”, etc. Required |
An object containing information about a message. Required for Click to Messenger or Click to Subscribe ads
| |
privacy_url | Set to the URL for your privacy policy. Required for Messenger Ads for Leads |
POST request to the /act_ad_account_id/adcreatives endpoint where ad_account_id is the ID for your Meta ad account. Your request must include:access_tokennameobject_story_spec with a *_data object that defines the media typelink_data Parameters
| Values |
|---|---|
call_to_action | Object to define the call to action button in the ad type – The text for the button, for example LEARN_MOREvalue – The destination for the button click
{app_destination: MESSENGER} – Required |
image_hash | The hash for the image |
link | The URL for the image |
message |
The Welcome text for the first message you send to the person after they click on the call to action button. You can also send a default template or a series of up to 5 template messages.
Learn more. |
curl -X POST "https://graph.facebook.com/v25.0/act_ad_account_id/adcreatives"
-H "Content-Type: application/json"
-d '{
"access_token":"page_access_token",
"name":"Your_CTM_image_ad_name",
"object_story_spec":{
"page_id": "your_page_id",
"link_data": {
"page_welcome_message": "Your_welcome_message",
"image_hash": "Your_image_hash",
"link": "Your_image_URL",
"call_to_action": {
"type":"LEARN_MORE",
"value":{ "app_destination":"MESSENGER" }
}
}
}
}'
video_data Parameters
| Values |
|---|---|
call_to_action | Object to define the call to action button in the ad type – The text for the button, for example LEARN_MOREvalue – The destination for the button click
{app_destination: MESSENGER} – Required |
link_description | The text for the video |
image_url | the URL for the video thumbnail |
page_welcome_message |
The welcome text for the first message you send to the person after they click on the call to action button. You can also send a default template or a series of up to 5 template messages.
Learn more. |
video_id |
Meta ID for the video.
Learn more about uploading assets to Meta servers. |
curl -X POST "https://graph.facebook.com/v25.0/act_ad_account_id/adcreatives"
-H "Content-Type: application/json"
-d '{
"access_token": "page_access_token",
"name": "Your_CTM_image_ad_name",
"object_story_spec": {
"page_id": "your_page_id",
"video_data": {
"call_to_action": {
"type": "LEARN_MORE",
"value": { "app_destination": "MESSENGER" }
},
"link_description": "Your_link_description",
"image_url": "Your_thumbnail_URL",
"page_welcome_message": "Your_welcome_text",
"video_id": "video_id"
}
}
}'
curl -X POST "https://graph.facebook.com/v25.0/act_ad_account_id/adcreatives"
-H "Content-Type: application/json"
-d '{
"access_token": "page_access_token",
"name": "Your_CTM_image_ad_name",
"object_story_spec": {
"page_id": "your_page_id",
"link_data": {
"image_hash": "your_image_hash",
"link": "your_image_URL",
"call_to_action": {
"type": "MESSAGE_PAGE",
"value": { "app_destination":"MESSENGER" }
}
}
},
"asset_feed_spec": {
"additional_data": {
"partner_app_welcome_message_flow_id": "FLOW-ID"
}
}
}'
page_welcome_message field under object_story_spec.ice_breakers reference.page_welcome_message object to add icebreakers with a greeting message."page_welcome_message": {
"type":"VISUAL_EDITOR",
"version":2,
"landing_screen_type":"welcome_message",
"media_type":"text",
"text_format":{
"customer_action_type":"ice_breakers",
"message":{
"ice_breakers":[
{"title":"Can I make a purchase?","response":"This is a response 1"},
{"title":"Can I see a menu?", "response":"This is a response 2"},
{"title":"Where are you located?", "response":"This is a response 3"}],
"quick_replies":[],
"text":"Hi {{user_first_name}}! Please let us know how we can help you."}
},
"user_edit":false,
"surface":"visual_editor_new"
}
object_story_spec.page_welcome_message is an array of objects with a notification message template. When a person clicks the Get messages button in your ad, the person agrees to receive marketing messages from your business.POST request to the /act_ad_account_id/adcreatives endpoint where ad_account_id is the ID for your Meta ad account. Your request must include:access_tokennameobject_story_spec with
*_data object that defines the media typepage_welcome_message array that defines the marketing message opt in request. Must include landing_screen_type set to marketing_messages and the message attachment payload.template_type set to nofitication_messagescurl -X POST "https://graph.facebook.com/v25.0/act_ad_account_id/adcreatives"
-H "Content-Type: application/json"
-d '{
"access_token": "page_access_token",
"name": "Your_CTS_image_ad_name",
"object_story_spec": {
"page_id": "your_page_id",
"link_data": {
"image_hash": "Your_image_hash",
"link": "Your_image_URL",
"call_to_action": {
"type": "LEARN_MORE",
"value":{ "app_destination": "MESSENGER" }
}
"page_welcome_message": "{
"landing_screen_type": "marketing_messages",
"media_type": "image",
"image_format": {
"customer_action_type": "buttons",
"message": {
"text": "Your_welcome_message",
"attachment": {
"type": "template",
"payload":{
"template_type":"notification_messages",
"elements": [{
"title": "Your_CTS_title",
"subtitle": "Your_CTS_subtitle",
"image_url": "Your_image_URL",
"app_id": "Your_Meta_app_ID",
"buttons": [{
"type": "postback",
"payload": "Data_to_include_in_webhook_notification",
"title": "Get messages"
}]
}]
}
}
}
}
}"
}
}
}'
POST request to the /page_id/messenger_lead_forms endpoint where page_id is the ID for your business' Facebook Page. Your request must include:
access_tokenprivacy_urlstep_list array that includes message, reply_type, step_id, and step_typetemplate_namereminder_texttemplate_name, your privacy_url, step_list with a welcome message in step_id: 0, questions in step_id: 1 to 4, a confirmation message in step_id: 5, and a disqualification message in step_id: 6.step_list Parameters
| Description |
|---|---|
allow_to_skip bool | Set to true or false. Set to false when a person must provide an answer or true no answer is required. |
answer_validation_enabled bool | Set to true or false. Set to true when an answer must be validated. Only supports city, country, email, national ID, phone number, and zip code validation. |
answers array of strings | A list of answers for a question. Required for reply_type: QUICK_REPLIES. |
message string | The text for a particular step. For example, a welcome message, question, directive, confirmation or disqualification message. Required |
next_step_ids array of step_ids | The next step, or possible steps, in the list of questions. Can not point to a previous question in the list. Can be dependent on the answer given. For example, if a person answers a question with a disqualifier then the next step will be the disqualifying step but if the answer is a qualifier then the next step will be the next question in the list of questions. |
prefill_type enum{ CITY, EMAIL, PHONE } | If an answer if is prefilled with a person’s information, such as if a person has already shared their email or phone number with your business. |
reminder_text string | Text for the person answering the questions reminding them to complete the form |
reply_type enum{ NONE, PREFILL, QUICK_REPLIES } | If reply_type is set to ‘PREFILL’ then the sizes of step_list[x].next_step_ids and step_list[x].answers must match |
step_id string | The ID for step to allow you to order the questions and messages.For example, if you have a list of 6 steps, 0 is your welcome message, while 1 thru 3 are your questions, 4 is your confirmation, and 5 is your disqualification message. |
step_type enum{ CONFIRMATION, DISQUALIFY, INTRO, QUESTION } | The type of step such as a question or introduction message. An INTRO and CONFIRMATION step are required |
curl -X POST "https://graph.facebook.com/v25.0/your_page_ID/messenger_lead_forms"
-H "Content-Type: application/json"
-d '{
"access_token": "Your_page_access_token",
"privacy_url": "Your_privacy_policy_URL",
"reminder_text": "Your_reminder_text",
"template_name": "Your_template_name",
"step_list": [
{
"step_id": "0",
"message": "Your_welcome_message",
"step_type": "INTRO",
"reply_type": "NONE",
"next_step_ids": "1"
},
{
"step_id": "1"
"message": "Are_you_interested_in_our_products_or_services?",
"step_type": "QUESTION",
"reply_type": "QUICK_REPLIES",
"answers": ["Yes", "Not now", "Maybe"],
"next_step_ids": [2,6,2],
"allow_to_skip": false,
"answer_validation_enabled": true
},
{
"step_id": "2",
"message": "What city do you live in?",
"step_type": "QUESTION",
"reply_type": "PREFILL",
"prefill_type": "CITY",
"next_step_ids": "3",
"allow_to_skip": true
},
{
"step_id": "3",
"message": "What is your phone number?",
"step_type": "QUESTION",
"reply_type": "PREFILL",
"prefill_type": "PHONE",
"next_step_ids": "4",
"allow_to_skip": false,
"answer_validation_enabled": true
},
{
"step_id": "4",
"message": "What is your email address?",
"step_type": "QUESTION",
"reply_type": "PREFILL",
"prefill_type": "EMAIL",
"next_step_ids": "5",
"allow_to_skip": false,
"answer_validation_enabled": true
},
{
"step_id": "5",
"message": "Your_confirmation_message",
"step_type": "CONFIRMATION",
"reply_type": "NONE"
},
{
"step_id": "6",
"message": "Your_disqualification_message",
"step_type": "DISQUALIFY",
"reply_type": "NONE"
}
]
}'
{
"id": "your_messenger_lead_gen_template_id"
}
fblead_form is also created and associated with the message template as part of this process.GET request to the /page_id/messenger_lead_forms endpoint. You can also get information about a specific template by sending a GET request to /Your_messenger_lead_gen_template_id endpoint.POST request to the /act_ad_account_id/adcreatives endpoint where ad_account_id is the ID for your Meta ad account. Your request must include:access_tokennameobject_story_spec with a *_data object that defines the media type, image or video, and contains:
*_data.page_welcome_message parameter set to the key-value pair
ctm_lead_gen_template_id: Your_messenger_lead_gen_template_idcurl -X POST "https://graph.facebook.com/v25.0/act_AD_ACCOUNT_ID/adcreatives"
-H "Content-Type: application/json"
-d '{
"access_token": "Your_page_access_token",
"degrees_of_freedom_spec": {
"creative_features_spec": {
"standard_enhancements": { "enroll_status": "OPT_IN" }
}
},
"name": "Your_lead_ad_image_ad_name",
"object_story_spec": {
"page_id": "Your_page_id",
"link_data": {
"call_to_action": {
"type": "MESSAGE_PAGE",
"value": { "app_destination": "MESSENGER" }
},
"description": "Sample_description",
"image_hash": "Your_image_hash",
"message": "Sample_message_for_Creative",
"page_welcome_message": "{ "ctm_lead_gen_template_id": "Your_messenger_lead_gen_template_id" }"
}
}
}'
curl -X POST "https://graph.facebook.com/v25.0/act_AD_ACCOUNT_ID/adcreatives"
-H "Content-Type: application/json"
-d '{
"access_token": "Your_page_access_token",
"degrees_of_freedom_spec": {
"creative_features_spec": {
"standard_enhancements": { "enroll_status": "OPT_IN" }
}
},
"name": "Your_lead_ad_video_ad_name",
"object_story_spec": {
"page_id": "your_page_id",
"video_data": {
"call_to_action": {
"type": "MESSAGE_PAGE",
"value":{ "app_destination": "MESSENGER" }
},
"image_url": "Your_thumbnail_url",
"link_description": "Your_link_description",
"message": "Sample message for Creative",
"page_welcome_message": "{ "ctm_lead_gen_template_id": "Your_messenger_lead_gen_template_id" }",
"video_id": "Your_video_id"
}
}
}'
curl -X POST \
-F 'name=Sample ad creative from Instagram post' \
-F 'object_id=<PAGE_ID>' \
-F 'instagram_user_id=<INSTAGRAM_USER_ID>' \
-F 'source_instagram_media_id=<INSTAGRAM_POST_ID>' \
-F 'call_to_action={
"type": "INSTAGRAM_MESSAGE",
"value": {
"link": "https://www.instagram.com"
}
}' \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v25.0/act_<AD_ACCOUNT_ID>/adcreatives
curl -X POST \
-F 'name=Sample ad creative from Instagram image' \
-F 'object_story_spec={
"page_id": "<PAGE_ID>",
"instagram_user_id": "<IG_USER_ID>",
"link_data": {
"message": "<AD_PRIMARY_TEXT>",
"picture": "<IMAGE_URL>"
"page_welcome_message": "<PAGE_WELCOME_MESSAGE>",
"call_to_action": {
"type": "INSTAGRAM_MESSAGE",
"value": {
"app_destination": "INSTAGRAM_DIRECT"
}
}
}
}' \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v25.0/act_<AD_ACCOUNT_ID>/adcreatives
curl -i -X POST \
"https://graph.facebook.com/v25.0/act_<AD_ACCOUNT>/adcreatives
?object_story_id=<postOwnerID_postID>
&instagram_user_id=<IG_USER_ID>
&call_to_action="{'type':MESSAGE_PAGE,'value':{'app_destination':'MESSENGER'}}"
&access_token=<ACCESS_TOKEN>"
object_story_id is the post ID in the format of postOwnerID_postID and instagram_user_id is either a Page-connected Instagram account ID or the Page-backed Instagram account ID. See more details in Set Up Instagram Accounts With Pages.OUTCOME_ENGAGMENET, OUTCOME_LEAD,OUTCOME_SALES or LINK_CLICK objectivecurl -X POST "https://graph.facebook.com/v25.0/act_ad_account_id/ads"
-H "Content-Type: application/json"
-d '{
"access_token": "Your_page_access_token",
"creative_sourcing_spec": {
"associated_product_set_id": "Your_associated_product_set_id"
},
"degrees_of_freedom_spec": {
"creative_features_spec": {
"product_extensions": {
"enroll_status": "OPT_IN"
}
}
},
"object_story_spec": {
"page_id": Your_facebook_page_id",
"link_data": {
"call_to_action": {
"type": "MESSAGE_PAGE",
"value": {
"app_destination": "MESSENGER"
}
},
"image_hash":"Your_image_hash", (or “picture”: "Your_picture_url")"
"link": "https://fb.com/messenger_doc/",
"name": "Chat in Messenger"
},
"product_data": [
{
"product_id": Your_product_id_1", "product_source": "MANUAL",
"product_decision": "ACCEPT"
},
{
"product_id":Your_product_id_2", "product_source": "MANUAL",
"product_decision": "ACCEPT"
}
]
}
curl -X POST "https://graph.facebook.com/v25.0/act_ad_account_id/ads"
-H "Content-Type: application/json"
-d '{
"access_token": "Your_page_access_token",
"creative_sourcing_spec": {
"associated_product_set_id": "Your_associated_product_set_id"
},
"degrees_of_freedom_spec": {
"creative_features_spec": {
"product_extensions": {
"enroll_status": "OPT_IN"
}
}
},
"object_story_spec": {
"page_id": "Your_facebook_page_id",
"video_data": {
"video_id":"Your_video_id"",
"video_thumbnail_id": "0",
"call_to_action": {
"type": "MESSAGE_PAGE",
"value": {
"app_destination": "MESSENGER",
"link": "https://fb.com/messenger_doc/"
}
},
"image_url": "Your_image_url",
"title": "Chat in Messenger",
"video_thumbnail_source": "generated_default"
},
"product_data": [
{
"product_id": Your_product_id_1", "product_source": "MANUAL",
"product_decision": "ACCEPT"
},
{
"product_id":Your_product_id_2", "product_source": "MANUAL",
"product_decision": "ACCEPT"
}
]
}
curl -X POST "https://graph.facebook.com/v25.0/act_ad_account_id/ads"
-H "Content-Type: application/json"
-d '{
"access_token": "Your_page_access_token",
"object_story_id": "Your_object_story_id(pageID_postID)",
"creative_sourcing_spec": {
"associated_product_set_id": "Your_associated_product_set_id"
},
"degrees_of_freedom_spec": {
"creative_features_spec": {
"product_extensions": {
"enroll_status": "OPT_IN"
},
"multi_photo_to_video": {
"enroll_status": "OPT_IN"
}
}
},
"product_data": [
{
"product_id": Your_product_id_1", "product_source": "MANUAL",
"product_decision": "ACCEPT"
},
{
"product_id":Your_product_id_2", "product_source": "MANUAL",
"product_decision": "ACCEPT"
}
]
}
curl -X POST "https://graph.facebook.com/v25.0/act_ad_account_id/ads"
-H "Content-Type: application/json"
-d '{
"access_token": "Your_page_access_token",
"object_story_id": "Your_object_story_id(pageID_postID)",
"creative_sourcing_spec": {
"associated_product_set_id": "Your_associated_product_set_id"
},
"degrees_of_freedom_spec": {
"creative_features_spec": {
"product_extensions": {
"enroll_status": "OPT_IN"
}
}
},
"product_data": [
{
"product_id": Your_product_id_1", "product_source": "MANUAL"
"product_decision": "ACCEPT"
},
{
"product_id":Your_product_id_2", "product_source": "MANUAL"
"product_decision": "ACCEPT"
}
]
}
POST request to the /act_ad_account_id/ads endpoint where ad_account_id is the ID for your Meta ad account. Your request must included:
| Parameter | Value |
|---|---|
access_token | Your Page access token |
adset_id | The AD-SET-ID from Step 2 |
creative_id | {"creative_id": "AD-CREATIVE-ID"} where AD-CREATIVE-ID is the ID from Step 3 |
name | The name for this ad |
status | Set to PAUSED. Set to ACTIVE when you are ready to launch your ad campaign |
curl -X POST "https://graph.facebook.com/v25.0/act_ad_account_id/ads"
-H "Content-Type: application/json"
-d '{
"access_token": "Your_page_access_token",
"adset_id": "Your_ad_set_id",
"creative": { "creative_id": "Your_ad_creative_id" },
"status": "PAUSED"
}'
{
"id": "ad_id"
}
"call_to_action": {
"value": {"app_destination":"MESSENGER"},
"type": "MESSAGE_PAGE"
}
status parameter set to ACTIVE.PENDING_REVIEW. Once approved, the status will be ACTIVE and your ad will be delivered.*_data.page_welcome_message value instead of a string value.page_welcome_message Parameters
| Values |
|---|---|
landing_screen_type enum | Set to call_prompt – Required |
media_type enum | Set to text for a call prompt ad |
message object | Use to include one or more message templates in your Click to Messenger ad |
text_format.message | Object to define the call prompt button actions
|
*_data.page_welcome_message to an array of objects that define your call prompt elements. Set the landing_screen_type parameter to call_prompt, media_type to text, and the text_format.message object with text to your welcome message text, and call_prompt_data.call_prompt_message set to a prompt to call your business....
"page_welcome_message": "[
{
"landing_screen_type": "call_prompt",
"media_type": "text",
"text_format": {
"message": {
"text": "Your_welcome_message",
"call_prompt_data": {
"call_prompt_message": "Your_call_prompt_message"
}
}
},
}
]"
...
*_data.page_welcome_message parameter to an array with a
message template
The following example adds a template for a quick reply.
...
"page_welcome_message": "[{
'message': {
'text':' Your_question_or_directive',
'quick_replies':[
{
'content_type':'text',
'title':' Option_1',
'payload':' Option_1_information_for_webhook'
},
{
'content_type':'text',
'title':' Option_2',
'payload':' Option_2_information_for_webhook'
},
{
'content_type':'text',
'title':' Option_3',
'payload':' Option_3_information_for_webhook '
}
]
}
}]",
...