new SystemMessage(env)
系统通知
系统通知分为两种
Parameters:
| Name | Type | Description |
|---|---|---|
env |
String | 环境变量,用于指向不同的抄送、第三方回调等配置 |
- 在
支持数据库时可以调用更新本地系统通知来更新此字段, 此字段只会被更新到本地数据库, 不会被更新到服务器上 - 推荐使用
JSON格式构建, 非JSON格式的话, Web端会正常接收, 但是会被其它端丢弃 true时只发送给在线用户, 适合发送即时通知, 比如正在输入。false时假如目标用户或群不在线, 会在其上线后推送过去。- 该参数只对点对点自定义系统通知有效, 对群自定义系统通知无效, 群自定义系统通知只会发给在线的群成员, 不会存离线。
Properties:
| Name | Type | Argument | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
time |
Number | 时间戳 |
|||||||||
type |
String |
<optional> |
|||||||||
from |
String | 系统通知的来源, 账号或者群ID |
|||||||||
to |
String | 系统通知的目标, 账号或者群ID |
|||||||||
idServer |
String |
<optional> |
内建系统通知的 idServer |
||||||||
read |
Boolean |
<optional> |
内建系统通知是否已读 |
||||||||
category |
String |
<optional> |
|||||||||
state |
String |
<optional> |
内建系统通知的 |
||||||||
error |
NIMError |
<optional> |
内建系统通知的 |
||||||||
localCustom |
String |
<optional> |
内建系统通知的本地自定义扩展字段 |
||||||||
ps |
String |
<optional> |
内建系统通知的附言 |
||||||||
attach |
Object |
<optional> |
内建系统通知的附加信息, 参考 Properties
|
||||||||
scene |
String |
<optional> |
自定义系系统通知的场景, 参考 |
||||||||
content |
String |
<optional> |
自定义系统通知的内容 |
||||||||
isPushable |
Boolean | 是否需要推送 |
|||||||||
apnsText |
String |
<optional> |
自定义系统通知的推送文案, 仅对接收方为iOS设备有效 |
||||||||
pushPayload |
String |
<optional> |
自定义系统通知的推送属性 |
||||||||
needPushNick |
Boolean | 是否需要推送昵称 |
|||||||||
sendToOnlineUsersOnly |
Boolean |
<optional> |
自定义系统通知是否只发送给在线用户。 |
||||||||
cc |
Boolean | 自定义系统通知是否抄送 |
Members
-
<static, readonly> category :String
-
内建系统通知的种类
'team''friend'
Type:
- String
-
<static, readonly> state :String
-
内建系统通知的状态
'init': 未处理状态'passed': 已通过'rejected': 已拒绝'error': 错误
Type:
- String
-
<static, readonly> type :String
-
系统通知类型
'addFriend'直接加某个用户为好友后, 对方不需要确认, 直接成为当前登录用户的好友。- 对方会收到一条类型为
'addFriend'的系统通知, 此类系统通知的from字段的值为申请方的帐号,to字段的值为接收方的账号。
'applyFriend''passFriendApply'- 见
'applyFriend'
- 见
'rejectFriendApply'- 见
'applyFriend'
- 见
'deleteFriend''teamInvite''rejectTeamInvite'- 见
'teamInvite'
- 见
'applyTeam''rejectTeamApply'- 见
'applyTeam'
- 见
'applySuperTeam'- 用户可以主动
申请加入高级群, 目标群的群主和管理员会收到一条类型为'applySuperTeam'的系统通知, 此类系统通知的from字段的值为申请方的帐号,to字段的值为对应的群ID, 高级群的群主和管理员在收到入群申请后, 可以选择通过或者拒绝入群申请。- 如果
通过入群申请, 那么该群的所有群成员会收到一条类型为'passSuperTeamApply'的群通知消息, 此类群通知消息的from字段的值为通过入群申请的人的帐号,to字段的值为对应的群ID,attach有一个字段team的值为对应的超大群对象,attach有一个字段account包含了申请方的帐号,attach有一个字段members的值为被通过申请的群成员列表。 - 如果
拒绝入群申请, 那么申请人会收到一条类型为'rejectSuperTeamApply'的系统通知, 此类系统通知的from字段的值为拒绝方的帐号,to字段的值为对应的群ID,attach有一个字段team的值为对应的超大群。
- 如果
- 用户可以主动
'rejectSuperTeamApply'- 见
'applySuperTeam'
- 见
'superTeamInvite''rejectSuperTeamInvite'- 见
'superTeamInvite'
- 见
'deleteMsg''custom'- 自定义系统通知
Type:
- String