通知按钮
概述
通知按钮通过button
键值进行控制,可设置三个按钮(button_1
、button_2
、button_3
),见下文示例。每个按钮通过name
、actionType
和action
三个键值进行控制,其中name
为按钮在通知栏的显示名称。支持以下几种使用方式,其中0~5的定义与通知点击动作相同。
actionType | 0~5 | 6 | 7 | 8 | 9 |
---|---|---|---|---|---|
action | 同通知点击动作 | 标记为已读 | 标记为删除 | HTTP 请求 | 朗读 |
{
"data": {
"uuid": "CWYMVYWQHoPGXEkh9yP5Nd",
"ttl": 86400,
"priority": "high",
"data": {
...
"button": {
"button_1": {
"actionType": 2,
"name": "打开 QQ",
"action": "com.tencent.mobileqq"
},
"button_2": {
"actionType": 5,
"name": "复制验证码",
"action": ""
},
"button_3": {
"actionType": 6,
"name": "标记为已读",
"action": ""
}
},
...
}
}
}
标记为已读
- 当
actionType
(int)为6
时(action
无需设置),点击按钮会将该条消息标记为已读。
示例
{
"data": {
"uuid": "CWYMVYWQHoPGXEkh9yP5Nd",
"ttl": 86400,
"priority": "high",
"data": {
...
"button": {
"button_1": {
"actionType": "6",
"name": "标记为已读"
}
},
...
}
}
}
标记为删除
- 当
actionType
(int)为7
时(action
无需设置),点击按钮会将该条消息标记为删除,在回收站中可见 。
示例
{
"data": {
"uuid": "CWYMVYWQHoPGXEkh9yP5Nd",
"ttl": 86400,
"priority": "high",
"data": {
...
"button": {
"button_1": {
"actionType": "7",
"name": "标记为删除"
}
},
...
}
}
}
HTTP 请求
- 当
actionType
(int)为8
,action
(obj)可设置为如下 JSON 数据格式,点击按钮将发送 HTTP 请求。 content
可使用变量${time}
(发送请求的时间,例如2025-07-21 16:49:13
)、${timestamp}
(发送请求的时间戳)。
示例
{
"data": {
"uuid": "CWYMVYWQHoPGXEkh9yP5Nd",
"ttl": 86400,
"priority": "high",
"data": {
...
"button": {
"button_1": {
"actionType":"8",
"name": "发送请求",
"action":{
"url": "https://aaa.bbb.com",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer xyz123",
"User-Agent": "NotifyMe/1.0"
},
"contentType": "application/json",
"content": {
"test": "1234",
"time": "${time}",
"timestamp": "${timestamp}"
}
}
}
},
...
}
}
}
朗读
- 当
actionType
(int)为9
时,action
(obj)可设置为如下 JSON 数据格式,点击按钮会自动朗读消息内容(即body
),再次点击按钮即停止朗读。 - 不设置
action
时,将使用系统默认 tts 设置。
JSON 数据说明
speed
:朗读语速,部分引擎可能无法设置;pitch
:朗读语调,部分引擎可能无法设置;engine
:朗读引擎,朗读引擎的包名,可自行安装 tts 引擎。