第三方回调

功能概述

    第三方回调是云信一项基于客户需求开放的事件回调能力。简单来讲,就是由客户应用服务器干预事件处理的结果。例如在企业办公场景、接入第三方反垃圾服务场景下,客户需要在发送方发送消息时,不直接投递给接收方。而通过云信服务器向应用服务器发出请求,根据返回的回调结果,放行后方可投递。不回调和回调的消息处理流程对比如下:

说明:

1、第三方回调基于HTTP/HTTPS协议。
2、业务方开通了第三方回调服务时,云信服务器会在客户端发送消息时,将消息内容和用户信息发往业务方服务器,由业务方服务器端判断消息是否可以发送,根据业务方服务器返回的结果,云信服务器再选择是否投递消息。
3、请求方式为POST,消息体为JSON类型,在请求业务方服务器时,会通过增加CheckSum头来进行安全校验,CheckSum = sha1(AppSecret + MD5 + CurTime), 其中AppSecret 、MD5CurTime均为String类型。在验证数据是否在传输过程中被篡改时,需要计算验证MD5值是否被修改,以及计算验证CheckSum。AppSecret值为开发者的AppSecret(对应AppKey), MD5值为根据request body计算出来的值。
4、云信服务器只会请求一次,超时时间为2秒,如果请求失败或者超时,云信服务器会使用业务方配置的默认回调结果继续处理业务逻辑

回调协议格式

    第三方回调基于HTTP/HTTPS协议,为保证数据安全,建议开发者使用HTTPS,协议相关说明如下:

1、请求Http Header说明

Header类型说明
AppKey String 应用的AppKey
CurTime Long当前UTC时间戳,从1970年1月1日0点0 分0 秒开始到现在的毫秒数(String)
MD5String根据请求中的request body计算出来的MD5值
CheckSumString校验值
Content-TypeString请求消息体类型,一般为:application/json
MD5值计算举例:

    String requestBody = "{}";
    String MD5 = CheckSumBuilder.getMD5(requestBody); //参考 接口概述 -> API checksum校验 部分
CheckSum值计算举例:

    String AppSecret = "90ud57s67187";
    String MD5 = "9894907e4ad9de4678091277509361f7";
    String CurTime = "1440570500855";  ////当前UTC时间戳,从1970年1月1日0点0 分0 秒开始到现在的毫秒数(String)
    String CheckSum = CheckSumBuilder.getCheckSum(AppSecret, MD5, CurTime); //参考 接口概述 -> API checksum校验 部分

2、请求Http Body说明

消息体统一为Json格式,示例:

    {
        "body": "Hello 云信!",
        "eventType": 1,
        "fromAccount": "000266",
        "fromClientType": "WEB",
        "fromDeviceId": "617715aa8579db03f0cf054c199cc71b",
        "fromNick": "yj000266",
        "msgTimestamp": "1541560157286",
        "msgType": "TEXT",
        "msgidClient": "",
        "to": "005877"
    }

//Json中的属性请参考具体的回调类型

3、响应格式说明

第三方回调响应的Content-Type Header需要设置为:application/json; charset=utf-8

响应消息体为Json格式,示例:

    {
        "errCode":0 
    }

errCode定义:

errCode说明
0回调通过,允许执行。
1回调不通过,取消执行,客户端会收到403错误码。

第三方回调事件类型

支持的回调事件类型如下:

eventType功能说明
1P2P消息回调通过SDK发送P2P消息时,参数检查通过后先回调开发者服务器,回调通过后才发送消息,否则消息发送失败。
2群组消息回调通过SDK发送群组消息时,参数检查通过后先回调开发者服务器,回调通过后才发送消息,否则消息发送失败。
3用户资料变更回调通过SDK变更用户资料时,参数检查通过后先回调开发者服务器,回调通过后才允许变更,否则变更失败。
4添加好友回调通过SDK添加好友时,参数检查通过后先回调开发者服务器,回调通过后才允许添加,否则添加失败。
5删除好友回调通过SDK删除好友时,参数检查通过后先回调开发者服务器,回调通过后才允许删除,否则删除失败。
6聊天室消息回调通过SDK发送聊天室消息时,参数检查通过后先回调开发者服务器,回调通过后才发送消息,否则消息发送失败。
7创建群回调通过SDK创建群组时,参数检查通过后先回调开发者服务器,回调通过后才允许创建,否则创建失败。
8解散群回调通过SDK解散群组时,参数检查通过后先回调开发者服务器,回调通过后才允许解散,否则解散失败。
9群邀请回调通过SDK群邀请时,参数检查通过后先回调开发者服务器,回调通过后才允许邀请,否则邀请失败。
10退群回调通过SDK退群时,参数检查通过后先回调开发者服务器,回调通过后才允许退群,否则退群失败。
11增加群管理员回调通过SDK增加管理员时,参数检查通过后先回调开发者服务器,回调通过后才允许增加管理员,否则操作失败。
12取消群管理员回调通过SDK取消管理员时,参数检查通过后先回调开发者服务器,回调通过后才允许取消管理员,否则操作失败。
13转让群回调通过SDK转让群时,参数检查通过后先回调开发者服务器,回调通过后才允许转让群,否则转让失败。
14踢人出群回调通过SDK踢人出群时,参数检查通过后先回调开发者服务器,回调通过后才允许踢人出群,否则踢人失败。
15更新群信息回调通过SDK更新群信息时,参数检查通过后先回调开发者服务器,回调通过后才允许更新群信息,否则更新失败。
16更新群成员信息回调通过SDK更新群成员信息时,参数检查通过后先回调开发者服务器,回调通过后才允许更新群成员信息,否则更新失败。
17更新其他人的群成员信息回调通过SDK更新其他人的群成员信息时,参数检查通过后先回调开发者服务器,回调通过后才允许更新其他人的群成员信息,否则更新失败。
18禁言群成员回调通过SDK禁言群成员时,参数检查通过后先回调开发者服务器,回调通过后才允许禁言群成员,否则操作失败。
19申请入群回调通过SDK申请入群时,参数检查通过后先回调开发者服务器,回调通过后才允许申请入群,否则申请失败。

