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

fix bug when using Facebook Checkbox Plugin the message.sender.id is … #1101

Merged
merged 1 commit into from
Jan 18, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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