diff --git a/docs/readme-facebook.md b/docs/readme-facebook.md index df829a6c1..b6c75aea8 100644 --- a/docs/readme-facebook.md +++ b/docs/readme-facebook.md @@ -304,6 +304,7 @@ bot.reply(message, reply_message) 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. +- Get Static Codes : ```javascript controller.api.messenger_profile.get_messenger_code(2000, function (err, url) { if(err) { @@ -314,6 +315,17 @@ controller.api.messenger_profile.get_messenger_code(2000, function (err, url) { }); ``` +- Get Parametric Codes : +```javascript +controller.api.messenger_profile.get_messenger_code(2000, function (err, url) { + if(err) { + // Error + } else { + // url + } +}, 'billboard-ad'); +``` + ## Thread Settings API Thread settings API is now messenger profile API, it's highly recommended to use profile API instead of thread settings one, however, Botkit thread settings interface still available : diff --git a/lib/Facebook.js b/lib/Facebook.js index 49b6c6f74..ea64d30e6 100644 --- a/lib/Facebook.js +++ b/lib/Facebook.js @@ -556,11 +556,16 @@ function Facebookbot(configuration) { } }); }, - get_messenger_code: function(image_size, cb) { + get_messenger_code: function(image_size, cb, ref) { var message = { 'type': 'standard', 'image_size': image_size || 1000 }; + + if(ref) { + message.data = {'ref': ref}; + } + request.post('https://graph.facebook.com/v2.6/me/messenger_codes?access_token=' + configuration.access_token, {form: message}, function(err, res, body) {