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

Add Messenger code API #689

Merged
merged 2 commits into from
Mar 17, 2017
Merged

Conversation

ouadie-lahdioui
Copy link
Collaborator

Hello,

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.

This PR add the ability to programmatically get your bot's Messenger Code.

Enjoy,

@jonchurch
Copy link
Contributor

jonchurch commented Mar 6, 2017

👏👏👏
This is awesome! Didn't even realize this api call existed, is it new?

I'm maintaining a Botkit fork right now that supports many pages at once, and so I've been slowly removing all bot identity config (like access_token and studio token) from the controller config.
So I'd rewrite this immediately to be scoped to the bot, I might be an edge case, not sure how often people are using bots that are unconfigured/generic these days.

Personally I would add this to the bot object, and get at the access_token like so:

// lib/Facebook.js 
bot.get_messenger_code = function(image_size, cb) {
     var message = {
         'type': 'standard',
         'image_size': image_size || 1000
     };
request.post('https://graph.facebook.com/v2.6/me/messenger_codes?access_token=' + configuration.access_token || this.config.access_token, {
             form: message
         },

What do y'all think? I think this is a great feature regardless of where it lives.

@ouadie-lahdioui
Copy link
Collaborator Author

Yoo @jonchurch,

yes it's new, Facebook maked some changes last thursday (2 march) on messenger version 1.4, Among the changes announced (Messenger Profile API #690 and Messenger Code API #689) and many other cool stuff !

Glad you liked it 😄

Just out of curiosity, why you needed one bot that supports many pages at once ?

in this case you need to call get_messenger_code as mush as the number of your pages.

@jonchurch
Copy link
Contributor

jonchurch commented Mar 7, 2017 via email

@jonchurch
Copy link
Contributor

jonchurch commented Mar 7, 2017 via email

@ouadie-lahdioui
Copy link
Collaborator Author

Interesting, thank you for sharing your use case here.

@benbrown benbrown merged commit 4f4fcc1 into howdyai:master Mar 17, 2017
@ouadie-lahdioui ouadie-lahdioui deleted the messengerCodeAPI branch March 17, 2017 16:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants