一、登录小程序授权微信客服
- 在里面申请接入就可以
二、登录企业微信后台,获取企业ID和客服ID
- 获取微信客服ID
- 获取企业ID
三、微信小程序开发工具调试
- 找到小程序客服页面,index.js页面加入微信客服调用接口wx.openCustomerServiceChat
- 在pages里面写入调用接口信息
// pages/kefu/index.js
Page({
// 其他页面方法...
// 跳转客服
toCustomerServicePages: function () {
wx.openCustomerServiceChat({
extInfo: {url: 'https://work.weixin.qq.com/kfid/kfc92f0e9xxxxxxxx'},
corpId: 'wwa720b58451xxxxxxxx',
success(res) {}
})
}
})
- toCustomerServicePages 是跳转页面定义按钮名称
- extInfo: {url: ‘https://work.weixin.qq.com/kfid/kfc92f0e9xxxxxxxx’} 微信客服ID的链接
- corpId: ‘wwa720b58451xxxxxxxx’, 企业微信ID
- 客服页面做跳转按钮
<!-- pages/register/index.wxml -->
<view class="register" wx:if="{{isShow}}">
<image src="{{kefuimg}}"></image>
<view class="content">
<view class="btn">
<button class="confirm" type="primary" bindtap="toCustomerServicePages">在线客服</button>
</view>
</view>
</view>
- toCustomerServicePages 这里的名称定义要和index.js页面的保持一致
四、效果实现
- 点击小程序在线客服自动连接到微信客服
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
暂无评论内容