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

Radiate.js

你可以利用Radiate.js,在你的网络和网络聊天之间建立不同的互动关系。

init

用提供的参数初始化网络聊天插件。

Radiate.init(CHANNEL_ID, CHANNEL_TOKEN, options)

Parameters

NameTypeDescription
CHANNEL_IDstringCan be found in the Stella channel
CHANNEL_TOKENstringCan be found in the Stella channel
optionsobjectoptional

Options

NameTypeDescription
notReadyIconUrlstringImage URL to customise the icon shown when there is network connction issue with our web chat server
notReadyTextstringCustom text when there is network connction issue with our web chat server
localestringSet the initial locale of the user, this should be one of your locale group name on Stella
greetingsstringCustome text displayed next to the icon before the icon is clicked
defaultOpenbooleanControl if the messenger frame should be opened when web chat successfully initilized. Default is false
refstringFor passing custom data with the GET_STARTED payload when user click the Get Started Button and talk to the chat bot for the first time

Example

Radiate.init("CHANNEL_ID", "CHANNEL_TOKEN", {
  notReadyIconUrl: "https://s3-ap-southeast-1.amazonaws.com/daydaybot-sanuker/sanuker-bot/sanuker-logo-only-s.png",
  notReadyText: "Working hard now...",
  locale: "english",
  greetings: "Chat with us!",
  defaultOpen: true
})


Example Greetings

subscribe

你可以使用subscribe来监听某些网络聊天事件。

Radiate.subscribe(EVENT_NAME, callback)

Parameters

NameTypeDescription
EVENT_NAMEstringCan be one of the following values: WEB_ACTION, READY, OPEN_WEBCHAT, CLOSE_WEBCHAT
callbackfunctionCallback function with the event object as a parameter

WEB_ACTION

当聊天机器人发出WEB_ACTION响应时,会发出WEB_ACTION事件。

event properties

NameTypeDescription
eventstringWEB_ACTION
dataobjectall the custom properties that you defined in your Stella response
fromstringBot ID, in web chat, this is usually the channel ID
tostringUser ID
timestampnumberTime of update (epoch time in milliseconds)

READY

READY事件将在网络聊天插件的初始化完成后发送。

event properties

NameTypeDescription
eventstringREADY

OPEN_WEBCHAT

当信使框架被打开时,OPEN_WEBCHAT事件将被发送。

event properties

NameTypeDescription
eventstringOPEN_WEBCHAT

CLOSE_WEBCHAT

CLOSE_WEBCHAT事件将在信使框架被关闭时发送。

event properties

NameTypeDescription
eventstringCLOSE_WEBCHAT


sendEvent

当用户在您的网页上做任何动作时,您可以利用sendEvent与网页聊天插件互动,如打开或关闭网页聊天,或向Stella发送事件以触发聊天机器人流程。

Radiate.sendEvent(EVENT_NAME, data, options)

Parameters

NameTypeDescription
EVENT_NAMEstringCan be one of the following values: WEB_EVENT, OPEN_WEBCHAT, CLOSE_WEBCHAT
datastring / objectoptional
optionsobjectoptional

WEB_EVENT

WEB_EVENT 可用于向Stella发送自定义数据以触发聊天机器人对话。

例子

Radiate.sendEvent("WEB_EVENT", {
  payload: "SOME_PAYLOAD",
  selectedOption: "OPTION_A"
}, {
  openMessenger: true
})

Parameters

NameTypeDescription
datastring / objectCustom defined JSON data to send to Stella
optionsobjectoptional

Options

NameTypeDescription
openMessengerbooleanTo control whether the messenger frame should be opened upon sending the event. Default is false

OPEN_WEBCHAT

打开信使框架的事件。

例子

Radiate.sendEvent("OPEN_WEBCHAT")

CLOSE_WEBCHAT

Event for closing the messenger frame.

Example

Radiate.sendEvent("CLOSE_WEBCHAT")
← MethodsAccess Control List →
  • init
  • subscribe
    • WEB_ACTION
    • READY
    • OPEN_WEBCHAT
    • CLOSE_WEBCHAT
  • sendEvent
    • WEB_EVENT
    • OPEN_WEBCHAT
    • CLOSE_WEBCHAT
Stella Platform Documentation
Docs
Get StartedBot API ReferenceAPI ReferenceStandard Procedures
Community
FAQUser ShowcaseChat with Us
Copyright © 2023 Sanuker Inc. Limited