Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #790 from ouadie-lahdioui/faceBookParametricCodes
Browse files Browse the repository at this point in the history
Add FaceBook parametric codes
  • Loading branch information
Ben Brown authored Apr 26, 2017
2 parents 0fbad25 + ff7c4e1 commit 3909f10
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
12 changes: 12 additions & 0 deletions docs/readme-facebook.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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 :
Expand Down
7 changes: 6 additions & 1 deletion lib/Facebook.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 3909f10

Please sign in to comment.