假设第三方开发者的消息接收地址为:

http://yunxinservice.com.cn/receiveMsg.action
以下的第三方接口均假设为此接口,不再赘述。

会话消息回调

1.1 HTTP示例:

POST /receiveMsg.action HTTP/1.1
Host: yunxinservice.com.cn
AppKey: 158983881e092b052194d219453d6542
CurTime: 1541583920979
MD5: e89c284a5ad9a76b3176e23108920f81
CheckSum: 6f08c5ee2dd16a5fc34a12005e5d5f1411e657a1
Content-Type: application/json
Cache-Control: no-cache

{"body":"123456","eventType":1,"fromAccount":"000266","fromClientType":"WEB","fromDeviceId":"617715aa8579db03f0cf054c199cc71b","fromNick":"yj000266","msgTimestamp":"1541560157286","msgType":"TEXT","msgidClient":"","to":"005877"}

1.2 cURL示例:

curl -X POST \
  http://yunxinservice.com.cn/receiveMsg.action \
  -H 'appkey: 158983881e092b052194d219453d6542' \
  -H 'cache-control: no-cache' \
  -H 'checksum: 6f08c5ee2dd16a5fc34a12005e5d5f1411e657a1' \
  -H 'content-type: application/json' \
  -H 'curtime: 1541583920979' \
  -H 'md5: e89c284a5ad9a76b3176e23108920f81' \
  -d '{"body":"123456","eventType":1,"fromAccount":"000266","fromClientType":"WEB","fromDeviceId":"617715aa8579db03f0cf054c199cc71b","fromNick":"yj000266","msgTimestamp":"1541560157286","msgType":"TEXT","msgidClient":"","to":"005877"}'

1.3 消息体中的JSON字段说明:

回调消息中并不是每个字段都会一定抄送,请注意对各字段的判空处理。
名称类型必须说明
eventType Integer值为1,表示是P2P消息回调;
值为2,表示是群组消息回调;
值为6,表示是聊天室消息回调
fromAccount String消息发送者的用户账号
fromNick String发送方昵称
fromClientType String发送客户端类型: AOS、IOS、PC、WINPHONE、WEB、REST
fromDeviceId String发送设备id
to String若eventType为1,则to为消息接收者的用户账号,字符串类型;
若eventType为2,则to为tid,即群id,可转为Long型数据
msgTimestamp String消息发送时间
msgType String会话具体类型PERSON、TEAM对应的通知消息类型:
TEXT :文本消息
PICTURE :图片消息
AUDIO :语音消息
VIDEO :视频消息
LOCATION :地理位置
NOTIFICATION :通知
FILE :文件消息
TIPS :提示类型消息
CUSTOM :自定义消息
msgidClient String客户端消息Id
body String消息内容
attach String附加消息
ext String消息扩展字段

用户资料变更回调

1.1 HTTP示例:

POST /receiveMsg.action HTTP/1.1
Host: yunxinservice.com.cn
AppKey: 158983881e092b052194d219453d6542
CurTime: 1541583920979
MD5: e89c284a5ad9a76b3176e23108920f81
CheckSum: 6f08c5ee2dd16a5fc34a12005e5d5f1411e657a1
Content-Type: application/json
Cache-Control: no-cache

{"account":"yx0002","birth":"2009-11-30","clientType":"PC","deviceId":"4f716737-75dd-41cb-bc6c-d9516ff03f707bd899c82e64bdc8a5220c07c744","email":"555555@163.com","eventType":3,"ex":"","gender":1,"icon":"https://ss0.bdstatic.com/94oJfD_bAAcT8t7mm9GUKT-xh_/timg?image&quality=100&size=b4000_4000&sec=1552461348&di=536bb9721d145a07657df45a8da49321&src=http://img0.pconline.com.cn/pconline/1511/29/7257120_901_thumb.jpg","mobile":"18888888888","name":"0002","sign":"这是签名","timestamp":"1552461406587"}

1.2 cURL示例:

curl -X POST \
  http://yunxinservice.com.cn/receiveMsg.action \
  -H 'appkey: 158983881e092b052194d219453d6542' \
  -H 'cache-control: no-cache' \
  -H 'checksum: 6f08c5ee2dd16a5fc34a12005e5d5f1411e657a1' \
  -H 'content-type: application/json' \
  -H 'curtime: 1541583920979' \
  -H 'md5: e89c284a5ad9a76b3176e23108920f81' \
  -d '{"account":"yx0002","birth":"2009-11-30","clientType":"PC","deviceId":"4f716737-75dd-41cb-bc6c-d9516ff03f707bd899c82e64bdc8a5220c07c744","email":"555555@163.com","eventType":3,"ex":"","gender":1,"icon":"https://ss0.bdstatic.com/94oJfD_bAAcT8t7mm9GUKT-xh_/timg?image&quality=100&size=b4000_4000&sec=1552461348&di=536bb9721d145a07657df45a8da49321&src=http://img0.pconline.com.cn/pconline/1511/29/7257120_901_thumb.jpg","mobile":"18888888888","name":"0002","sign":"这是签名","timestamp":"1552461406587"}'

