1.7.1 • Published 3 years ago

jarvis-js-sdk v1.7.1

Weekly downloads
60
License
ISC
Repository
gitlab
Last release
3 years ago

Classes

Typedefs

Client

Kind: global class

new Client(handler, options)

构造函数

ParamTypeDescription
handlerObject回调函数入口
handler.onOpenOnOpenWebSocket建立成功回调函数
handler.onCloseOnCloseWebSocket关闭回调函数
handler.onErrorOnErrorWebSocket错误回调函数
handler.onMessageOnMessage收到消息回调函数
handler.onConversationBuiltOnConversationBuilt会话建立回调函数
handler.onConversationClosedOnConversationClosed会话关闭回调函数
handler.onMessageRecallOnMessageRecall消息被撤回回调函数
handler.onManualServiceStartOnManualServiceStart人工会话建立回调函数
handler.onStaffBusyOnStaffBusy客服繁忙回调函数
handler.onStaffOfflineOnStaffOffline客服不在线回调函数
handler.onMultipleLoginOnMultipleLogin多端登录回调函数
handler.onConversationTransferOnConversationTransfer会话转接回调函数
optionsObject参数
options.tokenstringToken
options.subChannelIdnumber子渠道ID
options.debugboolean开启调试模式
options.retryboolean请求重试

client.open()

打开WebSocket连接

Kind: instance method of Client

client.close()

关闭WebSocket连接

Kind: instance method of Client

client.isOpened() ⇒ boolean

WebSocket是否已开启

Kind: instance method of Client

client.isConnecting() ⇒ boolean

WebSocket是否正在连接

Kind: instance method of Client

client.buildMessage(messageType, content, conversationId) ⇒ Message

构造一条Message

Kind: instance method of Client

ParamTypeDescription
messageTypeMessageType消息类型
contentstring | Object内容,文本消息为string,其他消息为Object,包含url,filename等信息
conversationIdnumber消息所在会话的ID

client.sendMessage(message, toId) ⇒ Promise

发送消息

Kind: instance method of Client
Returns: Promise - 当消息发送成功时resolve

ParamTypeDescription
messageMessage消息,通过buildMessage创建
toIdnumber目标ID

client.recallMessage(messageId) ⇒ Promise

撤回消息

Kind: instance method of Client

ParamTypeDescription
messageIdnumber消息ID

client.readMessage(messageId) ⇒ Promise

消息已读

Kind: instance method of Client

ParamTypeDescription
messageIdnumber消息ID

client.closeConversation(conversationId) ⇒ Promise

关闭会话

Kind: instance method of Client

ParamTypeDescription
conversationIdnumber会话ID

client.inviteRate(userId) ⇒ Promise

邀评,仅供客服调用

Kind: instance method of Client

ParamTypeDescription
userIdnumber用户ID

client.selectMenuItem(menuItemId) ⇒ Promise

点选菜单项,仅供客户调用

Kind: instance method of Client

ParamType
menuItemIdnumber

client.inputting(content, conversationId, toId) ⇒ Promise

正在输入

Kind: instance method of Client

ParamType
contentstring
conversationIdnumber
toIdnumber

client.getUserInfo() ⇒ Promise

获取个人信息

Kind: instance method of Client

client.updateMyProfile(data) ⇒ Promise

更新个人信息

Kind: instance method of Client

ParamType
dataObject

client.getConversations(params) ⇒ Promise

批量获取会话

Kind: instance method of Client

ParamTypeDescription
paramsObject过滤参数
params.state'ACTIVE' | 'PENDING' | 'FINISHED'会话状态
params.pagenumber页码
params.limitnumber每页显示条数
params.searchstring搜索关键字
params.begin_atnumber开始时间
params.end_atnumber结束时间
params.order'DESC' | 'ASC'排序
params.customer_idnumber客户ID
params.show_allboolean显示全部

client.getConversationById(conversationId) ⇒ Promise

获取单条会话

Kind: instance method of Client

ParamTypeDescription
conversationIdnumber会话ID

client.updateUserProfile(id, data) ⇒ Promise

更新用户信息

Kind: instance method of Client

ParamTypeDescription
idnumber用户ID
dataObject用户信息

client.rateStaff(score, suggestion, ratingTagIds) ⇒ Promise

评价客服

Kind: instance method of Client

ParamTypeDescription
scorenumber分数, 1-5
suggestionstring评语
ratingTagIdsArray.<number>TagId

client.getVisitInfo(id) ⇒ Promise

根据会话ID获取用户资料访问信息

Kind: instance method of Client

ParamTypeDescription
idnumber会话ID

client.getPendingCount() ⇒ Promise

获取当前排队人数

Kind: instance method of Client

client.addCustomerTag(id, data) ⇒ Promise

增加访客标签

Kind: instance method of Client

ParamType
idnumber
dataObject

client.deleteCustomerTag(id, tagId) ⇒ Promise

删除访客标签

Kind: instance method of Client

ParamType
idnumber
tagIdnumber

client.getQuickReply() ⇒ Promise

获取快速回复

Kind: instance method of Client

client.addQuickReply(data) ⇒ Promise

增加快速回复

Kind: instance method of Client

ParamType
dataObject

client.editQuickReply(id, data) ⇒ Promise

修改快速回复

Kind: instance method of Client

ParamType
idnumber
dataObject

client.deleteQuickReply(id) ⇒ Promise

删除快速回复

Kind: instance method of Client

ParamType
idnumber

client.adminCloseConversation(id) ⇒ *

管理员强制关闭会话

Kind: instance method of Client

ParamTypeDescription
idnumber会话ID

client.exportHistoryConversations(data) ⇒ Promise

