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

botkit doesn't handle the facebook checkbox plugin callback #834

Closed
nishch opened this issue May 8, 2017 · 1 comment · Fixed by #1101
Closed

botkit doesn't handle the facebook checkbox plugin callback #834

nishch opened this issue May 8, 2017 · 1 comment · Fixed by #1101

Comments

@nishch
Copy link
Contributor

nishch commented May 8, 2017

Facebook has two ways to let users of your web apps, opt in to receive messages, via "checkbox plugin" and "send to messenger". Payload received for these two in the subscribed webhook is different, in case of "checkbox plugin", facebook does not send the sender id rather it sends the user_ref inside optin node.

Currently botkit handles the "send to messenger" plugin correctly but breaks for "checkbox plugin" as shown in the following stack trace:

TypeError: Cannot read property 'id' of undefined
    at Object.__dirname.Facebookbot.facebook_botkit.handleWebhookPayload (/home/nishant/work/orange/notifier/node_modules/botkit/lib/Facebook.js:320:58)
    at /home/nishant/work/orange/notifier/node_modules/botkit/lib/Facebook.js:241:29
@jonchurch
Copy link
Contributor

jonchurch commented Jun 23, 2017

Here are the FB docs for this: Link

The issue within botkit is that the optin event grabs the user id from the sender field, which is not present in Checkbox plugin webhook events.

ALSO! The user_id that is passed back is a "unique ref" and not the actual PSID, it can be used to message a user, but the outgoing message signature will look a lil different. Instead of sender.id it wants sender.user_ref and then that call to the send api will return the actual user PSID...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants