-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Add Facebook Handover Protocol #978
Add Facebook Handover Protocol #978
Conversation
Conflicts: lib/Facebook.js
Just submitted a PR to your fork @ouadie-lahdioui to bring this up to v0.6 compatibility Awesome work though btw! FB keeps pumping out new Webhook events like crazy these days haha |
Conflicts: lib/Facebook.js
Fixes for Botkit v0.6
lib/Facebook.js
Outdated
cb && cb(body) | ||
} else { | ||
facebook_botkit.debug('Successfully pass thread control', body); | ||
cb && cb(null, body); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like some code is missing here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lib/Facebook.js
has parsing errors
Any updates on this? Interested as to not duplicate effort. :) |
@deubaka I'll work on it today. |
e621a04
to
a68642e
Compare
a68642e
to
b8029ba
Compare
message.type = 'standby' | ||
} | ||
if (message.pass_thread_control) { | ||
message.type = 'facebook_receive_thread_control' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't be the opposite?
message.pass_thread_control => facebook_lose_thread_control
message.take_thread_control => facebook_receive_thread_control
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pass_thread_control callback will occur when thread ownership for a user has been passed to your application, So, in botkit y'll be able to catche that like that :
controller.hears('facebook_receive_thread_control', 'message_received', function(bot, message) {
/* your bot has received the thread ownership */
});
However, take_thread_control will occur when thread ownership for a user has been taken away from your application, to catche that :
controller.hears('facebook_lose_thread_control', 'message_received', function(bot, message) {
/* thread ownership for a user has been taken away */
});
@t-lopes WDYT ?
Hello
This PR add FB Messenger handover protocol that enables two or more applications to collaborate on the Messenger platform for a page.
Enjoy ...