1.3 消息体中的JSON字段说明:

回调消息中并不是每个字段都会一定抄送,请注意对各字段的判空处理。
只抄送用户资料变更的字段
名称类型必须说明
eventType Integer值为3,表示是用户资料变更回调
account String用户账号
deviceId String发送方设备id
clientType String发送客户端类型: AOS、IOS、PC、WINPHONE、WEB、REST
name String昵称
icon String头像图标
sign String签名
email Stringemail
birth String生日
mobile String手机号
gender Integer用户性别,0表示未知,1表示男,2表示女
ex String用户名片扩展字段
timestamp String操作时间,字符串类型

好友关系变更回调

1.1 HTTP示例:

POST /receiveMsg.action HTTP/1.1
Host: yunxinservice.com.cn
AppKey: 158983881e092b052194d219453d6542
CurTime: 1541583920979
MD5: e89c284a5ad9a76b3176e23108920f81
CheckSum: 6f08c5ee2dd16a5fc34a12005e5d5f1411e657a1
Content-Type: application/json
Cache-Control: no-cache

{"eventType":4,"fromAccount":"yx0001","fromClientType":"PC","fromDeviceId":"dd950b87-3c23-4c6d-863e-4c1fdeec1ecde54f68c09b22c55214cff7618ac5","msg":"加我加我","timestamp":"1552461598694","toAccount":"yx0002","verifyType":1}

1.2 cURL示例:

curl -X POST \
  http://yunxinservice.com.cn/receiveMsg.action \
  -H 'appkey: 158983881e092b052194d219453d6542' \
  -H 'cache-control: no-cache' \
  -H 'checksum: 6f08c5ee2dd16a5fc34a12005e5d5f1411e657a1' \
  -H 'content-type: application/json' \
  -H 'curtime: 1541583920979' \
  -H 'md5: e89c284a5ad9a76b3176e23108920f81' \
  -d '{"eventType":4,"fromAccount":"yx0001","fromClientType":"PC","fromDeviceId":"dd950b87-3c23-4c6d-863e-4c1fdeec1ecde54f68c09b22c55214cff7618ac5","msg":"加我加我","timestamp":"1552461598694","toAccount":"yx0002","verifyType":1}'

1.3 消息体中的JSON字段说明:

回调消息中并不是每个字段都会一定抄送,请注意对各字段的判空处理。
注意区分添加好友和删除好友抄送的字段有所不同
名称类型必须说明
eventType Integer值为4,表示是添加好友回调;
值为5,表示是删除好友回调
fromAccount String发起者账号
toAccount String接收者账号
fromDeviceId String发送方设备id
fromClientType String发送客户端类型: AOS、IOS、PC、WINPHONE、WEB、REST
verifyType Integer添加好友时此字段必有;含义:1直接加好友,2请求加好友,3同意加好友,4拒绝加好友
msg String添加好友时此字段有效;含义:加好友对应的请求信息
timestamp String操作时间,字符串类型

创建群回调

1.1 HTTP示例:

POST /receiveMsg.action HTTP/1.1
Host: yunxinservice.com.cn
AppKey: 158983881e092b052194d219453d6542
CurTime: 1541583920979
MD5: e89c284a5ad9a76b3176e23108920f81
CheckSum: 6f08c5ee2dd16a5fc34a12005e5d5f1411e657a1
Content-Type: application/json
Cache-Control: no-cache

{"announcement":"wmtest2创建群公告1564566444990","beinvitemode":1,"creator":"wmtest2","custom":"wmtest2创建群自定义属性","eventType":7,"fromClientType":"IOS","fromDeviceId":"d95488e2-94ee-4e9b-bc85-2df1d7f1f450","icon":"http://xxx.nos.netease.com/MTAxMTAxMA==/bmltYV8xNDMwMzVfMTQ0NzIwOTc4MTgyM18xMGY4YmMzYS1jOWI2LTQ0MjctYmZjNC1iMmY3NzdlODY2ZDI=","intro":"wmtest2测试同步期间在线群消息1564566444990","inviteList":["wmtest1","wmtest3","wmtest4","wmtest5"],"invitemode":1,"joinmode":0,"level":100,"msg":"快来加入吧","servercustom":"wmtest2群自定义属性","teamMuteType":0,"timestamp":"1564566441074","tname":"wmtest2wm3","type":1,"upcustommode":1,"uptinfomode":1}

1.2 cURL示例:

curl -X POST \
  http://yunxinservice.com.cn/receiveMsg.action \
  -H 'appkey: 158983881e092b052194d219453d6542' \
  -H 'cache-control: no-cache' \
  -H 'checksum: 6f08c5ee2dd16a5fc34a12005e5d5f1411e657a1' \
  -H 'content-type: application/json' \
  -H 'curtime: 1541583920979' \
  -H 'md5: e89c284a5ad9a76b3176e23108920f81' \
  -d '{"announcement":"wmtest2创建群公告1564566444990","beinvitemode":1,"creator":"wmtest2","custom":"wmtest2创建群自定义属性","eventType":7,"fromClientType":"IOS","fromDeviceId":"d95488e2-94ee-4e9b-bc85-2df1d7f1f450","icon":"http://xxx.nos.netease.com/MTAxMTAxMA==/bmltYV8xNDMwMzVfMTQ0NzIwOTc4MTgyM18xMGY4YmMzYS1jOWI2LTQ0MjctYmZjNC1iMmY3NzdlODY2ZDI=","intro":"wmtest2测试同步期间在线群消息1564566444990","inviteList":["wmtest1","wmtest3","wmtest4","wmtest5"],"invitemode":1,"joinmode":0,"level":100,"msg":"快来加入吧","servercustom":"wmtest2群自定义属性","teamMuteType":0,"timestamp":"1564566441074","tname":"wmtest2wm3","type":1,"upcustommode":1,"uptinfomode":1}'

