差别
这里会显示出您选择的修订版和当前版本之间的差别。
两侧同时换到之前的修订记录 前一修订版 后一修订版 | 前一修订版 后一修订版 两侧同时换到之后的修订记录 | ||
cs:300visitoraccess:mini-program [2019/07/29 06:38] candywang [开发者模式接入] |
cs:300visitoraccess:mini-program [2019/09/24 02:56] candywang [开发者模式接入] |
||
---|---|---|---|
行 83: | 行 83: | ||
<button open-type="contact" bindcontact="handleContact">客服</button> | <button open-type="contact" bindcontact="handleContact">客服</button> | ||
</code> | </code> | ||
+ | |||
+ | 基于微信小程序推出的新特性,客服端可以获取和展示微信用户的昵称和头像。如需获取和展示微信用户的昵称和头像,可在微信小程序的源码中添加如下代码。 | ||
+ | |||
+ | <code> | ||
+ | <button open-type="contact" session-from='{"nickName":"{{userInfo.nickName}}","avatarUrl":"{{userInfo.avatarUrl}}"}'>联系客服</button> | ||
+ | </code> | ||
+ | |||
+ | 注: | ||
+ | - 获取昵称和头像,需要首先获取小程序userInfo | ||
+ | - session-from字段传key:value形式的json字符串 | ||
<WRAP round tip> | <WRAP round tip> | ||
行 88: | 行 98: | ||
</WRAP> | </WRAP> | ||
+ | ====获取accessToken ==== | ||
+ | 根据tenanId,appId,secret从环信获取微信小程序的accessToken信息. | ||
+ | |||
+ | * Path:http://kefu.easemob.com/v1/weixin/tenants/{tenantId}/xcx/accesstoken | ||
+ | * HTTP Method:GET | ||
+ | * Request Parameters:grant_type=client_credential&appid={appid}&secret={secret} | ||
+ | * 可能的错误码:400(无效信息)。 | ||
+ | |||
+ | Curl示例: | ||
+ | <code> | ||
+ | curl -X GET \ | ||
+ | 'http://kefu.easemob.com/v1/weixin/tenants/20016/xcx/accesstoken?grant_type=client_credential&appid=wx676137238b282f12&secret=d036a38695bb6fe5d17d77ff8fa65f5c' \ | ||
+ | </code> | ||
+ | |||
+ | 参数说明: | ||
+ | ^名称^类型^是否非空(Y:是;N:否)^说明^ | ||
+ | |tenantId|int|Y|租户ID| | ||
+ | |appId| String |Y|小程序的appId| | ||
+ | |secret| String |Y|小程序的secret| | ||
+ | |||
+ | Response示例: | ||
+ | <code> | ||
+ | { | ||
+ | "access_token": "19_9AUeL6YO4WGI99DU-SHWhxOPCpgniqdSmQVU7BHAR4J62DHP4QE7G6LOsg4xRiRLTFPH4ybxiXAjIrU2cDKcP3qWiWvbxAibJ1Aw7--sZ2S0rwgG6f4Ya5-WdV1D4c_c598vXvhXNU8QFxpHSWGbAJAAEO", | ||
+ | "expires_in": 7200 | ||
+ | } | ||
+ | </code> | ||
+ | |||
+ | 参数说明: | ||
+ | ^名称^类型^说明^ | ||
+ | |access_token|String|要获取的accessToken| | ||
+ | |expire_in| int |到期时间,最大值为7200s| | ||
+ | |||
+ | 错误码说明: | ||
+ | |||
+ | ^错误码^错误信息^注释^ | ||
+ | |400|“invalid grant_type hint”.“invalid tenantId or appId or secret”.|无效信息| | ||