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

Add Facebook Handover Protocol #978

Merged

Conversation

ouadie-lahdioui
Copy link
Collaborator

@ouadie-lahdioui ouadie-lahdioui commented Sep 3, 2017

Hello

This PR add FB Messenger handover protocol that enables two or more applications to collaborate on the Messenger platform for a page.

Enjoy ...

@jonchurch
Copy link
Contributor

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

lib/Facebook.js Outdated
cb && cb(body)
} else {
facebook_botkit.debug('Successfully pass thread control', body);
cb && cb(null, body);
Copy link

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Copy link

@t-lopes t-lopes left a 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

@deubaka
Copy link
Contributor

deubaka commented Dec 6, 2017

Any updates on this? Interested as to not duplicate effort. :)

@ouadie-lahdioui
Copy link
Collaborator Author

@deubaka I'll work on it today.

@ouadie-lahdioui ouadie-lahdioui force-pushed the feature/facebookHandoverProtocol branch 2 times, most recently from e621a04 to a68642e Compare December 16, 2017 23:46
message.type = 'standby'
}
if (message.pass_thread_control) {
message.type = 'facebook_receive_thread_control'
Copy link

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

Copy link
Collaborator Author

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 ?

@benbrown benbrown merged commit b8029ba into howdyai:master Jan 18, 2018
@ouadie-lahdioui ouadie-lahdioui deleted the feature/facebookHandoverProtocol branch January 19, 2018 10: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.

6 participants