1.3 消息体中的JSON字段说明:

回调消息中并不是每个字段都会一定抄送,请注意对各字段的判空处理。
名称类型必须说明
eventType Integer值为7,表示是创建群回调
type Integer群组类型,0表示普通群,1表示高级群
creator String创建者账号
fromDeviceId String创建者设备id
fromClientType String创建者客户端类型: AOS、IOS、PC、WINPHONE、WEB、REST
tname String群名称
icon String群头像
custom String自定义字段
intro String群简介
msg String加群信息
announcement String群公告
servercustom String服务器自定义字段
inviteList JSONArray建群时邀请的人
teamMuteType Integer群禁言类型,0表示不禁言,1表示禁言普通成员,3表示禁言整个群(包括群主)
level Integer最大群成员数量
joinmode Integer申请入群权限,0表示不需要申请,1表示需要申请,2表示不允许申请
beinvitemode Integer被邀请人同意方式,0表示需要同意,1表示不需要同意
invitemode Integer谁可以邀请他人入群,0表示管理员,1表示所有人
uptinfomode Integer谁可以修改群资料群,0表示管理员,1表示所有人
upcustommode Integer谁可以更新自定义字段,0表示管理员,1表示所有人
timestamp String操作时间,字符串类型

解散群回调

1.1 HTTP示例:

POST /receiveMsg.action HTTP/1.1
Host: yunxinservice.com.cn
AppKey: 158983881e092b052194d219453d6542
CurTime: 1541583920979
MD5: e89c284a5ad9a76b3176e23108920f81
CheckSum: 6f08c5ee2dd16a5fc34a12005e5d5f1411e657a1
Content-Type: application/json
Cache-Control: no-cache

{"eventType":8,"fromAccount":"wmtest3","fromClientType":"IOS","fromDeviceId":"4f60d2c0-559d-4b84-8315-29c94d8a4ea8","tid":2637250619,"timestamp":"1564575855993"}

1.2 cURL示例:

curl -X POST \
  http://yunxinservice.com.cn/receiveMsg.action \
  -H 'appkey: 158983881e092b052194d219453d6542' \
  -H 'cache-control: no-cache' \
  -H 'checksum: 6f08c5ee2dd16a5fc34a12005e5d5f1411e657a1' \
  -H 'content-type: application/json' \
  -H 'curtime: 1541583920979' \
  -H 'md5: e89c284a5ad9a76b3176e23108920f81' \
  -d '{"eventType":8,"fromAccount":"wmtest3","fromClientType":"IOS","fromDeviceId":"4f60d2c0-559d-4b84-8315-29c94d8a4ea8","tid":2637250619,"timestamp":"1564575855993"}'

1.3 消息体中的JSON字段说明:

回调消息中并不是每个字段都会一定抄送,请注意对各字段的判空处理。
名称类型必须说明
eventType Integer值为8,表示是解散群回调
tid Long群id
fromAccount String操作者账号
fromDeviceId String操作者设备id
fromClientType String操作者客户端类型: AOS、IOS、PC、WINPHONE、WEB、REST
timestamp String操作时间,字符串类型

群邀请回调

1.1 HTTP示例:

POST /receiveMsg.action HTTP/1.1
Host: yunxinservice.com.cn
AppKey: 158983881e092b052194d219453d6542
CurTime: 1541583920979
MD5: e89c284a5ad9a76b3176e23108920f81
CheckSum: 6f08c5ee2dd16a5fc34a12005e5d5f1411e657a1
Content-Type: application/json
Cache-Control: no-cache

{"beinvitemode":0,"eventType":9,"fromAccount":"wmtest1","fromClientType":"IOS","fromDeviceId":"abe0f670-ee18-453b-af5f-54d5a08bd57f","inviteList":["wmtest10"],"msg":"普通人邀请","tid":2637216281,"timestamp":"1564572716247","type":1}

1.2 cURL示例:

curl -X POST \
  http://yunxinservice.com.cn/receiveMsg.action \
  -H 'appkey: 158983881e092b052194d219453d6542' \
  -H 'cache-control: no-cache' \
  -H 'checksum: 6f08c5ee2dd16a5fc34a12005e5d5f1411e657a1' \
  -H 'content-type: application/json' \
  -H 'curtime: 1541583920979' \
  -H 'md5: e89c284a5ad9a76b3176e23108920f81' \
  -d '{"beinvitemode":0,"eventType":9,"fromAccount":"wmtest1","fromClientType":"IOS","fromDeviceId":"abe0f670-ee18-453b-af5f-54d5a08bd57f","inviteList":["wmtest10"],"msg":"普通人邀请","tid":2637216281,"timestamp":"1564572716247","type":1}'

1.3 消息体中的JSON字段说明:

