当前位置:   article > 正文

微信小程序打开微信客服_wx.opencustomerservicechat

wx.opencustomerservicechat

微信客服API

小程序中使用openCustomerServiceChat接口,可以实现与客服进行实时聊天的功能。下面是使用该接口的步骤:

  1. 在小程序的后台管理系统中,进入"设置"->“客服消息”,开启"客服消息接口"。
  2. 在小程序的前端代码中,调用wx.openCustomerServiceChat()方法来打开客服聊天界面。
  3. 在调用wx.openCustomerServiceChat()方法时,可以传入一个对象参数,用于配置聊天界面的样式和功能。例如,可以设置头像、昵称、欢迎语等。
  4. 用户点击界面上的客服按钮或其他触发事件时,调用wx.openCustomerServiceChat()方法即可打开客服聊天界面。

需要注意的是,使用openCustomerServiceChat接口需要满足以下条件:

  1. wxContact(contactUrl){
  2. let that = this
  3. wx.openCustomerServiceChat({
  4. extInfo: {url: contactUrl},
  5. corpId: this.data.shop.corpId,//企业必须去微信客服开通认证,这个是需要收费的
  6. success(res) {
  7. console.log(res)
  8. },
  9. fail(res){
  10. if(res.errCode == 6) {
  11. wx.showModal({
  12. title: '提示',
  13. // content: JSON.stringify(res)
  14. content: '绑定失败,请检查企业微信是否认证、小程序是否授权且认证。',
  15. })
  16. }
  17. }
  18. })

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/喵喵爱编程/article/detail/979689
推荐阅读
相关标签
  

闽ICP备14008679号