Messenger Code API (New)

Messenger Codes can be scanned in Messenger to instantly link the user to your bot, no typing needed. They're great for sticking on fliers, ads, or anywhere in the real world where you want people to try your bot.

All owners of Facebook pages can find their page's Messenger Code using the page admin tool.

Beyond this, there may be situations where you wish to programmatically get your bot's Messenger Code. For instance, if you were building a bot that managed messaging for many different kinds of pages, and you wanted to make it easier for your customers to find their code, you might request one on behalf of them and display it in a prominent place in your interface. For these situations, we provide the Messenger Code API.

Calling the API

Calling this API requires an access token for the page.

curl -X POST -H "Content-Type: application/json" -d '{
  "type": "standard",
  "image_size": 1000
}' "https://graph.facebook.com/v2.6/me/messenger_codes?access_token=<ACCESS_TOKEN>" 

Parameters

Name Description Required

type

Must be "standard"

Y

image_size

The size, in pixels, for the image you are requesting. Supported range: 100-2000 px, defaults to 1000px.

N

Response

{ 
  "uri": "YOUR_CODE_URL_HERE"
}
Name Description

uri

The URI that you can download your Messenger Code at. This is not a permanent URI; you should download and cache the image as soon as possible.