回调消息中并不是每个字段都会一定抄送,请注意对各字段的判空处理。
名称类型必须说明
eventType Integer值为9,表示是群邀请回调
tid Long群id
fromAccount String操作者账号
fromDeviceId String操作者设备id
fromClientType String操作者客户端类型: AOS、IOS、PC、WINPHONE、WEB、REST
type Integer群组类型,0表示普通群,1表示高级群
beinvitemode Integer被邀请人同意方式,0表示需要同意,1表示不需要同意
inviteList JSONArray邀请的人
msg String邀请附言
attach String拉人的attach信息
timestamp String操作时间,字符串类型

退群回调

1.1 HTTP示例:

POST /receiveMsg.action HTTP/1.1
Host: yunxinservice.com.cn
AppKey: 158983881e092b052194d219453d6542
CurTime: 1541583920979
MD5: e89c284a5ad9a76b3176e23108920f81
CheckSum: 6f08c5ee2dd16a5fc34a12005e5d5f1411e657a1
Content-Type: application/json
Cache-Control: no-cache

{"eventType":10,"fromAccount":"wmtest7","fromClientType":"IOS","fromDeviceId":"543d2548-140d-434c-804c-f931fdc23ea9","tid":2637216281,"timestamp":"1564573486382"}

1.2 cURL示例:

curl -X POST \
  http://yunxinservice.com.cn/receiveMsg.action \
  -H 'appkey: 158983881e092b052194d219453d6542' \
  -H 'cache-control: no-cache' \
  -H 'checksum: 6f08c5ee2dd16a5fc34a12005e5d5f1411e657a1' \
  -H 'content-type: application/json' \
  -H 'curtime: 1541583920979' \
  -H 'md5: e89c284a5ad9a76b3176e23108920f81' \
  -d '{"eventType":10,"fromAccount":"wmtest7","fromClientType":"IOS","fromDeviceId":"543d2548-140d-434c-804c-f931fdc23ea9","tid":2637216281,"timestamp":"1564573486382"}'

1.3 消息体中的JSON字段说明:

回调消息中并不是每个字段都会一定抄送,请注意对各字段的判空处理。
名称类型必须说明
eventType Integer值为10,表示是退群回调
tid Long群id
fromAccount String操作者账号
fromDeviceId String操作者设备id
fromClientType String操作者客户端类型: AOS、IOS、PC、WINPHONE、WEB、REST
timestamp String操作时间,字符串类型

增加群管理员回调

1.1 HTTP示例:

POST /receiveMsg.action HTTP/1.1
Host: yunxinservice.com.cn
AppKey: 158983881e092b052194d219453d6542
CurTime: 1541583920979
MD5: e89c284a5ad9a76b3176e23108920f81
CheckSum: 6f08c5ee2dd16a5fc34a12005e5d5f1411e657a1
Content-Type: application/json
Cache-Control: no-cache

{"eventType":11,"fromAccount":"wmtest1","fromClientType":"IOS","fromDeviceId":"6c11bb65-5506-4fdb-ac37-6ec3c8bdd220","managerList":["wmtest3"],"tid":2637250619,"timestamp":"1564575715262"}

1.2 cURL示例:

curl -X POST \
  http://yunxinservice.com.cn/receiveMsg.action \
  -H 'appkey: 158983881e092b052194d219453d6542' \
  -H 'cache-control: no-cache' \
  -H 'checksum: 6f08c5ee2dd16a5fc34a12005e5d5f1411e657a1' \
  -H 'content-type: application/json' \
  -H 'curtime: 1541583920979' \
  -H 'md5: e89c284a5ad9a76b3176e23108920f81' \
  -d '{"eventType":11,"fromAccount":"wmtest1","fromClientType":"IOS","fromDeviceId":"6c11bb65-5506-4fdb-ac37-6ec3c8bdd220","managerList":["wmtest3"],"tid":2637250619,"timestamp":"1564575715262"}'

1.3 消息体中的JSON字段说明:

回调消息中并不是每个字段都会一定抄送,请注意对各字段的判空处理。
名称类型必须说明
eventType Integer值为11,表示是增加群管理员回调
tid Long群id
fromAccount String操作者账号
fromDeviceId String操作者设备id
fromClientType String操作者客户端类型: AOS、IOS、PC、WINPHONE、WEB、REST
managerList JSONArray管理员列表
timestamp String操作时间,字符串类型

取消群管理员回调

1.1 HTTP示例:

POST /receiveMsg.action HTTP/1.1
Host: yunxinservice.com.cn
AppKey: 158983881e092b052194d219453d6542
CurTime: 1541583920979
MD5: e89c284a5ad9a76b3176e23108920f81
CheckSum: 6f08c5ee2dd16a5fc34a12005e5d5f1411e657a1
Content-Type: application/json
Cache-Control: no-cache

{"eventType":12,"fromAccount":"wmtest1","fromClientType":"IOS","fromDeviceId":"ccdb6218-8672-4aca-8e26-f8843a2c4eeb","managerList":["wmtest3"],"tid":2637250619,"timestamp":"1564575744921"}

1.2 cURL示例:

curl -X POST \
  http://yunxinservice.com.cn/receiveMsg.action \
  -H 'appkey: 158983881e092b052194d219453d6542' \
  -H 'cache-control: no-cache' \
  -H 'checksum: 6f08c5ee2dd16a5fc34a12005e5d5f1411e657a1' \
  -H 'content-type: application/json' \
  -H 'curtime: 1541583920979' \
  -H 'md5: e89c284a5ad9a76b3176e23108920f81' \
  -d '{"eventType":12,"fromAccount":"wmtest1","fromClientType":"IOS","fromDeviceId":"ccdb6218-8672-4aca-8e26-f8843a2c4eeb","managerList":["wmtest3"],"tid":2637250619,"timestamp":"1564575744921"}'

