NetEaseIM
class NetEaseIM (View source)
网易云信API
Traits
Properties
protected | $debug | ||
protected | $baseUrl | ||
protected | $client | ||
protected | $appKey | ||
protected | $appSecret | ||
protected string | $Nonce | ||
protected int | $CurTime | ||
protected | $CheckSum |
Methods
发送短信/语音短信验证码
发送模板短信
查询通知类和运营类短信发送状态 根据短信的sendid(sendtemplate.action接口中的返回值),查询短信发送结果。
创建云信ID 1.第三方帐号导入到云信平台; 2.注意accid,name长度以及考虑管理秘钥token
更新云信ID
更新用户名片
账号全局禁言 设置或取消账号的全局禁言状态;账号被设置为全局禁言后,不能发送“点对点”、“群”、“聊天室”消息
账号全局禁用音视频 账号被设置为禁用音视频后,不能发起点对点音视频、创建多人音视频、发起点对点白板、创建多人白板
添加好友
设置黑名单/静音
单聊云端历史消息查询
群聊云端历史消息查询
聊天室云端历史消息查询 此接口有频控限制,每分钟可调用不超过1200次
删除聊天室云端历史消息
用户登录登出事件记录查询 跟据时间段查询用户的登录登出记录,每次最多返回100条。 不提供分页支持,第三方需要跟据时间段来查询。
批量查询广播消息
创建聊天室
批量查询聊天室信息
更新聊天室信息
修改聊天室开/关闭状态
设置聊天室内用户角色
请求聊天室地址与令牌
发送聊天室消息
发送聊天室文字消息封装
往聊天室内添加机器人,机器人过期时间为24小时。
将聊天室内成员设置为临时禁言
往聊天室有序队列中新加或更新元素
设置聊天室整体禁言状态(仅创建者和管理员能发言)
查询聊天室统计指标TopN
分页获取成员列表
变更聊天室内的角色信息
批量更新聊天室队列元素
创建群组
拉人入群
更新群组
群信息与成员列表查询 高级群信息与成员列表查询,一次最多查询30个群相关的信息,跟据ope参数来控制是否带上群成员列表; 查询群成员会稍微慢一些,所以如果不需要群成员列表可以只查群信息; 此接口受频率控制,某个应用一分钟最多查询30次,超过会返回416,并且被屏蔽一段时间; 群成员的群列表信息中增加管理员成员admins的返回
获取群组已读消息的已读详情信息
移交群主 转换群主身份; 群主可以选择离开此群,还是留下来成为普通成员。
任命管理员 提升普通成员为群管理员,可以批量,但是一次添加最多不超过10个人。
移除管理员 解除管理员身份,可以批量,但是一次解除最多不超过10个人
修改群昵称
禁言群成员
发送普通消息
给个人发送文本消息封装
给个人发送自定义消息封装
批量发送点对点普通消息 1.给用户发送点对点普通消息,包括文本,图片,语音,视频,地理位置和自定义消息。 2.最大限500人,只能针对个人,如果批量提供的帐号中有未注册的帐号,会提示并返回给用户。 3.此接口受频率控制,一个应用一分钟最多调用120次,超过会返回416状态码,并且被屏蔽一段时间; 具体消息参考官方文档。
发送自定义系统通知 1.自定义系统通知区别于普通消息,方便开发者进行业务逻辑的通知; 2.目前支持两种类型:点对点类型和群类型(仅限高级群),根据msgType有所区别。 应用场景:如某个用户给另一个用户发送好友请求信息等,具体attach为请求消息体,第三方可以自行扩展,建议是json格式
批量发送点对点自定义系统通知 1.系统通知区别于普通消息,应用接收到直接交给上层处理,客户端可不做展示; 2.目前支持类型:点对点类型; 3.最大限500人,只能针对个人,如果批量提供的帐号中有未注册的帐号,会提示并返回给用户; 4.此接口受频率控制,一个应用一分钟最多调用120次,超过会返回416状态码,并且被屏蔽一段时间; 应用场景:如某个用户给另一个用户发送好友请求信息等,具体attach为请求消息体,第三方可以自行扩展,建议是json格式
文件上传 文件上传,字符流需要base64编码,最大15M。
文件上传(multipart方式) 文件上传,最大15M
消息撤回 消息撤回接口,可以撤回一定时间内的点对点与群消息
发送广播消息 1、广播消息,可以对应用内的所有用户发送广播消息,广播消息目前暂不支持第三方推送(APNS、小米、华为等); 2、广播消息支持离线存储,并可以自定义设置离线存储的有效期,最多保留最近100条离线广播消息; 3、此接口受频率控制,一个应用一分钟最多调用10次,一天最多调用1000次,超过会返回416状态码; 4、该功能目前需申请开通,详情可咨询您的客户经理。
NetEaseIM constructor.
组装网易云接口必要数据,发送http post请求
设置\GuzzleHttp\Client调试
布尔转字符串
数组检查追加
Details
array
smsSendcode(string $mobile, int $templateid, int $authCode = null, int $codeLen = 4, string $deviceId = null, bool $needUp = false)
发送短信/语音短信验证码
array
smsSendtemplate(int $templateid, array $mobiles, array $params = [], bool $needUp = false)
发送模板短信
array
smsQuerystatus(int $sendid)
查询通知类和运营类短信发送状态 根据短信的sendid(sendtemplate.action接口中的返回值),查询短信发送结果。
array
userCreateUserId(string $accid, string $mobile = '', string $name = '', int $gender = 0, array $props = [], string $icon = '', string $token = '', string $sign = '', string $email = '', string $birth = '', string $ex = '')
创建云信ID 1.第三方帐号导入到云信平台; 2.注意accid,name长度以及考虑管理秘钥token
array|bool
userUpdateUserId(string $accid, string $name = '', array $props = [], string $token = '')
更新云信ID
bool|array
userUpdateUserInfo(string $accId, string $name = null, string $icon = null, string $sign = null, string $email = null, string $birth = null, string $mobile = null, string $gender = null, string $ex = null)
更新用户名片
bool|array
userSetDonnop(string $accId, bool $donnopOpen = false)
设置桌面端在线时,移动端是否需要推送
bool|array
userMute(string $accid, bool $mute = true)
账号全局禁言 设置或取消账号的全局禁言状态;账号被设置为全局禁言后,不能发送“点对点”、“群”、“聊天室”消息
bool|array
userMuteAv(string $accid, bool $mute = true)
账号全局禁用音视频 账号被设置为禁用音视频后,不能发起点对点音视频、创建多人音视频、发起点对点白板、创建多人白板
bool|array
userAddFriend(string $accId, string $fAccId, string $type, string $msg = '')
添加好友
bool|array
userUpdateFriend(string $accId, string $fAccId, string $alias)
更新好友相关信息
bool|array
userSetSpecialRelation(string $accId, string $targetAcc, int $relationType, int $value)
设置黑名单/静音
in HistoryTrait at line 39
array
historyQuerySessionMsg(string $from, string $to, string $begintime, string $endtime = null, int $limit = 100, int $reverse = 2, string $type = null)
单聊云端历史消息查询
in HistoryTrait at line 69
array
historyQueryTeamMsg(string $tid, string $accid, string $begintime, string $endtime = null, int $limit = 100, int $reverse = 2, string $type = null)
群聊云端历史消息查询
in HistoryTrait at line 100
array
historyQueryChatroomMsg(int $roomid, string $accid, string $timetag, int $limit = 100, int $reverse = 2, string $type = null)
聊天室云端历史消息查询 此接口有频控限制,每分钟可调用不超过1200次
in HistoryTrait at line 125
bool|array
historyDeleteHistoryMessage(int $roomid, string $fromAcc, int $msgTimetag)
删除聊天室云端历史消息
in HistoryTrait at line 151
array
historyQueryUserEvents(string $accid, string $begintime, string $endtime, int $limit = 100, int $reverse = 2)
用户登录登出事件记录查询 跟据时间段查询用户的登录登出记录,每次最多返回100条。 不提供分页支持,第三方需要跟据时间段来查询。
in HistoryTrait at line 173
array|bool
historyDeleteMediaFile(int $channelid)
删除音视频/白板服务器录制文件
in HistoryTrait at line 190
array
historyQueryBroadcastMsg(int $broadcastId = 0, int $limit = 100, int $type = 1)
批量查询广播消息
in HistoryTrait at line 210
array
historyQueryBroadcastMsgById(int $broadcastId)
查询单条广播消息
in ChatRoomTrait at line 68
array
chatRoomCreate(string $creator, string $name, string $announcement, string $broadcastUrl, array $ext = [])
创建聊天室
in ChatRoomTrait at line 91
array
chatRoomGet(int $roomid, bool $needOnlineUserCount = false)
查询聊天室信息
in ChatRoomTrait at line 108
array
chatRoomGetBatch(array $roomids, bool $needOnlineUserCount = false)
批量查询聊天室信息
in ChatRoomTrait at line 132
array
chatRoomUpdate(int $roodId, string $name = '', string $announcement = '', string $broadcastUrl = '', array $ext = [], bool $needNotify = true, array $notifyExt = [])
更新聊天室信息
in ChatRoomTrait at line 166
array
chatRoomToggleCloseStatus(int $roomid, string $operator, bool $valid)
修改聊天室开/关闭状态
in ChatRoomTrait at line 204
array
chatRoomSetMemberRole(int $roomid, string $operator, string $target, string $opt, bool $optValue, array $notifyExt = [])
设置聊天室内用户角色
in ChatRoomTrait at line 237
array
chatRoomRequestAddress(int $roomid, string $accId, int $clientType = null)
请求聊天室地址与令牌
in ChatRoomTrait at line 272
array
chatRoomSendMsg(int $roomid, string $msgId, string $fromAccId, int $msgType = null, int $resendFlag = 0, array $attach = [], array $ext = [], bool $highPriority = false)
发送聊天室消息
in ChatRoomTrait at line 311
array
chatRoomSendTxtMessage(int $roomid, string $msgId, string $fromAccId, string $msg, int $resendFlag = 0, array $ext = [])
发送聊天室文字消息封装
in ChatRoomTrait at line 340
array
chatRoomAddRobot(int $roomid, array $accIds, array $roleExt = [], array $notifyExt = [])
往聊天室内添加机器人,机器人过期时间为24小时。
in ChatRoomTrait at line 362
array
chatRoomRemoveRobot(int $roomid, array $accIds)
从聊天室内删除机器人
in ChatRoomTrait at line 386
array
chatRoomTemporaryMute(int $roomid, string $operator, string $target, string $muteDuration, bool $needNotify = true, array $notifyExt = [])
将聊天室内成员设置为临时禁言
in ChatRoomTrait at line 413
array|bool
chatRoomQueueOffer(int $roomid, string $key, string $value, string $operator = null, string $transient = null)
往聊天室有序队列中新加或更新元素
in ChatRoomTrait at line 436
array
chatRoomQueuePoll(int $roomid, string $key)
从队列中取出元素
in ChatRoomTrait at line 455
array
chatRoomQueueList(int $roomid)
排序列出队列中所有元素
in ChatRoomTrait at line 470
array|bool
chatRoomQueueDrop(int $roomid)
删除清理整个队列
in ChatRoomTrait at line 487
bool|array
chatRoomQueueInit(int $roomid, int $sizeLimit)
初始化队列
in ChatRoomTrait at line 510
array|bool
chatRoomMuteRoom(int $roomid, string $operator, bool $mute = false, bool $needNotify = true, string $notifyExt = '')
设置聊天室整体禁言状态(仅创建者和管理员能发言)
in ChatRoomTrait at line 535
array
chatRoomTopn(int $topn = 100, int $timestamp = null, string $period = 'day', string $orderby = 'active')
查询聊天室统计指标TopN
in ChatRoomTrait at line 559
array
chatRoomMembersByPage(int $roomid, int $type = 0, int $endtime = 0, int $limit = 100)
分页获取成员列表
in ChatRoomTrait at line 581
array
chatRoomQueryMembers(int $roomid, array $accids)
批量获取在线成员信息
in ChatRoomTrait at line 607
array|bool
chatRoomUpdateMyRoomRole(int $roomid, string $accid, bool $save = false, bool $needNotify = false, string $notifyExt = '', string $nick = '', string $avator = '', string $ext = '')
变更聊天室内的角色信息
in ChatRoomTrait at line 636
array
chatRoomQueueBatchUpdateElements(int $roomid, string $operator, array $elements, bool $needNotify = true, string $notifyExt = '')
批量更新聊天室队列元素
in ChatRoomTrait at line 658
array
chatRoomQueryUserRoomIds(string $creator)
查询用户创建的开启状态聊天室列表
array
teamCreate(string $tname, string $owner, string $icon, array $members, string $custom = '', string $msg = 'msg', string $announcement = '', string $intro = '', int $mAgree = null, int $joinMode = null, int $beInviteMode = null, int $inviteMode = null, int $uptInfoMode = null, int $upCustomMode = null)
创建群组
创建高级群,以邀请的方式发送给用户; custom 字段是给第三方的扩展字段,第三方可以基于此字段扩展高级群的功能,构建自己需要的群; 建群成功会返回tid,需要保存,以便于加人与踢人等后续操作; 每个用户可创建的群数量有限制,限制值由 IM 套餐的群组配置决定,可登录管理后台查看。
array
teamAdd(string $tid, string $owner, array $members, string $msg, int $mAgree = null, string $attach = '')
拉人入群
array|bool
teamKick(string $tid, string $owner, string $member, string $attach)
踢人出群
array|bool
teamUpdate(string $tid, string $tname, string $owner, string $icon = '', string $custom = '', string $announcement = '', string $intro = '', int $joinMode = null, int $beInviteMode = null, int $inviteMode = null, int $uptInfoMode = null, int $upCustomMode = null)
更新群组
array
teamQuery(array $tids, int $ope = null)
群信息与成员列表查询 高级群信息与成员列表查询,一次最多查询30个群相关的信息,跟据ope参数来控制是否带上群成员列表; 查询群成员会稍微慢一些,所以如果不需要群成员列表可以只查群信息; 此接口受频率控制,某个应用一分钟最多查询30次,超过会返回416,并且被屏蔽一段时间; 群成员的群列表信息中增加管理员成员admins的返回
array
teamGetMarkReadInfo(string $tid, string $msgid, string $fromAccid, bool $snapshot = false)
获取群组已读消息的已读详情信息
array|bool
TeamChangeOwner(string $tid, string $owner, string $newOwner, int $leave = null)
移交群主 转换群主身份; 群主可以选择离开此群,还是留下来成为普通成员。
array|bool
teamAddManager(string $tid, string $owner, array $members)
任命管理员 提升普通成员为群管理员,可以批量,但是一次添加最多不超过10个人。
array|bool
teamRemoveManager(string $tid, string $owner, array $members)
移除管理员 解除管理员身份,可以批量,但是一次解除最多不超过10个人
array|bool
teamUpdateTeamNick(string $tid, string $owner, string $accid, string $nick, string $custom = '')
修改群昵称
array|bool
teamMuteTlist(string $tid, string $owner, string $accid, int $mute = 0)
禁言群成员
array|bool
teamMuteTlistAll(string $tid, string $owner, int $mute = 0)
将群组整体禁言
in MessageTrait at line 81
array
messageSendMsg(string $from, string $ope, string $to, string $type, array $body, array $option = [], string $pushContent = '', array $payload = [], array $ext = [], array $forcePushList = [], string $forcePushContent = '', bool $forcePushAll = false)
发送普通消息
in MessageTrait at line 140
array
messageSendTxtMsgToUser(string $from, string $to, string $msg, string $pushContent)
给个人发送文本消息封装
in MessageTrait at line 161
array
messageSendCustomMsgToUser(string $from, string $to, string $msg, string $pushContent)
给个人发送自定义消息封装
in MessageTrait at line 192
array
messageMsgSendBatchMsg($fromAccid, $toAccids, $type, array $body, array $option = [], string $pushcontent = '', string $payload = '', array $ext = [], string $bid = '', string $useYidun = '')
批量发送点对点普通消息 1.给用户发送点对点普通消息,包括文本,图片,语音,视频,地理位置和自定义消息。 2.最大限500人,只能针对个人,如果批量提供的帐号中有未注册的帐号,会提示并返回给用户。 3.此接口受频率控制,一个应用一分钟最多调用120次,超过会返回416状态码,并且被屏蔽一段时间; 具体消息参考官方文档。
in MessageTrait at line 244
bool|array
messageMsgSendAttachMsg(string $from, int $msgtype, string $to, array $attach, array $option = [], string $pushcontent = '', string $payload = '', string $sound = '', int $save = 2)
发送自定义系统通知 1.自定义系统通知区别于普通消息,方便开发者进行业务逻辑的通知; 2.目前支持两种类型:点对点类型和群类型(仅限高级群),根据msgType有所区别。 应用场景:如某个用户给另一个用户发送好友请求信息等,具体attach为请求消息体,第三方可以自行扩展,建议是json格式
in MessageTrait at line 293
array
messageMsgSendBatchAttachMsg($fromAccid, $toAccids, $attach, $option = [], $pushcontent = '', $payload = '', $sound = '', $save = 2)
批量发送点对点自定义系统通知 1.系统通知区别于普通消息,应用接收到直接交给上层处理,客户端可不做展示; 2.目前支持类型:点对点类型; 3.最大限500人,只能针对个人,如果批量提供的帐号中有未注册的帐号,会提示并返回给用户; 4.此接口受频率控制,一个应用一分钟最多调用120次,超过会返回416状态码,并且被屏蔽一段时间; 应用场景:如某个用户给另一个用户发送好友请求信息等,具体attach为请求消息体,第三方可以自行扩展,建议是json格式
in MessageTrait at line 333
string|array
messageMsgUpload($content, string $type = '', string $ishttps = '', string $expireSec = '', string $tag = '')
文件上传 文件上传,字符流需要base64编码,最大15M。
in MessageTrait at line 359
string|array
messageMsgFileUpload($content, string $type = '', string $ishttps = '', string $expireSec = '', string $tag = '')
文件上传(multipart方式) 文件上传,最大15M
in MessageTrait at line 387
bool|array
messageMsgRecall(string $deleteMsgid, int $timetag, int $type, string $from, string $to, string $msg = '', string $ignoreTime = '')
消息撤回 消息撤回接口,可以撤回一定时间内的点对点与群消息
in MessageTrait at line 419
array
messageMsgBroadcastMsg(string $body, string $from = '', bool $isOffline = false, int $ttl = 168, array $targetOs = [])
发送广播消息 1、广播消息,可以对应用内的所有用户发送广播消息,广播消息目前暂不支持第三方推送(APNS、小米、华为等); 2、广播消息支持离线存储,并可以自定义设置离线存储的有效期,最多保留最近100条离线广播消息; 3、此接口受频率控制,一个应用一分钟最多调用10次,一天最多调用1000次,超过会返回416状态码; 4、该功能目前需申请开通,详情可咨询您的客户经理。
at line 56
__construct($appKey = null, $appSecret = null)
NetEaseIM constructor.
at line 74
mixed
post($url, $data)
组装网易云接口必要数据,发送http post请求
at line 147
void
setDebug(bool $debug)
设置\GuzzleHttp\Client调试
at line 157
string
boolConvertToString(bool $bool)
布尔转字符串
at line 169
array
arrCheckAndPush($array, string $key, string $value)
数组检查追加