To use the Messenger Code API, the Graph API version must be set to version 2.6 or greater in the request.
The Messenger Codes API allows you to programmatically generate Messenger Codes that pass custom ref
parameters to your bot when a person scans the code. You might use this to track which codes are getting scanned the most, or activate different functionality based on which code was scanned.
All Facebook Pages have a default Messenger Code that opens their bot in Messenger without any special refs
. Your default code is available in the Page admin tool or in the Pages Manager app.
For complete usage details, see Messenger Codes.
https://graph.facebook.com/v2.6/me/messenger_codes?access_token=<ACCESS_TOKEN>
curl -X POST -H "Content-Type: application/json" -d '{
"type": "standard",
"data": {
"ref":"billboard-ad"
},
"image_size": 1000
}' "https://graph.facebook.com/v2.6/me/messenger_codes?access_token=<ACCESS_TOKEN>"
The download URL is not permanent. You should download and cache the image as soon as possible.
{
"uri": "<YOUR_CODE_URL_HERE>"
}
Property | Type | Description |
---|---|---|
| String | Must be set to |
| Integer | Optional. The size, in pixels, for the image you are requesting. Supported range: 100-2000 px. Defaults to 1000px. |
| Object | Optional. Contains the |
| String | Optional. The ref string to pass to your bot is opened via the code. Max 250 characters. Valid characters: |