1.3 消息体中的JSON字段说明:

回调消息中并不是每个字段都会一定抄送,请注意对各字段的判空处理。
名称类型必须说明
eventType Integer值为12,表示是取消群管理员回调
tid Long群id
fromAccount String操作者账号
fromDeviceId String操作者设备id
fromClientType String操作者客户端类型: AOS、IOS、PC、WINPHONE、WEB、REST
managerList JSONArray管理员列表
timestamp String操作时间,字符串类型

转让群回调

1.1 HTTP示例:

POST /receiveMsg.action HTTP/1.1
Host: yunxinservice.com.cn
AppKey: 158983881e092b052194d219453d6542
CurTime: 1541583920979
MD5: e89c284a5ad9a76b3176e23108920f81
CheckSum: 6f08c5ee2dd16a5fc34a12005e5d5f1411e657a1
Content-Type: application/json
Cache-Control: no-cache

{"eventType":13,"fromAccount":"wmtest1","fromClientType":"IOS","fromDeviceId":"4777fe02-b9d2-42c0-9586-f29c2ca32f5d","leave":false,"tid":2637250619,"timestamp":"1564575814255","toAccount":"wmtest3"}

1.2 cURL示例:

curl -X POST \
  http://yunxinservice.com.cn/receiveMsg.action \
  -H 'appkey: 158983881e092b052194d219453d6542' \
  -H 'cache-control: no-cache' \
  -H 'checksum: 6f08c5ee2dd16a5fc34a12005e5d5f1411e657a1' \
  -H 'content-type: application/json' \
  -H 'curtime: 1541583920979' \
  -H 'md5: e89c284a5ad9a76b3176e23108920f81' \
  -d '{"eventType":13,"fromAccount":"wmtest1","fromClientType":"IOS","fromDeviceId":"4777fe02-b9d2-42c0-9586-f29c2ca32f5d","leave":false,"tid":2637250619,"timestamp":"1564575814255","toAccount":"wmtest3"}'

1.3 消息体中的JSON字段说明:

回调消息中并不是每个字段都会一定抄送,请注意对各字段的判空处理。
名称类型必须说明
eventType Integer值为13,表示是转让群回调
tid Long群id
fromAccount String操作者账号
fromDeviceId String操作者设备id
fromClientType String操作者客户端类型: AOS、IOS、PC、WINPHONE、WEB、REST
toAccount String对方账户
leave Boolean操作者是否退群
timestamp String操作时间,字符串类型

踢人出群回调

1.1 HTTP示例:

POST /receiveMsg.action HTTP/1.1
Host: yunxinservice.com.cn
AppKey: 158983881e092b052194d219453d6542
CurTime: 1541583920979
MD5: e89c284a5ad9a76b3176e23108920f81
CheckSum: 6f08c5ee2dd16a5fc34a12005e5d5f1411e657a1
Content-Type: application/json
Cache-Control: no-cache

{"eventType":14,"fromAccount":"wmtest1","fromClientType":"IOS","fromDeviceId":"15bff89f-ae12-426a-8b0e-834b78177879","kickList":["wmtest10"],"tid":2637250619,"timestamp":"1564575473172"}

1.2 cURL示例:

curl -X POST \
  http://yunxinservice.com.cn/receiveMsg.action \
  -H 'appkey: 158983881e092b052194d219453d6542' \
  -H 'cache-control: no-cache' \
  -H 'checksum: 6f08c5ee2dd16a5fc34a12005e5d5f1411e657a1' \
  -H 'content-type: application/json' \
  -H 'curtime: 1541583920979' \
  -H 'md5: e89c284a5ad9a76b3176e23108920f81' \
  -d '{"eventType":14,"fromAccount":"wmtest1","fromClientType":"IOS","fromDeviceId":"15bff89f-ae12-426a-8b0e-834b78177879","kickList":["wmtest10"],"tid":2637250619,"timestamp":"1564575473172"}'

1.3 消息体中的JSON字段说明:

回调消息中并不是每个字段都会一定抄送,请注意对各字段的判空处理。
名称类型必须说明
eventType Integer值为14,表示是踢人出群回调
tid Long群id
fromAccount String操作者账号
fromDeviceId String操作者设备id
fromClientType String操作者客户端类型: AOS、IOS、PC、WINPHONE、WEB、REST
kickList JSONArray被踢列表
timestamp String操作时间,字符串类型

更新群信息回调

1.1 HTTP示例:

POST /receiveMsg.action HTTP/1.1
Host: yunxinservice.com.cn
AppKey: 158983881e092b052194d219453d6542
CurTime: 1541583920979
MD5: e89c284a5ad9a76b3176e23108920f81
CheckSum: 6f08c5ee2dd16a5fc34a12005e5d5f1411e657a1
Content-Type: application/json
Cache-Control: no-cache

