Messenger Codes

On July 29, 2019 we deprecated the Messenger codes endpoint for V4.0 and will be removing it for all versions on October 29, 2019

Starting August 15 2019, The Messenger camera will no longer support scanning Messenger Codes.

As an alternative, we recommend businesses take advantage of the phone's native capabilities to scan QR codes with links. See QR Codes on links

Messenger Codes can be scanned 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.

You can get a Messenger Code for your Page using the Messenger Code API.


Generating a static code

Getting the static Messenger Code is useful if you're running a tool that manages messaging on behalf of many different pages. In such a situation, you might want to request a code on behalf of your client and display it in a prominent place in the UI your customers see.

For a complete list of request properties, see the Messenger Code API reference.

curl -X POST -H "Content-Type: application/json" -d '{
  "type": "standard",
  "image_size": 1000

Generating a parametric code

Developers can also arbitrarily generate codes to pass different ref parameters to the same bot. You might use this to track which codes are getting scanned the most. A bot could even activate different functionality based on which code was scanned. For instance, a restaurant could put a different code on a each table to pass along to the bot where food should be delivered.

You can watch for users scanning parametric codes in the postback and referral webhook events.

For a complete list of request properties, see the Messenger Code API reference.

curl -X POST -H "Content-Type: application/json" -d '{
  "type": "standard",
  "data": {
  "image_size": 1000

API Response

The Messenger Code API will respond with a URI you can download your Messenger Code at.

This is not a permanent URI; you should download and cache the image as soon as possible.

  "uri": "<YOUR_CODE_URL_HERE>"

Scanning Messenger Codes

To scan a Messenger Code, do the following:

  1. Activate the Messenger camera.
  2. Press and hold in the viewfinder. A circle will appear.
  3. Center the Messenger Code in the circle. Messenger will automatically scan the code.

Responding to Scans

After generating a parametric code, you should watch for the ref parameter in two places:

  • If the user is entering the bot for the first time, the postback webhook will be called.

  • If the user is re-entering the bot by scanning the code, the referral webhook will be called.