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

Commit

Permalink
fix bug when using Facebook Checkbox Plugin the message.sender.id is …
Browse files Browse the repository at this point in the history
…not present. fix #834
  • Loading branch information
shmuelgutman committed Oct 21, 2017
1 parent f6e77b2 commit ccc5850
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/Facebook.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,11 @@ function Facebookbot(configuration) {
// handle normal messages from users (text, stickers, files, etc count!)
facebook_botkit.middleware.normalize.use(function normalizeMessage(bot, message, next) {

// in case of Checkbox Plug-in sender.id is not present, instead we should look at optin.user_ref
if(!message.sender && message.optin && message.optin.user_ref){
message.sender = {id: message.optin.user_ref};
}

// capture the user ID
message.user = message.sender.id;

Expand Down

0 comments on commit ccc5850

Please sign in to comment.