


POST request to the /PAGE-ID/messages endpoint with a JSON object with the attachment type set to template and payload set with the template_type set to coupon, title set to coupon text, and the coupon_code set to the coupon code to send to the person.title to “10% off summer sale” , subtitle to “Copy code 10offsummer and use at checkout.” , coupon_code to “10offsummer” and coupon_url to “https://www.myshop.com/”.curl -X POST -H "Content-Type: application/json" -d '{ "recipient":{ "id":"PSID" }, "message":{ "attachment": { "type": "template", "payload": { "template_type": "coupon", "title":"10% off summer sale", "subtitle": "Copy code 10offsummer and use at checkout." "coupon_code":"10offsummer", "coupon_url":"https://www.myshop.com/", }, } } }' "https://graph.facebook.com/LATEST-API-VERSION/PAGE-ID/messages?access_token=PAGE-ACCESS-TOKEN"
{ "recipient_id": "PSID", "message_id": "MESSAGE-ID" }

coupon_pre_message, title, subtitle, the disclaimer that applies to this coupon, the second button with my store’s URL and “Shop now” text, an image from my store, and additional information to be sent in the webhook notification when a person clicks the Copy code button.curl -X POST -H "Content-Type: application/json" -d '{ "recipient":{ "id":"PSID" }, "message":{ "attachment": { "type": "template", "payload": { "template_type": "coupon", "title":"10% off summer sale 🎁", "subtitle":"Use code 10offsummer at checkout.", "coupon_code":"10offsummer", "coupon_url":"https://www.myshop.com/", "coupon_url_button_title":"Shop now", "coupon_pre_message":"We have a new summer sale coming up", "image_url": "https://www.myshop.com/sale-image.png", "payload":"The coupon for 10% off everything that expires 2022-10-1", }, } } }' "https://graph.facebook.com/LATEST-API-VERSION/PAGE-ID/messages?access_token=PAGE-ACCESS-TOKEN"
expire_time in the API spec.
curl -X POST -H "Content-Type: application/json" -d '{ "recipient":{ "id":"PSID" }, "message":{ "attachment": { "type": "template", "payload": { "template_type": "coupon", "title":"10% off summer sale 🎁", "subtitle":"Use code 10offsummer at checkout.", "coupon_code":"10offsummer", "coupon_url":"https://www.myshop.com/", "coupon_url_button_title":"Shop now", "expire_time" :"2025-10-25 16:00:00", "coupon_pre_message":"We have a new summer sale coming up", "image_url": "https://www.myshop.com/sale-image.png", "payload":"The coupon for 10% off everything that expires 2022-10-1", }, } } }' "https://graph.facebook.com/LATEST-API-VERSION/PAGE-ID/messages?access_token=PAGE-ACCESS-TOKEN"
expire_time, we display the expired state format once the coupon code has expired.| Property | Description |
|---|---|
recipient object | Required. Object containing information about the person receiving the coupon message |
idstring | The Page-scoped ID (PSID) for the person receiving the coupon message |
comment_idstring | Send a Private Reply that contains a coupon template to a person who commented on a post on the Facebook Page |
notification_message_tokenstring | Send Marketing Messages that contain a coupon template to a person |
post_idstring | Send a Private Reply that contains a coupon template to a person who published a visitor post on the Facebook Page |
user_refstring | Send a Checkbox plugin that contains a coupon template |
messageobject | Required. Contains the attachment object |
attachmentobject | Required. Contains the type of message and payload. |
typeenum { template} | Required. Message type, set to coupon |
payloadobject | Required. Contains the message coupon details |
template_typeenum { coupon} | Required. Set to coupon |
titlestring | Required. Title to display in the message. 80 character limit. |
subtitlestring | Subtitle to display in the message. 80 character limit. |
coupon_codestring | Required. Coupon Code for person to copy and apply. |
expire_timestring | optional Expire time to show Limited Time Offer (Timer) to the user. |
coupon_pre_messagestring | The message sent before the coupon message |
coupon_urlstring | Required. The coupon URL that allows person to redirect to the website to apply the coupon. |
coupon_url_button_titlestring | The text for the button that allows a person to click to the coupon URL |
image_urlstring | The URL for the image displayed in the coupon message |
payloadstring | Additional information to be included in the webhook notification |