导出历史会话

Kind: instance method of Client

Param
data

client.getTransferServiceList(params) ⇒ Promise

获取客服用户列表(转接使用)

Kind: instance method of Client

Param
params

client.conversationTransfer(id, data) ⇒ Promise

会话转接

Kind: instance method of Client

Param
id
data

client.requestConversations(data) ⇒ Promise

历史会话发起会话

Kind: instance method of Client

Param
data

client.getConversationsCount(params) ⇒ Promise

获取会话统计

Kind: instance method of Client

Param
params

client.uploadBlobs(file, onUploadProgress) ⇒ Promise

上传附件

Kind: instance method of Client

ParamTypeDescription
fileFile文件
onUploadProgressfunction回调函数

client.likeRobotAnswer(id) ⇒ Promise

机器人满意回答

Kind: instance method of Client

Param
id

client.dislikeRobotAnswer(msgId) ⇒ Promise

机器人不满意回答

Kind: instance method of Client

Param
msgId

client.getSuggestions(query, subChannelId) ⇒ Promise

问题自动补全

Kind: instance method of Client

ParamDefault
query
subChannelId0

client.getPendingPosition(convId) ⇒ Promise

当前排队位置

Kind: instance method of Client

Param
convId

client.getCurrentConversationList() ⇒ Promise

获取当前会话列表

Kind: instance method of Client

client.getSubChannel(subChannelId) ⇒ Promise

获取渠道信息

Kind: instance method of Client

Param
subChannelId

client.getHotFaqs(groupID, limit, page) ⇒ Promise

获取热门问题

Kind: instance method of Client

Param
groupID
limit
page

client.getRatings() ⇒ Promise

获取评分等级

Kind: instance method of Client

client.updateConversationRemark(id, data) ⇒ Promise

更改会话备注

Kind: instance method of Client

Param
id
data

Client.getAnonymousToken() ⇒ Promise

获取匿名Token

Kind: static method of Client

OnOpen : function

WebSocket建立成功回调函数

Kind: global typedef

ParamTypeDescription
eventEvent事件

OnClose : function

WebSocket关闭回调函数

Kind: global typedef

ParamTypeDescription
eventCloseEvent事件

OnError : function

WebSocket错误回调函数

Kind: global typedef

ParamTypeDescription
eventEvent事件

OnMessage : function

收到消息回调函数

Kind: global typedef

ParamTypeDescription
messageMessage消息

Message : Object

消息

Kind: global typedef
Properties

NameTypeDescription
idnumber消息ID
fromIdnumber发送者ID
nicknamestring发送者昵称
contentstring | Object内容,文本消息为string,其他消息为Object,包含url,filename等信息
createdAtnumber消息创建时间戳
directionnumber发送方向,0代表发出,1代表收到
messageTypeMessageType消息类型
isReadboolean是否已读
conversationIdnumber会话ID

MessageType : 'Text' | 'Image' | 'Video' | 'Attachment'

消息类型,可以是以下字符串中任意一个

Kind: global typedef

OnConversationBuilt : function

会话建立回调函数

Kind: global typedef

ParamTypeDescription
conversationIdnumber会话ID
userIdnumber用户ID
nicknamestring用户名
userTypestring用户类型

OnConversationClosed : function

会话关闭回调函数

Kind: global typedef

ParamTypeDescription
conversationIdnumber会话ID
reasonnumber关闭原因 1: 客户主动关闭, 2: 客服主动关闭, 3: 超时自动关闭, 4: 管理员强制关闭

OnMessageRecall : function

消息被撤回回调函数

Kind: global typedef

ParamTypeDescription
conversationIdnumber会话ID
messageIdnumber消息ID

OnManualServiceStart : function

人工会话建立回调函数

Kind: global typedef

OnStaffBusy : function

客服繁忙回调函数

Kind: global typedef

OnStaffOffline : function

客服不在线回调函数

Kind: global typedef

OnMultipleLogin : function

多端登录回调函数

Kind: global typedef

OnConversationTransfer : function

会话转接回调函数

Kind: global typedef

ParamTypeDescription
conversationIdnumber会话ID

OnInputting : function

会话转接回调函数

Kind: global typedef

ParamTypeDescription
contentstring消息内容
conversationIdnumber会话ID

OnStaffTimeout : function

客服回复超时回调函数

Kind: global typedef

ParamTypeDescription
conversationIdnumber会话ID
1.7.1

3 years ago

1.7.0

3 years ago

1.6.4

3 years ago

1.6.3

3 years ago

1.6.2

3 years ago

1.6.1

3 years ago

1.6.0

3 years ago

1.5.6

3 years ago

1.5.5

3 years ago

1.5.4

3 years ago

1.5.3

3 years ago

1.5.2

3 years ago

1.5.1

4 years ago

1.5.0

4 years ago

1.4.6

4 years ago

1.4.5

4 years ago

1.4.4

4 years ago

1.4.3

4 years ago

1.4.2

4 years ago

1.4.1

4 years ago

1.4.0

4 years ago

1.3.10

4 years ago

1.3.9

4 years ago

1.3.8

4 years ago

1.3.7

4 years ago

1.3.6

4 years ago

1.3.5

4 years ago

1.3.4

4 years ago

1.3.3

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.14

4 years ago

1.2.15

4 years ago

1.2.13

4 years ago

1.2.12

4 years ago

1.2.10

4 years ago

1.2.11

4 years ago

1.2.9

4 years ago

1.2.8

4 years ago

1.2.7

4 years ago

1.2.6

4 years ago

1.2.6-0

4 years ago

1.2.5

4 years ago

1.2.4

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.0.2

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago