多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
在小程序内添加客服按钮,请参考官方文档:[客服按钮文档](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/customer-message/receive.html) 或参考芝麻客服参考代码:[https://github.com/hotapp8/xiaokefu](https://github.com/hotapp8/xiaokefu) 以下是部分代码参考: ### 打开客服 ``` <button type='default' open-type='contact'> 打开客服 (普通客服) </button> ``` ### 固定的客服头像和昵称 ``` <button type='default' session-from='{"nickName":"赵丽颖","avatarUrl":"https://ss0.baidu.com/6ONWsjip0QIZ8tyhnq/it/u=956547549,964120469&fm=58"}' open-type="contact"> 带头像客服 (固定头像)</button> ``` ### 通过后端传递用户的头像和昵称 ``` <button type='default' session-from='{"nickName":"{{userInfo.nickName}}","avatarUrl":"{{userInfo.avatarUrl}}"}' open-type="contact" >带头像客服(微信头像)</button> ``` ### 传递用户浏览哪个产品,跟踪用户来源 ``` <button type='default' session-from='{"source":"产品BBBB","nickName":"{{userInfo.nickName}}","avatarUrl":"{{userInfo.avatarUrl}}"}' open-type="contact" >指定消息来源</button> ``` ### 指定客服 ``` <button type='default' session-from='{"kefu":["126","127"],"nickName":"{{userInfo.nickName}}","avatarUrl":"{{userInfo.avatarUrl}}"}' open-type="contact"> 指定客服</button> ``` ### 卡片消息,聊天页面可发送图片卡片给客服 ``` <button open-type='contact' send-message-title="会话内消息卡片" send-message-path="/pages/index/index" send-message-img="https://imgsa.baidu.com/baike/pic/item/562c11dfa9ec8a13918d4ed4fb03918fa0ecc06b.jpg" show-message-card="true">卡片消息</button> ```