可以发送、分享IM消息
请求参数
参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
receiver | String | 是 | 联系人id/群组id |
receiveType | String | 是 | 聊天类型:0 单聊 1 群组。默认单聊 |
cardType | String | 是 | 卡片类型:image-txt,暂仅支持 image-txt |
title | String | 是 | 主标题 |
subTitle | String | 是 | 子标题 |
iconURL | String | 否 | 卡片缩略图url,可以不配置,移动使用默认图片 |
sourceUrl | String | 否 | 如需要支持PC端打开分享URL,此字段必传;格式如:http://xx/xxx |
iOpenURI | String | 否 | 如需通过IOS 原生插件打开URL,必传; 格式如:ui://welink.test/demo |
aOpenURI | String | 否 | 如需通过安卓 原生插件打开URL,必传;格式如:ui://welink.test/demo |
isGotoChat | String | 否 | 默认会跳转到聊天界面,传0不跳转到聊天界面。如需跳转到聊天界面建议传空字符串 |
返回说明
参数 | 说明 |
|---|---|
原生UI组件 | 原生提供分享组件 |
请求示例
- ES6版本
HWH5.sendIMCard({ receiver: 'l00123456', receiveType: '0', cardType: 'image-txt', title: '分享IM消息', subTitle: 'xx', iconURL: 'xx', sourceUrl: 'h5://xxx/html/index.html', iOpenURI: '', aOpenURI: '', isGotoChat: '0' }).catch(error => { console.log('分享卡片消息异常', error); });
- ES5版本
HWH5.sendIMCard({ receiver: 'l00123456', receiveType: '0', cardType: 'image-txt', title: '分享IM消息', subTitle: 'xx', iconURL: 'xx', sourceUrl: 'h5://xxx/html/index.html', iOpenURI: '', aOpenURI: '', isGotoChat: '0' }).catch(function (error) { console.log('分享卡片消息异常', error); });

