API 参考
圈组

聊天室相关回调

更新时间: 2024/07/17 17:57:35

本文介绍聊天室登录回调的使用示例以及相关的参数说明。

本文示例代码中的 POST 接入点仅为示例,您在实际使用中需使用您在云信控制台配置的第三方回调地址。

聊天室登录回调

HTTP示例

httpPOST /receiveMsg.action HTTP/1.1
Host: yunxinservice.com.cn
AppKey: 15898388**4d219453d6542
CurTime: 1541583920979
MD5: e89c284a5ad9a76b3176e23108920f81
CheckSum: 6f08c5ee2dd16a5fc34a12005e5d5f1411e657a1
Content-Type: application/json
Cache-Control: no-cache

{"anonymous":false,"avatar":"avatar","eventType":37,"ext":"","fromAccount":"yunxin1","fromClientIp":"36.18.111.225","fromClientPort":"39632","fromClientType":"AOS","fromDeviceId":"ef6b789c-3079-463b-a52b-4924ae539e01","loginAuthType":0,"loginExt":"","nick":"云信","notifyExt":"","notifyTargetTags":"{tag:tag1} AND {tag:tag2}","roomid":0,"tags":"[tag1, tag2]","timestamp":"","token":""}

cURL示例

curlcurl -X POST \
  http://yunxinservice.com.cn/receiveMsg.action \
  -H 'appkey: 15898388**d219453d6542' \
  -H 'cache-control: no-cache' \
  -H 'checksum: 6f08c5ee2dd16a5fc34a12005e5d5f1411e657a1' \
  -H 'content-type: application/json' \
  -H 'curtime: 1541583920979' \
  -H 'md5: e89c284a5ad9a76b3176e23108920f81' \
  -d '{"anonymous":false,"avatar":"avatar","eventType":37,"ext":"","fromAccount":"yunxin1","fromClientIp":"36.18.111.225","fromClientPort":"39632","fromClientType":"AOS","fromDeviceId":"ef6b789c-3079-463b-a52b-4924ae539e01","loginAuthType":0,"loginExt":"","nick":"云信","notifyExt":"","notifyTargetTags":"{tag:tag1} AND {tag:tag2}","roomid":0,"tags":"[tag1, tag2]","timestamp":"","token":""}'

消息体中的JSON字段说明

回调消息中并不是每个字段都会一定抄送,请注意对各字段的判空处理。

名称类型必须说明
eventType Integer值为 37,表示是聊天室登录回调
fromAccount String操作者账号
fromDeviceId String操作者设备id
fromClientType String操作者客户端类型: AOS、IOS、PC、WINPHONE、WEB、REST
fromClientIp String操作者的客户端IP地址
fromClientPort String操作者的客户端端口号
token String登录token
roomid Long聊天室id
tags String操作者的标签
notifyTargetTags String通知目标用户的标签,标签表达式
anonymous Boolean是否匿名登录
nick String昵称
avatar String头像
ext String聊天室可用的扩展字段
notifyExt String进入聊天室通知开发者扩展字段
loginAuthType Integer登录鉴权方式,0表示经典模式,1表示动态token模式,2表示基于第三方回调的校验模式(该模式下云信对token不会做校验)
loginExtString 登录扩展字段
此文档是否对你有帮助?
有帮助
去反馈
  • 聊天室登录回调
  • HTTP示例
  • cURL示例
  • 消息体中的JSON字段说明