{"beinvitemode":1,"custom":"wmtest1群自定义属性122","eventType":15,"fromAccount":"wmtest1","fromClientType":"IOS","fromDeviceId":"5e4c2103-5417-4ec9-bf1a-80de992b42a8","icon":"https://nim.nosdn.127.net/MTAxMTAxMA==/bmltYV8yNDI1MTU3Nl8xNTM2NjcwOTQ3NTQxXzE0MGJmY2YyLTY0NTQtNGE3YS1iYWQ3LTk1MTg1MWFiMGU1Mg==?imageView&createTime=1536670947328?imageView&thumbnail=200x0&quality=85","invitemode":0,"teamMuteType":0,"tid":2637216281,"timestamp":"1564572978195"}

1.2 cURL示例:

curl -X POST \
  http://yunxinservice.com.cn/receiveMsg.action \
  -H 'appkey: 158983881e092b052194d219453d6542' \
  -H 'cache-control: no-cache' \
  -H 'checksum: 6f08c5ee2dd16a5fc34a12005e5d5f1411e657a1' \
  -H 'content-type: application/json' \
  -H 'curtime: 1541583920979' \
  -H 'md5: e89c284a5ad9a76b3176e23108920f81' \
  -d '{"beinvitemode":1,"custom":"wmtest1群自定义属性122","eventType":15,"fromAccount":"wmtest1","fromClientType":"IOS","fromDeviceId":"5e4c2103-5417-4ec9-bf1a-80de992b42a8","icon":"https://nim.nosdn.127.net/MTAxMTAxMA==/bmltYV8yNDI1MTU3Nl8xNTM2NjcwOTQ3NTQxXzE0MGJmY2YyLTY0NTQtNGE3YS1iYWQ3LTk1MTg1MWFiMGU1Mg==?imageView&createTime=1536670947328?imageView&thumbnail=200x0&quality=85","invitemode":0,"teamMuteType":0,"tid":2637216281,"timestamp":"1564572978195"}'

1.3 消息体中的JSON字段说明:

回调消息中并不是每个字段都会一定抄送,请注意对各字段的判空处理。
名称类型必须说明
eventType Integer值为15,表示是更新群信息回调
fromAccount String操作者账号
fromDeviceId String操作者设备id
fromClientType String操作者客户端类型: AOS、IOS、PC、WINPHONE、WEB、REST
tid Long群id
tname String群名称
icon String群头像
custom String自定义字段
intro String群简介
msg String加群信息
announcement String群公告
servercustom String服务器自定义字段
inviteList JSONArray建群时邀请的人
teamMuteType Integer群禁言类型,0表示不禁言,1表示禁言普通成员,3表示禁言整个群(包括群主)
level Integer最大群成员数量
joinmode Integer申请入群权限,0表示不需要申请,1表示需要申请,2表示不允许申请
beinvitemode Integer被邀请人同意方式,0表示需要同意,1表示不需要同意
invitemode Integer谁可以邀请他人入群,0表示管理员,1表示所有人
uptinfomode Integer谁可以修改群资料群,0表示管理员,1表示所有人
upcustommode Integer谁可以更新自定义字段,0表示管理员,1表示所有人
timestamp String操作时间,字符串类型

更新群成员信息回调

1.1 HTTP示例:

POST /receiveMsg.action HTTP/1.1
Host: yunxinservice.com.cn
AppKey: 158983881e092b052194d219453d6542
CurTime: 1541583920979
MD5: e89c284a5ad9a76b3176e23108920f81
CheckSum: 6f08c5ee2dd16a5fc34a12005e5d5f1411e657a1
Content-Type: application/json
Cache-Control: no-cache

{"eventType":16,"fromAccount":"wmtest1","fromClientType":"IOS","fromDeviceId":"bda08b34-4dff-4754-929d-e32ce10b8835","nick":"wmtest1Dagn5","notifyType":1,"tid":2637250619,"timestamp":"1564575756458"}

1.2 cURL示例:

curl -X POST \
  http://yunxinservice.com.cn/receiveMsg.action \
  -H 'appkey: 158983881e092b052194d219453d6542' \
  -H 'cache-control: no-cache' \
  -H 'checksum: 6f08c5ee2dd16a5fc34a12005e5d5f1411e657a1' \
  -H 'content-type: application/json' \
  -H 'curtime: 1541583920979' \
  -H 'md5: e89c284a5ad9a76b3176e23108920f81' \
  -d '{"eventType":16,"fromAccount":"wmtest1","fromClientType":"IOS","fromDeviceId":"bda08b34-4dff-4754-929d-e32ce10b8835","nick":"wmtest1Dagn5","notifyType":1,"tid":2637250619,"timestamp":"1564575756458"}'

1.3 消息体中的JSON字段说明:

回调消息中并不是每个字段都会一定抄送,请注意对各字段的判空处理。
名称类型必须说明
eventType Integer值为16,表示是更新群成员信息回调
fromAccount String操作者账号
fromDeviceId String操作者设备id
fromClientType String操作者客户端类型: AOS、IOS、PC、WINPHONE、WEB、REST
tid Long群id
nick String群昵称
custom String自定义字段
notifyType Integer通知类型,0表示通知,1表示关闭通知,2表示仅接受管理员消息
timestamp String操作时间,字符串类型

更新其他群成员信息回调

1.1 HTTP示例:

POST /receiveMsg.action HTTP/1.1
Host: yunxinservice.com.cn
AppKey: 158983881e092b052194d219453d6542
CurTime: 1541583920979
MD5: e89c284a5ad9a76b3176e23108920f81
CheckSum: 6f08c5ee2dd16a5fc34a12005e5d5f1411e657a1
Content-Type: application/json
Cache-Control: no-cache

