Skip to main content

Message Event

When a member sends messages or files, clicks buttons or interacts with the chatbot, a message event will be sent to WOZTELL. this.messageEvent is an object representing the action of the member. The message event object is slightly different for different platforms. this.messageEvent.type and this.messageEvent.data are common for all platforms, and contain information for most common use cases.

We can use the information to determine which node the user is moving to (see triggers/conditions), and to save users’ answers to chatbot questions (see actions).

Example:

this.messageEvent.data.text
// => "TEXT"

Facebook

PropertyTypeDescription
dataobjectMessage data
fromstringPSID of the user
messageIdstringOptional Message ID
originstringOptional Message origin. Values include: CUSTOMER_CHAT_PLUGIN, and MESSENGER
timestampnumberTime of update (epoch time in milliseconds)
tostringPage ID
typestringMessage type. Values include TEXT, PAYLOAD, REFERRAL, DELIVERY, ECHO, READ, OPTIN, ACCOUNT_LINKING, PASS_THREAD_CONTROL, REQUEST_THREAD_CONTROL, TAKE_THREAD_CONTROL, APP_ROLES, POLICY_ENFORCEMENT, and MISC.

For further reference of type TEXT, PAYLOAD, REFERRAL, DELIVERY, ECHO, READ, OPTIN, ACCOUNT_LINKING, POLICY_ENFORCEMENT and MISC, please see the Facebook documentation.

For further reference of type PASS_THREAD_CONTROL, REQUEST_THREAD_CONTROL, TAKE_THREAD_CONTROL, APP_ROLES, please see the Facebook documentation.

data object

PropertyTypeDescription
accountLinkingobjectACCOUNT_LINKING. Information about the link account or unlink account are clicked
app_idstringECHO TYPE ONLY. ID of the app from which the message was sent
appRolesobjectAPP_ROLES TYPE ONLY. Contains Page ID
attachmentsarray<object>Available only when there is an attachment
deliveryobjectDELIVERY TYPE ONLY. Information about delivered message of a Facebook page
metadatastringECHO TYPE ONLY. Custom string
passThreadControlobjectPASS_THREAD_CONTROL TYPE ONLY. Information about passing the control of one conversation from one app to another
payloadstringPAYLOAD TYPE ONLY. Custom data provided by the app
policyEnforcementobjectPOLICY_ENFORCEMENT TYPE ONLY. Information about policy enforcement
referralobjectPAYLOAD AND REFERRAL TYPE ONLY. Referral information.
requestThreadControlobjectREQUEST_THREAD_CONTROL TYPE ONLY. Information about requesting control of one conversation of one app
readobjectREAD TYPE ONLY. Information about read message of a Facebook page
takeThreadControlobjectTAKE_THREAD_CONTROL ONLY. Information about taking control of one conversation from a secondary app
textstringTEXT TYPE ONLY. Message text
titlestringTitle of the call-to-action button

attachment object

PropertyTypeDescription
typestringAttachment type. Values include IMAGE, VIDEO, AUDIO, LOCATION, FILE, FALLBACK, and TEMPLATE
urlstringAttachment URL. Available only on IMAGE, VIDEO, AUDIO, and FILE type.

Slack

In Slack, there are 3 different webhook events and will compose different messageEvent objects.

Slash command webhook

PropertyTypeDescription
dataobjectMessage content
fromstringSender ID
response_urlstringURL can be used to post responses to dialog submissions
teamIdstringSlack team ID
timestampnumberTime of update (epoch time in milliseconds)
toSlack channel ID
typestringSlack event type

data object

PropertyTypeDescription
payloadstringSlash event command
textstringMessage text content

Action webhook

PropertyTypeDescription
dataobjectMessage content
fromstringSender ID
response_urlstringURL can be used to post responses to dialog submissions
teamIdstringSlack team ID
timestampnumberTime of update (epoch time in milliseconds)
toSlack channel ID
typestringSlack event type

data object

PropertyTypeDescription
callback_idstringAn identifier strictly for you to recognize submissions of this conversation
originalMessagestringMessage text content
payloadstringIf there is a JSON value of in the first action, it is a Javascript object. Otherwise, it will return the original value.
trigger_idstringShort-lived pointer, which expired in 3 seconds, to interaction's who, what, where, and when

Event webhook

PropertyTypeDescription
bot_idstringOptional Slack bot ID
dataobjectMessage content
eventobjectMessage event in a more detailed manner
fromstring(bot_id AND isBot) Slack bot ID
(default) sender ID
isBotbooleanOptional Status of whether the conversation is conducted by bot
teamIdstringSlack team ID
timestampnumberTime of update (epoch time in milliseconds)
tostringSlack channel ID
typestringMessage type. Values include: TEXT, MISC, IMAGE

data object

PropertyTypeDescription
attachmentsobjectAttachment information inside data
textstringMessage text content

attachments object

PropertyTypeDescription
downloadUrlstringDownload URL of the file
typestringAttachment type. Values include: IMAGE, VIDEO, FILE, and TEXT

event object

PropertyTypeDescription
subtypestringMessage subtype. Values include bot_message and file_share

Teamwork

Coming soon...

WhatsApp

PropertyTypeDescription
dataobjectMessage data
fromstringWhatsApp ID of the sender of the original message
mentionsarray<string>List of mentioned IDs
timestampnumberTime of update (epoch time in milliseconds)
tostringWhatsApp ID of the receiver of the original message
typestringMessage type. Values include: TEXT, MISC, and SYSTEM

data object

PropertyTypeDescription
attachmentsarray<object>Message attachments. This field will not be available when the type of the message is TEXT or SYSTEM
systemobjectSystem message information. Please see the Facebook documentation for further reference
textstringMessage text content. This field is available only the message type is TEXT

attachements object

PropertyTypeDescription
captionstringCaption of the attachment
opusbooleanAudio format. Available only for the 1st item in the attachments array
typestringAttachment type. Values include: IMAGE, VIDEO, AUDIO, and FILE
waMediaIdstringWhatsApp media ID

Web Chat

PropertyTypeDescription
dataobjectMessage data
fromstringUser ID
messageIdstringOptional Message ID
timestampnumberTime of update (epoch time in milliseconds)
tostringBot ID, in webchat, this is usually channel ID
typestringMessage type. Values include TEXT, PAYLOAD, MISC , WEB_ACTION.

data object

PropertyTypeDescription
textstringMessage text content
payloadstringPAYLOAD TYPE ONLY. Custom data provided by the app
attachmentsarray<object>Available only when there is an attachment

attachment object

PropertyTypeDescription
typestringAttachment type. Values include IMAGE, VIDEO, AUDIO, FILE
urlstringAttachment URL. Available only on IMAGE, VIDEO, AUDIO, and FILE type.

WeChat

Coming soon...