This guide explains how to create and publish ads that click to Messenger using the Marketing API.
If you would like to use the Ads Manager to create a campaign for lead ads, visit the Meta Business Help Center.
Ads that click to Messenger send people that click on your ads directly into conversations with your business in Messenger. Use these ads to reach people at scale and deliver standout, individualized service.
Ads that click to Messenger support ads with an image, a video, a carousel, or a slideshow. You can also include call prompts in your ad.
If you’re interested in creating ads that send people to Instagram or WhatsApp chats, see Ads that Click to Instagram or Ads that Click to WhatsApp for guidance. You can also create ads that pick the destination the user is most likely to respond from, see Ads that Click to Multidestination for more information.
To create and publish an ad you will:
This guide assumes you have:
To make successful calls to all endpoints in this guide, you will need:
ADVERTIZE task on the Pageads_managementpages_manage_adspages_read_engagementpages_show_listTo create your ad campaign send a POST 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:
|
|
| Parameter | Value |
|---|---|
| Your Page access token |
| Set to |
| The name for your ad campaign |
| Campaign's objective. |
| |
|
|
for the complete list of available parameters.
curl -X POST "https://graph.facebook.com/v24.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"],
}'On success your app receives a JSON response with the ID for your campaign.
{
"id": "campaign_id"
}
To create an ad set, send a 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_token bid_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 |
|---|---|
| Your Page access token |
| The maximum amount you want to pay for a result based on your optimization_goal |
| Must be set to |
| The ID for your campaign from Step 1 |
| The amount you want to spend per day |
| Must be |
| The name of your ad set |
| Can be either |
| Set to the ID for your business' Facebook Page ID. Required for Lead Ads for Messenger
|
|
|
| An object that defines the audience
|
Visit our
Ad Account Ad Set Endpoint Reference
for the complete list of available parameters.
curl -X POST "https://graph.facebook.com/v24.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"]
}
}'
On success your app receives the following JSON response with the ID for the ad set.
{
"id": "adset_id"
}
The ad creative allows you to add assets to your ads.
Limitations
| ![]() |
To create an ad creative, send a 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_token nameobject_story_spec – Requiredprivacy_url – Required for lead adsstandard_enhancements.enroll_status – Required for ad creatives that are eligible for standard enhancements. | Parameter | Value |
|---|---|
| Your Page access token. Required |
| The name for your ad creative. For example, "Click to Messenger for September", etc. Required |
object_story_spec ![]() | An object containing information about a message. Required for Click to Messenger or Click to Subscribe ads
|
| Set to the URL for your privacy policy. Required for Messenger Ads for Leads |
To create an ad creative for a Click to Messenger ad, send a 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 |
|---|---|
| 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 |
| The hash for the image |
| The URL for the image |
| 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/v24.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 |
|---|---|
| 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 |
| The text for the video |
| 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/v24.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/v24.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"
}
}
}'
For more information about messaging app flows, refer to Welcome message flows in the Messenger Platform documentation.
The default message that a customer sees is "Hello! Can I get more info on this?". You can create more tailored user experiences for your ads that click to Messenger by customizing your ads' greeting message, icebreakers, and autofill messages in the page_welcome_message field under object_story_spec.
For more information about icebreakers, see the ice_breakers reference.
Create the 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"
}
Click to Subscribe ads (CTS) are Click to Messenger ads where the 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.
To create an ad creative for a Click to Subscribe ad, send a 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 type page_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_messages
curl -X POST "https://graph.facebook.com/v24.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"
}]
}]
}
}
}
}
}"
}
}
}'
Beginning with v24.0, the ability to create lead ads that generate leads in Messenger with the API is being deprecated. You will still be able to create Messenger ads for leads using Ads Manager. See Create lead ads that click to Messenger and Instagram Direct in Meta Ads Manager for more information.
Messenger Ads for Leads allow you to generate leads in Messenger through an automated chat template. You can ask specific questions to people who are interested in your business directly in your preferred messaging platform, gather customer preferences, and ask custom questions to prioritize the most qualified leads.
Before you can create ad creatives for Messenger Ads for Leads you must accept
the terms and conditions for Messenger Ads for Leads.

To create a message template, send a 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_textThe following message template includes your template_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 |
|---|---|
| Set to |
| Set to |
| A list of answers for a question. Required for |
| The text for a particular step. For example, a welcome message, question, directive, confirmation or disqualification message. Required |
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. |
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. |
| Text for the person answering the questions reminding them to complete the form |
NONE, PREFILL, QUICK_REPLIES } | If |
| The ID for step to allow you to order the questions and messages.For example, if you have a list of 6 steps, |
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/v24.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"
}
]
}'
On success your app will receive a JSON object with the ID for the template.
{
"id": "your_messenger_lead_gen_template_id"
}
A fblead_form is also created and associated with the message template as part of this process.
To get a list of the Messenger lead generation form templates, you can send a 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.
To create an ad creative for lead ads, send a 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_id
curl -X POST "https://graph.facebook.com/v24.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/v24.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"
}
}
}'
Refer Use Posts as Instagram Ads for more details.
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/v24.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/v24.0/act_<AD_ACCOUNT_ID>/adcreatives
Refer to Use Posts as Instagram Ads: Facebook Posts for more details.
curl -i -X POST \
"https://graph.facebook.com/v24.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>"
Where 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.
Product extensions(the "Show product" feature in Meta Ads Manager) is an Advantage+ creative optimization that showcases products from your catalog below your static single media when it's likely to improve performance. This document shows you how to use product extensions features for Click-to-Messenger ads. If you want to learn how to add product extensions for non-click-to-messenger ads, please refer to this page.
OUTCOME_ENGAGMENET, OUTCOME_LEAD,OUTCOME_SALES or LINK_CLICK objective
curl -X POST "https://graph.facebook.com/v24.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/v24.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/v24.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/v24.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"
}
]
}
To create the ad you need to associate the ad creative and the ad set. To create the ad, send a 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 |
|---|---|
| Your Page access token |
| The AD-SET-ID from Step 2 |
|
|
| The name for this ad |
| Set to |
curl -X POST "https://graph.facebook.com/v24.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"
}'
On success your app receives the following JSON response with the ID for the ad.
{
"id": "ad_id"
}
You can also set a call to action when creating your ad.
"call_to_action": {
"value": {"app_destination":"MESSENGER"},
"type": "MESSAGE_PAGE"
}
Verify that your ad exists in the
ads manager
. Click the Review and publish button in the upper right corner. Select your campaign, the ad set for the campaign, and the ad.
You can publish your ad from the ads manager or using the API. To publish using the API, repeat Step 4 with the status parameter set to ACTIVE.
Your ad will be reviewed by Meta and the status will be PENDING_REVIEW. Once approved, the status will be ACTIVE and your ad will be delivered.
You can create messages that include more than one message element, like a call prompt or multiple templates. You will add these elements by setting an array of objects for the *_data.page_welcome_message value instead of a string value.
page_welcome_message Parameters | Values |
|---|---|
| Set to |
| Set to |
| Use to include one or more message templates in your Click to Messenger ad |
| Object to define the call prompt button actions
|
You can add a call prompt to your Click to Messenger ad by setting the value of *_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"
}
}
},
}
]"
...
To create an ad with multiple templates set *_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 '
}
]
}
}]",
...
If you have not already, set up webhooks to get notifications for when a person clicks on your ad.
Learn more about the Marketing API and additional options for Click to Messenger.