{"eventType":17,"fromAccount":"wmtest1","fromClientType":"IOS","fromDeviceId":"831557c3-a892-4c37-b1e4-90b72d989c32","nick":"wmtest2-29","tid":2637250619,"timestamp":"1564575767978","toAccount":"wmtest2"}

1.2 cURL示例:

curl -X POST \
  http://yunxinservice.com.cn/receiveMsg.action \
  -H 'appkey: 158983881e092b052194d219453d6542' \
  -H 'cache-control: no-cache' \
  -H 'checksum: 6f08c5ee2dd16a5fc34a12005e5d5f1411e657a1' \
  -H 'content-type: application/json' \
  -H 'curtime: 1541583920979' \
  -H 'md5: e89c284a5ad9a76b3176e23108920f81' \
  -d '{"eventType":17,"fromAccount":"wmtest1","fromClientType":"IOS","fromDeviceId":"831557c3-a892-4c37-b1e4-90b72d989c32","nick":"wmtest2-29","tid":2637250619,"timestamp":"1564575767978","toAccount":"wmtest2"}'

1.3 消息体中的JSON字段说明:

回调消息中并不是每个字段都会一定抄送,请注意对各字段的判空处理。
名称类型必须说明
eventType Integer值为17,表示是更新其他群成员信息回调
fromAccount String操作者账号
fromDeviceId String操作者设备id
fromClientType String操作者客户端类型: AOS、IOS、PC、WINPHONE、WEB、REST
tid Long群id
toAccount String被操作者
nick String群昵称
timestamp String操作时间,字符串类型

禁言群成员回调

1.1 HTTP示例:

POST /receiveMsg.action HTTP/1.1
Host: yunxinservice.com.cn
AppKey: 158983881e092b052194d219453d6542
CurTime: 1541583920979
MD5: e89c284a5ad9a76b3176e23108920f81
CheckSum: 6f08c5ee2dd16a5fc34a12005e5d5f1411e657a1
Content-Type: application/json
Cache-Control: no-cache

{"eventType":18,"fromAccount":"wmtest1","fromClientType":"IOS","fromDeviceId":"c41545f3-7e67-49fb-a477-c82e0f235c94","mute":1,"tid":2637250619,"timestamp":"1564575792745","toAccount":"wmtest2"}

1.2 cURL示例:

curl -X POST \
  http://yunxinservice.com.cn/receiveMsg.action \
  -H 'appkey: 158983881e092b052194d219453d6542' \
  -H 'cache-control: no-cache' \
  -H 'checksum: 6f08c5ee2dd16a5fc34a12005e5d5f1411e657a1' \
  -H 'content-type: application/json' \
  -H 'curtime: 1541583920979' \
  -H 'md5: e89c284a5ad9a76b3176e23108920f81' \
  -d '{"eventType":18,"fromAccount":"wmtest1","fromClientType":"IOS","fromDeviceId":"c41545f3-7e67-49fb-a477-c82e0f235c94","mute":1,"tid":2637250619,"timestamp":"1564575792745","toAccount":"wmtest2"}'

1.3 消息体中的JSON字段说明:

回调消息中并不是每个字段都会一定抄送,请注意对各字段的判空处理。
名称类型必须说明
eventType Integer值为18,表示是禁言群成员回调
fromAccount String操作者账号
fromDeviceId String操作者设备id
fromClientType String操作者客户端类型: AOS、IOS、PC、WINPHONE、WEB、REST
tid Long群id
toAccount String被操作者
mute Integer0表示不禁言,1表示禁言
timestamp String操作时间,字符串类型

申请入群回调

1.1 HTTP示例:

POST /receiveMsg.action HTTP/1.1
Host: yunxinservice.com.cn
AppKey: 158983881e092b052194d219453d6542
CurTime: 1541583920979
MD5: e89c284a5ad9a76b3176e23108920f81
CheckSum: 6f08c5ee2dd16a5fc34a12005e5d5f1411e657a1
Content-Type: application/json
Cache-Control: no-cache

{"eventType":19,"fromAccount":"wmtest7","fromClientType":"IOS","fromDeviceId":"6faac69b-02d0-487b-a4fe-693e36af70e6","joinmode":0,"msg":"applyInfo","tid":2637216281,"timestamp":"1564573451562"}

1.2 cURL示例:

curl -X POST \
  http://yunxinservice.com.cn/receiveMsg.action \
  -H 'appkey: 158983881e092b052194d219453d6542' \
  -H 'cache-control: no-cache' \
  -H 'checksum: 6f08c5ee2dd16a5fc34a12005e5d5f1411e657a1' \
  -H 'content-type: application/json' \
  -H 'curtime: 1541583920979' \
  -H 'md5: e89c284a5ad9a76b3176e23108920f81' \
  -d '{"eventType":19,"fromAccount":"wmtest7","fromClientType":"IOS","fromDeviceId":"6faac69b-02d0-487b-a4fe-693e36af70e6","joinmode":0,"msg":"applyInfo","tid":2637216281,"timestamp":"1564573451562"}'

1.3 消息体中的JSON字段说明:

回调消息中并不是每个字段都会一定抄送,请注意对各字段的判空处理。
名称类型必须说明
eventType Integer值为19,表示是申请入群回调
fromAccount String操作者账号
fromDeviceId String操作者设备id
fromClientType String操作者客户端类型: AOS、IOS、PC、WINPHONE、WEB、REST
tid Long群id
msg String申请附言
joinmode Integer申请入群权限,0表示不需要申请,1表示需要申请,2表示不允许申请
timestamp String操作时间,字符串类型