Message Event
When a member sends messages or files, clicks buttons or interacts with the chatbot, a message event will be sent to Stella. 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"
| Property | Type | Description |
|---|---|---|
| data | object | Message data |
| from | string | PSID of the user |
| messageId | string | Optional Message ID |
| origin | string | Optional Message origin. Values include: CUSTOMER_CHAT_PLUGIN, and MESSENGER |
| timestamp | number | Time of update (epoch time in milliseconds) |
| to | string | Page ID |
| type | string | Message 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
| Property | Type | Description |
|---|---|---|
| accountLinking | object | ACCOUNT_LINKING. Information about the link account or unlink account are clicked |
| app_id | string | ECHO TYPE ONLY. ID of the app from which the message was sent |
| appRoles | object | APP_ROLES TYPE ONLY. Contains Page ID |
| attachments | array<object> | Available only when there is an attachment |
| delivery | object | DELIVERY TYPE ONLY. Information about delivered message of a Facebook page |
| metadata | string | ECHO TYPE ONLY. Custom string |
| passThreadControl | object | PASS_THREAD_CONTROL TYPE ONLY. Information about passing the control of one conversation from one app to another |
| payload | string | PAYLOAD TYPE ONLY. Custom data provided by the app |
| policyEnforcement | object | POLICY_ENFORCEMENT TYPE ONLY. Information about policy enforcement |
| referral | object | PAYLOAD AND REFERRAL TYPE ONLY. Referral information. |
| requestThreadControl | object | REQUEST_THREAD_CONTROL TYPE ONLY. Information about requesting control of one conversation of one app |
| read | object | READ TYPE ONLY. Information about read message of a Facebook page |
| takeThreadControl | object | TAKE_THREAD_CONTROL ONLY. Information about taking control of one conversation from a secondary app |
| text | string | TEXT TYPE ONLY. Message text |
| title | string | Title of the call-to-action button |
attachment object
| Property | Type | Description |
|---|---|---|
| type | string | Attachment type. Values include IMAGE, VIDEO, AUDIO, LOCATION, FILE, FALLBACK, and TEMPLATE |
| url | string | Attachment 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
| Property | Type | Description |
|---|---|---|
| data | object | Message content |
| from | string | Sender ID |
| response_url | string | URL can be used to post responses to dialog submissions |
| teamId | string | Slack team ID |
| timestamp | number | Time of update (epoch time in milliseconds) |
| to | Slack channel ID | |
| type | string | Slack event type |
data object
| Property | Type | Description |
|---|---|---|
| payload | string | Slash event command |
| text | string | Message text content |
Action webhook
| Property | Type | Description |
|---|---|---|
| data | object | Message content |
| from | string | Sender ID |
| response_url | string | URL can be used to post responses to dialog submissions |
| teamId | string | Slack team ID |
| timestamp | number | Time of update (epoch time in milliseconds) |
| to | Slack channel ID | |
| type | string | Slack event type |
data object
| Property | Type | Description |
|---|---|---|
| callback_id | string | An identifier strictly for you to recognize submissions of this conversation |
| originalMessage | string | Message text content |
| payload | string | If there is a JSON value of in the first action, it is a Javascript object. Otherwise, it will return the original value. |
| trigger_id | string | Short-lived pointer, which expired in 3 seconds, to interaction's who, what, where, and when |
Event webhook
| Property | Type | Description |
|---|---|---|
| bot_id | string | Optional Slack bot ID |
| data | object | Message content |
| event | object | Message event in a more detailed manner |
| from | string | (bot_id AND isBot) Slack bot ID (default) sender ID |
| isBot | boolean | Optional Status of whether the conversation is conducted by bot |
| teamId | string | Slack team ID |
| timestamp | number | Time of update (epoch time in milliseconds) |
| to | string | Slack channel ID |
| type | string | Message type. Values include: TEXT, MISC, IMAGE |
data object
| Property | Type | Description |
|---|---|---|
| attachments | object | Attachment information inside data |
| text | string | Message text content |
attachments object
| Property | Type | Description |
|---|---|---|
| downloadUrl | string | Download URL of the file |
| type | string | Attachment type. Values include: IMAGE, VIDEO, FILE, and TEXT |
event object
| Property | Type | Description |
|---|---|---|
| subtype | string | Message subtype. Values include bot_message and file_share |
Teamwork
Coming soon...
| Property | Type | Description |
|---|---|---|
| data | object | Message data |
| from | string | WhatsApp ID of the sender of the original message |
| mentions | array<string> | List of mentioned IDs |
| timestamp | number | Time of update (epoch time in milliseconds) |
| to | string | WhatsApp ID of the receiver of the original message |
| type | string | Message type. Values include: TEXT, MISC, and SYSTEM |
data object
| Property | Type | Description |
|---|---|---|
| attachments | array<object> | Message attachments. This field will not be available when the type of the message is TEXT or SYSTEM |
| system | object | System message information. Please see the Facebook documentation for further reference |
| text | string | Message text content. This field is available only the message type is TEXT |
attachements object
| Property | Type | Description |
|---|---|---|
| caption | string | Caption of the attachment |
| opus | boolean | Audio format. Available only for the 1st item in the attachments array |
| type | string | Attachment type. Values include: IMAGE, VIDEO, AUDIO, and FILE |
| waMediaId | string | WhatsApp media ID |
Web Chat
| Property | Type | Description |
|---|---|---|
| data | object | Message data |
| from | string | User ID |
| messageId | string | Optional Message ID |
| timestamp | number | Time of update (epoch time in milliseconds) |
| to | string | Bot ID, in webchat, this is usually channel ID |
| type | string | Message type. Values include TEXT, PAYLOAD, MISC , WEB_ACTION. |
data object
| Property | Type | Description |
|---|---|---|
| text | string | Message text content |
| payload | string | PAYLOAD TYPE ONLY. Custom data provided by the app |
| attachments | array<object> | Available only when there is an attachment |
attachment object
| Property | Type | Description |
|---|---|---|
| type | string | Attachment type. Values include IMAGE, VIDEO, AUDIO, FILE |
| url | string | Attachment URL. Available only on IMAGE, VIDEO, AUDIO, and FILE type. |
Coming soon...
