MessengerEvent
rawEvent
Underlying raw event from Messenger.
Example:
event.rawEvent;
// {
// sender: { id: '1423587017700273' },
// recipient: { id: '404217156637689' },
// timestamp: 1491796363181,
// message: {
// mid: 'mid.$cAAE1UUyiiwthh0NPrVbVf4HFNDGl',
// seq: 348847,
// text: 'Awesome.',
// },
// }
isMessage
Determine if the event is a message event.
Example:
event.isMessage; // true
message
The message object from Messenger raw event.
Example:
event.message;
// {
// mid: 'mid.$cAAE1UUyiiwthh0NPrVbVf4HFNDGl',
// seq: 348847,
// text: 'Awesome.',
// }
isText
Determine if the event is a message event which includes text.
Example:
event.isText; // true
text
The text string from Messenger raw event.
Example:
event.text; // 'Awesome.'
hasAttachment
Determine if the event has any attachments.
Example:
event.hasAttachment; // true
attachments
The attachments array from Messenger raw event.
Example:
event.attachments;
// [
// {
// type: 'audio',
// payload: {
// url: 'https://example.com/bot/audios/audio.mp3',
// },
// },
// ]
isImage
Determine if the event is a message event which includes image attachment.
Example:
event.isImage; // true
image
The image attachment from Messenger raw event.
Example:
event.image;
// {
// url: 'https://example.com/image.jpg',
// }
isAudio
Determine if the event is a message event which includes audio attachment.
Example:
event.isAudio; // true
audio
The audio attachment from Messenger raw event.
Example:
event.audio;
// {
// url: 'https://example.com/bot/audios/audio.mp3',
// }
isVideo
Determine if the event is a message event which includes video attachment.
Example:
event.isVideo; // true
video
The video attachment from Messenger raw event.
Example:
event.video;
// {
// url: 'https://example.com/bot/videos/video.mp4',
// }
isLocation
Determine if the event is a message event which includes location attachment.
Example:
event.isLocation; // true
location
The location attachment from Messenger raw event.
Example:
event.location;
// {
// coordinates: { lat: 0, long: 0 },
// }
isFile
Determine if the event is a message event which includes file attachment.
Example:
event.isFile; // true
file
The file attachment from Messenger raw event.
Example:
event.file;
// {
// url: 'https://example.com/bot/files/file.doc',
// }
isFallback
Determine if the event is a message event which includes fallback attachment.
Example:
event.isFallback; // true
fallback
The fallback attachment from Messenger raw event.
Example:
event.fallback;
// {
// URL: 'URL_OF_THE_ATTACHMENT',
// payload: null,
// title: 'TITLE_OF_THE_URL_ATTACHMENT',
// type: 'fallback',
// }
isSticker
Determine if the event is a message event which includes sticker.
Example:
event.isSticker; // true
sticker
The stickerId from Messenger raw event.
Example:
event.sticker; // 369239263222822
isLikeSticker
Determine if the event is a message event which includes 'like' sticker.
Example:
event.isLikeSticker; // true
isQuickReply
Determine if the event is a message event triggered from quick reply.
Example:
event.isQuickReply; // true
quickReply
The quick reply object from Messenger raw event.
Example:
event.quickReply;
// {
// payload: 'DEVELOPER_DEFINED_PAYLOAD_FOR_PICKING_RED',
// }
isEcho
Determine if the event is a message event sent from our side.
Example:
event.isEcho; // true
isPostback
Determine if the event is a postback event.
Example:
event.isPostback; // true
postback
The postback object from Messenger raw event.
Example:
event.postback;
// {
// payload: 'USER_DEFINED_PAYLOAD',
// }
isGamePlay
Determine if the event is an game_play event.
Example:
event.isGamePlay; // true
gamePlay
The gamePlay object from Messenger raw event.
Example:
event.gamePlay;
// {
// gameId: 'GAME_ID',
// playerId: 'PLAYER_ID',
// contextType: 'SOLO',
// contextId: 'CONTEXT_ID',
// score: 99,
// payload: {
// someKey: 'SOME_VALUE'
// },
// }
isOptin
Determine if the event is an opt-in event.
Example:
event.isOptin; // true
optin
The optin object from Messenger raw event.
Example:
event.optin;
// {
// ref: 'PASS_THROUGH_PARAM',
// }
isPayment
Determine if the event is a payment event.
Example:
event.isPayment; // true
payment
The payment object from Messenger raw event.
Example:
event.payment;
// {
// payload: 'DEVELOPER_DEFINED_PAYLOAD',
// requestedUserInfo: {
// shippingAddress: {},
// contactName: 'Peter Chang',
// contactEmail: 'peter@anemail.com',
// contactPhone: '+15105551234',
// },
// paymentCredential: {
// providerType: 'paypal',
// chargeId: 'ch_18tmdBEoNIH3FPJHa60ep123',
// fbPaymentId: '123456789',
// },
// amount: {
// currency: 'USD',
// amount: '29.62',
// },
// shippingOptionId: '123',
// }
isCheckoutUpdate
Determine if the event is a checkout update event.
Example:
event.isCheckoutUpdate; // true
checkoutUpdate
The checkoutUpdate object from Messenger raw event.
Example:
event.checkoutUpdate;
// {
// payload: 'DEVELOPER_DEFINED_PAYLOAD',
// shippingAddress: {
// id: 10105655000959552,
// country: 'US',
// city: 'MENLO PARK',
// street1: '1 Hacker Way',
// street2: '',
// state: 'CA',
// postalCode: '94025',
// },
// }
isPreCheckout
Determine if the event is a pre-checkout event.
Example:
event.isPreCheckout; // true
preCheckout
The preCheckout object from Messenger raw event.
Example:
event.preCheckout;
// {
// payload: 'xyz',
// requestedUserInfo: {
// shippingAddress: {
// name: 'Tao Jiang',
// street1: '600 Edgewater Blvd',
// street2: '',
// city: 'Foster City',
// state: 'CA',
// country: 'US',
// postalCode: '94404',
// },
// contactName: 'Tao Jiang',
// },
// amount: {
// currency: 'USD',
// amount: '2.70',
// },
// }
isRead
Determine if the event is a message read event.
Example:
event.isRead; // true
read
The read object from Messenger raw event.
Example:
event.read;
// {
// seq: 38,
// watermark: 1458668856253,
// }
isDelivery
Determine if the event is a message delivery event.
Example:
event.isDelivery; // true
delivery
The delivery object from Messenger raw event.
Example:
event.delivery;
// {
// mids: ['mid.1458668856218:ed81099e15d3f4f233'],
// watermark: 1458668856253,
// seq: 37,
// }
isPayload
Determine if the event is a postback or quick reply which includes payload.
Example:
event.isPayload; // true
payload
The payload received from postback or quick reply.
Example:
event.payload; // 'USER_DEFINED_PAYLOAD'
isPolicyEnforcement
Determine if the event is a policy enforcement event.
Example:
event.isPolicyEnforcement; // true
policyEnforcement
The policy enforcement object from Messenger raw event.
Example:
event.policyEnforcement;
// {
// action: 'block',
// reason:
// 'The bot violated our Platform Policies (https://developers.facebook.com/policy/#messengerplatform). Common violations include sending out excessive spammy messages or being non-functional.',
// }
isAppRoles
Determine if the event is an app roles event.
Example:
event.isAppRoles; // true
appRoles
The app roles object from Messenger raw event.
Example:
event.appRoles;
// {
// '123456789': ['automation'],
// }
isStandby
Determine if the event is a standby event.
Example:
event.isStandby; // true
isPassThreadControl
Determine if the event is a pass thread control event.
Example:
event.isPassThreadControl; // true
passThreadControl
The pass thread control object from Messenger raw event.
Example:
event.passThreadControl;
// {
// metadata: 'additional content that the caller wants to set',
// newOwnerAppId: '123456789',
// }
isTakeThreadControl
Determine if the event is a take thread control event.
Example:
event.isTakeThreadControl; // true
takeThreadControl
The take thread control object from Messenger raw event.
Example:
event.takeThreadControl;
// {
// metadata: 'additional content that the caller wants to set',
// previousOwnerAppId: '123456789',
// }
isRequestThreadControl
Determine if the event is a request thread control event.
Example:
event.isRequestThreadControl; // true
requestThreadControl
The take thread control object from Messenger raw event.
Example:
event.requestThreadControl;
// {
// metadata: 'additional content that the caller wants to set',
// requestedOwnerAppId: '123456789',
// }
isReferral
Determine if the event is a referral event.
Example:
event.isReferral; // true
referral
The referral object from Messenger event.
Example:
event.referral;
// {
// ref: 'PASS_THROUGH_PARAM',
// source: 'SHORTLINK',
// type: 'OPEN_THREAD',
// }
ref
The ref string from Messenger event.
Example:
event.ref; // 'PASS_THROUGH_PARAM'
isFromCustomerChatPlugin
Determine if the event is from customer chat plugin.
Example:
event.isFromCustomerChatPlugin; // true
isBrandedCamera
Determine if the event is a branded_camera event.
Example:
event.isBrandedCamera; // true
brandedCamera
The brandedCamera object from Messenger event.
Example:
event.brandedCamera;
// {
// contentIds: ['<CAMERA-EFFECT-ID>', '<CAMERA-EFFECT-ID>'],
// event: 'dismiss',
// }