Skip to content

shareMessage(第三方 app)

分享内容到应用内的会话。

网页应用需要完成鉴权后调用该接口。

支持说明

客户端平台WPS协作版本要求
iOS>=2.1.0
Android>=2.1.0
PC>=2.1.0

输入

参数类型是否必须描述
typeString分享的消息类型。可能值:
text:普通文本消息
markdown:Markdown 消息
webPage:协作卡片消息
contentTextMarkdownWebPage具体数据类型由传入的 type 决定不同消息类型传入的数据结构见 Text/Markdown/WebPage 对象说明。

Text 对象

参数类型是否必须描述
textString分享的文本内容

Markdown 对象

参数类型是否必须描述
textString分享的文本内容

WebPage 对象

参数类型是否必须描述
urlString分享的 url
titleString分享标题
imageString分享配图 url,缺省使用 app 图标
textString分享描述文本

输出

名称类型描述
usersUser[]用户集合
groupsGroup[]群聊会话集合
shareFailUsersUser[]发送失败用户集合
shareFailGroupsGroup[]发送失败会话集合

User 对象

名称类型描述
avatarString用户头像地址
nameString用户名称
useridNumber用户 ID
chatidNumber会话 ID
companyidNumber企业 ID
xzUseridNumber协作 uid (不对外)

Group 对象

名称类型描述
chatidNumber会话 ID
nameString会话名称

示例代码

const params = {
    type: 'webPage',
    content: {
        title: '金山软件欢迎你加入',
        url: 'https://www.kingsoft.com/',
        text: '描述内容xxx',
        image: 'https://bkimg.cdn.bcebos.com/pic/810a19d8bc3eb1352ac7091eac1ea8d3fd1f4416?x-bce-process=image/watermark,image_d2F0ZXIvYmFpa2UxMTY=,g_7,xp_5,yp_5/format,f_auto'
    }
};
window.ksoxz_sdk.shareMessage({params, onSuccess, onError})

错误码

errnomsg含义
1041001User canceled用户取消操作

除以上错误外,还可能存在公共错误码,参考:公共错误码