Stella Platform Documentation

Stella Platform Documentation

  • 文档
  • 标准设置程序
  • 参考
  • 常见问题
  • Bot API
  • 接口
  • Languages icon中文
    • English

›参考

开始使用

  • Introduction

参考

  • Message Event
  • Node
  • Member
  • Channel
  • Integrations
  • Agenda Meta
  • Group
  • Methods
  • Radiate.js
  • Access Control List
  • Stella Open API

Message Event

当会员发送消息或文件、点击按钮或与聊天机器人互动时,将向Stella发送一个消息事件。this.messageEvent是一个代表会员行动的对象。消息事件对象在不同的平台上略有不同。this.messageEvent.type和this.messageEvent.data对所有平台都是通用的,包含了大多数常见使用情况的信息。

我们可以使用这些信息来确定用户移动到哪个节点(见触发器/条件),并保存用户对聊天机器人问题的回答(见动作)。

例子:

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

脸书

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

在Slack中,有3个不同的webhook事件,将组成不同的messageEvent对象。

斜线命令网络钩子

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

行动网络钩子

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

事件网络钩子

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...

← IntroductionNode →
  • 脸书
  • Slack
    • 斜线命令网络钩子
    • 行动网络钩子
    • 事件网络钩子
  • Teamwork
  • WhatsApp
  • Web Chat
  • WeChat
Stella Platform Documentation
Docs
Get StartedBot API ReferenceAPI ReferenceStandard Procedures
Community
FAQUser ShowcaseChat with Us
Copyright © 2023 Sanuker Inc. Limited