Open Graph Template

During F8 2019, we announced our plans to launch a lighter, better and simpler Messenger designed to build closer connections between people and businesses.

Starting August 15, 2019, updated versions of the Messenger app will no longer support Open Graph Template. As a fallback, a generic template which links to the URL will be rendered. When a user clicks on the song that is shared in Messenger, the user will be directed to the audio streaming platform's website or app. Refer to June 10, 2019 Announcement.

The Open Graph template allows you to send a structured message with an Open Graph URL, plus an optional button. Currently, only sharing songs is supported. The song will appear in a bubble that allows the message recipient to see album art and preview the song.

Contents

Template Payload

For a complete list of template properties, see the Open Graph Template reference.

"payload": {
  "template_type":"open_graph",
  "elements":[
     {
      "url":"<OPEN_GRAPH_URL>",
      "buttons":[<BUTTON_OBJECT>]             
    }
  ]
}

Supported Open Graph Metadata

The URL you provide for the Open Graph template must provide Open Graph-formatted song details. The Messenger Platform will read the following metadata properties:

  • og:title
  • og:audio
  • music:musician
  • og:site_name
  • og:image.

Checking Webview Support

To share an Open Graph template from the Messenger webview with beginShareFlow(), you must first call getSupportedFeatures() and verify the sharing_open_graph feature is available.

Example Request

For complete request details and properties, see the Open Graph Template Reference.

curl -X POST -H "Content-Type: application/json" -d '{
  "recipient":{
    "id":"USER_ID"
  },
  "message":{
    "attachment":{
      "type":"template",
      "payload":{
        "template_type":"open_graph",
        "elements":[
           {
            "url":"https://open.spotify.com/track/7GhIk7Il098yCjg4BQjzvb",
            "buttons":[
              {
                "type":"web_url",
                "url":"https://en.wikipedia.org/wiki/Rickrolling",
                "title":"View More"
              }              
            ]      
          }
        ]
      }
    }
  }
}' "https://graph.facebook.com/v2.6/me/messages?access_token=PAGE_ACCESS_TOKEN"

Example Response

{
  "recipient_id": "1254477777772919",
  "message_id": "AG5Hz2Uq7tuwNEhXfYYKj8mJEM_QPpz5jdCK48PnKAjSdjfipqxqMvK8ma6AC8fplwlqLP_5cgXIbu7I3rBN0P"
}