# 开发者模式使用指南 ## 使用说明 1.接入企业通过芝麻小客服官方提供的api可获取对应信息信息. ## 接入设置 ![](https://img.kancloud.cn/67/a9/67a9876e5efc8564415666171b83892f_1025x616.png) 1. 开发者需要登陆芝麻客服后台,在左侧菜单栏点击开发者选项,进入设置页面(目前仅支持小程序应用)。 ## 开放 API 列表 1. [点击查看获取access_token文档](https://www.kancloud.cn/wikizhima/wikixkf/1022130) ## 开放功能 1. 开发者模式开启后,企业内的消息会往开发者的地址推送(格式如下,内容与微信官方一致): 2. 开发者服务器在收到推送过来的消息后,请在5秒内返回 success 字符串(像微信一样) 3. 开发者在收到消息后可自行对接微信api去给用户推送消息,[微信消息文档](https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140547) ```curl curl -i -k -H "Content-type: application/json" -X POST -d '{"ToUserName":"gh_18a68d4722658b","FromUserName":"oQV2m5M22tNYv9ynxoI6r63Fkovp5Q","CreateTime":"1565772633","MsgType":"text","Content":"\\u770b\\u770b","MsgId":"22416477347317962"}' http://test.applsssnk.cn/test ``` ## 小程序推送消息格式 1.文本 ``` json { "ToUserName": "toUser", "FromUserName": "fromUser", "CreateTime": 1482048670, "MsgType": "text", "Content": "this is a test", "MsgId": 1234567890123456 } ``` 2.图片 ``` json { "ToUserName": "toUser", "FromUserName": "fromUser", "CreateTime": 1482048670, "MsgType": "image", "PicUrl": "this is a url", "MediaId": "media_id", "MsgId": 1234567890123456 } ``` 3.小程序卡片 ``` json { "ToUserName": "toUser", "FromUserName": "fromUser", "CreateTime": 1482048670, "MsgType": "miniprogrampage", "MsgId": 1234567890123456, "Title":"title", "AppId":"appid", "PagePath":"path", "ThumbUrl":"", "ThumbMediaId":"" } ``` 4. 进入会话事件 ``` json { "ToUserName": "toUser", "FromUserName": "fromUser", "CreateTime": 1482048670, "MsgType": "event", "Event": "user_enter_tempsession", "SessionFrom": "sessionFrom" } ``` <a href="https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/customer-message/receive.html" target="_blank">点击跳转查看微信小程序消息格式</a>