uni-app在app中挑起微信客服

代码

				// #ifndef APP-PLUS
				uni.showToast({
					title: '请在app打开',icon:"none"
				});
				// #endif
				let wechat = null
				plus.share.getServices(res => {
				 wechat = res.find(i => i.id === 'weixin')
					if (wechat) {
						wechat.openCustomerServiceChat({
							corpid: 'wweab5f2e918****',//企业ID
							url: 'https://work.weixin.qq.com/kfid/****',//客服地址
						}, src => {
							console.log("success:", JSON.stringify(src))
						}, err => {
							console.log("error:", JSON.stringify(err))
						})
					} else {
						uni.showToast({
							title: '当前环境不支持微信操作',icon:"error"
						});
					}
				}, function() {
					uni.showToast({
						title: "获取服务失败,不支持该操作。" + JSON.stringify(e),
						icon: 'none'
					})
				});

常见错误

deeplink customerservice no permission

  1. 解决方法1

    如果出现此错误,请检查企业ID,或者打包测试(真机测试不行)。
    
  2. 解决方法2
    网页登录企业微信-》应用管理-》企业客服
    在这里插入图片描述

    	**企业认证后才能关联app**
    

企业认证后才能关联app

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