Share Button Reference

The Share Button enables people to share your content in Messenger. Messages shared this way show an attribution to your bot that recipients can tap to learn more about your bot.

For more information on using the share button, see Share Button.

Contents

Policy Reminder Messages shared via this API are subject to Facebook Platform Policy. Bots may not incentivize sharing, require it, or lead users to share in a deceptive manner.

Example Body

...

  "buttons": [
    {
      "type": "element_share",
      "share_contents": { 
        "attachment": {
          "type": "template",
          "payload": {
            "template_type": "generic",
            "elements": [
              {
                "title": "I took Peter's 'Which Hat Are You?' Quiz",
                "subtitle": "My result: Fez",
                "image_url": "https://bot.peters-hats.com/img/hats/fez.jpg",
                "default_action": {
                  "type": "web_url",
                  "url": "http://m.me/petershats?ref=invited_by_24601"
                },
                "buttons": [
                  {
                    "type": "web_url",
                    "url": "http://m.me/petershats?ref=invited_by_24601", 
                    "title": "Take Quiz"
                  }
                ]
              }
            ]
          }
        }
      }
    }
  ]

...

Example Request

curl -X POST -H "Content-Type: application/json" -d '{
  "recipient":{
    "id":"<PSID>"
  },
  "message":{
    "attachment":{
      "type":"template",
      "payload":{
        "template_type":"generic",
        "elements":[
          {
            "title":"Breaking News: Record Thunderstorms",
            "subtitle":"The local area is due for record thunderstorms over the weekend.",
            "image_url":"https://thechangreport.com/img/lightning.png",
            "buttons": [
              {
                "type": "element_share",
                "share_contents": { 
                  "attachment": {
                    "type": "template",
                    "payload": {
                      "template_type": "generic",
                      "elements": [
                        {
                          "title": "I took the hat quiz",
                          "subtitle": "My result: Fez",
                          "image_url": "https://bot.peters-hats.com/img/hats/fez.jpg",
                          "default_action": {
                            "type": "web_url",
                            "url": "http://m.me/petershats?ref=invited_by_24601"
                          },
                          "buttons": [
                            {
                              "type": "web_url",
                              "url": "http://m.me/petershats?ref=invited_by_24601", 
                              "title": "Take Quiz"
                            }
                          ]
                        }
                      ]
                    }
                  }
                }
              }
            ]
          }
        ]
      }
    }
  }
}' "https://graph.facebook.com/me/messages?access_token=<PAGE_ACCESS_TOKEN>"

Example Response

{
  "recipient_id": "1254477777772919",
  "message_id": "mid.$cAAJsujCd2ORj_1qmrFdzhVa-4cvO"
}  

Properties

Property Type Description

type

String

Type of button. Must be element_share.

share_contents

Object

Optional. The message that you wish the recipient of the share to see, if it is different from the one this button is attached to. The format follows that used in Send API.


share_contents only supports the following:

  • Template used must be generic template.
  • Maximum of one URL button on the template.