Install

yarn add ws-kf-react
//yarn or npm
npm i ws-kf-react --save

Method

必须要先初始化才可以使用其他方法

WsKfInit

callback内的参数还没有确定,稍后补全

import { WsKfInit } from "ws-kf-react";

WsKfInit({
access_token: 'f914f40705ced1e4495f1764d9f5xxxxxxx',
callback: (e)=>{
console.log(e);
}
})

WsKfShowPanel

使用WsKfShowPanel打开一个对话面板

Params
Param Default Type Description
id undefined number 客服id
import { WsKfShowPanel } from "ws-kf-react";

WsKfShowPanel({
id:894
})

SendMessage

发送消息

Params
Param Default optional Type Description
content_type undefined text image template string 指定消息类型
text_content undefined string 发送的文本内容
image_url undefined string 发送的图片地址
kfId undefined number 发送的客服id
templateData undefined template_title template_desc template_link template_img template_extra_name template_extra_content object 发送的客服id

Mark:

不同的content_type传递的其他参数是不同的,已知的组合如下:

{
content_type: 'text',
text_content,
},
{
content_type: 'image',
image_url,
},
{
content_type: 'template',
templateData,
}
//templateData中的template_extra_name目前包含'goods',template_extra_content为自定义用户自定义数据结构
import { SendMessage } from "ws-kf-react";

SendMessage(params)

results matching ""

    No results matching ""