GET方式

http://www.phprm.com/services/push/send/xxxxxxxxxxxxxxx?head=msgHead&body=msgBody

说明:如遇到乱码请自行给相关参数编码,如果body太长请用POST方式, 如果需要立即跳转到自定义消息查看网址, 传递url参数为合法网址即可:

示例:http://www.phprm.com/services/push/send/4d2dac865118761a14d10d7d3afe7c35?head=测试告警&body=长内容&url=https://weibo.com

POST方式

http://www.phprm.com/services/push/send/xxxxxxxxxxxxxxxx
说明:仅支持application/json的Content-Type进行POST请求, 如果需要立即跳转到自定义消息查看网址, 传递url参数为合法网址即可。

post参数:{"head":msgHead,"body":msgBody,"url":"https://weibo.com"}
POST格式举例

POST http://www.phprm.com/services/push/send/4d2dac865118761a14d10d7d3afe7c35 HTTP/1.1

Host: www.phprm.com

User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:10.0.2) Gecko/20100101 Firefox/10.0.2

Accept-Encoding: gzip, deflate

Connection: keep-alive

Content-Type: application/json; charset=UTF-8

Content-Length: 124

Origin: http://www.phprm.com

Pragma: no-cache

Cache-Control: no-cache

Request Payload

{"head":"测试告警","body":"长内容","url":"https://weibo.com"}

GET/POST消息推送说明

1. channelCode: 创建通道后会自动给每条通道分配一个 通道码 ,如果你创建的通道是组合通道,可以绑定多个钉钉、飞书、邮箱等多个通道

2. head: 消息标题,长度200以内

3. body: 消息体内容,长度1M以内,如果数据太长请用POST方式,切记body尽量UrlEncode

4. 消息体内容 支持markdown格式,请参考markdown语法

5. 中文或其他特殊字符乱码情况下请UrlEncode处理下数据

6. 可以追加url: 跳转网址,会检测跳转网址是否合法,默认预览不需要传递url参数

7. 可以追加delayMilliseconds: 延时毫秒,最大延时推送毫秒时间不超过864000000 毫秒(10天)

自定义webhook请求参数示例(如果发送时经过API签名, 那么以下参数中也会重新生成timestamp、nonce、sign)
{
	"channelCode": "4d2dac865118761a14d10d7d3afe7c35",
	"channelName": "示例通道",
	"eventType": 4,
	"messageId": "1154161735171727360",
	"pushTime": "2019-11-11 00:00:00",
	"data": {
		"head": "测试告警",
		"body": "长内容",
		"url": "http://push.phprm.com/api.html"
	}
}

1. 自定义webhook 仅发起post请求, 请求Content-Type: application/json; charset=UTF-8

2. 鉴于自定义webhook网址的稳定性, API在回调时最长请求超时为10秒, 最大尝试次数为3次

二、口令提醒推送API(支持消息推送API所有特性, 扩展了quartz表达式以及参数映射功能)

发送提醒接口,支持仅提醒一次功能,支持GET或者POST请求方式,API支持https协议,具体文档查看移动端文档

为了更好地适配其他外部系统, 移动端口令提醒支持标题/内容/跳转网址参数自动映射,无需修改代码也可以快速接入提醒功能,支持Server酱、网页更新提醒推送转移到本系统;

移动端还提供了禁止新成员加入功能、推送时间范围设置功能, 非推送时间将不会推送打扰到您,即使二维码泄露也不会有人误扫二维码加入通道;

移动端还支持@所有人功能,开启后提醒下所有群机器人通道将具备@所有人特性,手机会发出提示音+顶部消息通知,不会漏看消息。

文档中心提供了更加全面的API介绍以及推送样例代码、样例截图,点击查看

GET方式(API和send完全相同,具备send所有特性之外, 还扩展了预设标题、预设内容、触发次数限制功能)

http://www.phprm.com/services/push/trigger/xxxxxxxxxxxxxxx?head=msgHead&body=msgBody

说明:如遇到乱码请自行给相关参数编码,如果body太长请用POST方式, 如果需要立即跳转到自定义消息查看网址, 传递url参数为合法网址即可:

示例:http://www.phprm.com/services/push/trigger/4d2dac865118761a14d10d7d3afe7c35?head=测试告警&body=长内容&url=https://weibo.com

POST方式(API和send完全相同,具备send所有特性之外, 还扩展了预设标题、预设内容、触发次数限制、参数映射功能)

http://www.phprm.com/services/push/trigger/xxxxxxxxxxxxxxxx
说明:仅支持application/json的Content-Type进行POST请求, 如果需要跳转到自定义消息查看网址, 传递url参数即可。另外支持高级高能,具体文档查看移动端文档

post参数:{"head":msgHead,"body":msgBody,"url":"https://weibo.com"}

三、消息查询API

消息推送口令提醒,推送成功都会返回messageIdList,可以使用英文,连接多个消息ID,传递给http://www.phprm.com/services/push/sendMessageResult/xxxxxxxxxxxxxxx?messageIds=消息ID, 进行GET查询

示例:http://www.phprm.com/services/push/sendMessageResult/c27ef861da4b29e14712a5c55d3c4010?messageIds=1205957302260228096,1205957305749889024

Tips:最大数量不能超过5个messageId批量查询,文档中心提供了更加全面的API介绍以及查询样例代码、样例截图,点击查看

消息ID批量查询响应内容
{
	"code": 0,
	"message": "请求成功",
	"data": {
		"1205957302260228096": {
			"messageId": "1205957302260228096",
			"pushTypeDesc": "官方邮件",
			"pushedCount": 1,
			"viewCount": "0",
			"triggerTimeList": ["2023-02-10 19:23:46"],
			"handleTimeList": ["2023-02-10 19:23:49"],
			"readTimeList": [null],
			"handleCodeList": ["0"],
			"handleMsgList": [null]
		}
	}
}

1. messageId作为data数据对象的Key,pushTypeDesc标识该推送通道的类型,pushedCount标识成功推送人次,viewCount标识该通道阅读人次。

2. triggerTimeList是您调用接口后系统分配推送任务的时间,handleTimeList是推送结束的时间,handleCodeList和handleMsgList是推送结束记录的错误码和错误信息,为0或者为空标识无错误

PHP webhook推送方举例(使用send、trigger均可)
<?php
// 通道码
$channelCode = "540747bd92cc537a";
// 通道secret
$signSecret = "abc";

// 获取毫秒时间戳
$timestamp = time()."000";
// 生成32位长度的随机码
$nonce = md5(uniqid());
// 生成签名
$sign = md5("{$timestamp}#{$signSecret}#{$nonce}");

// 标题为必传参数, 内容参数非必传但支持markdown语法
$head = "这是标题";
$body = "这是内容";

// 建议使用curl发送GET或者POST请求, 这里使用系统函数模拟
echo file_get_contents("http://www.phprm.com/services/push/send/{$channelCode}?head=".urlencode($head)."&timestamp={$timestamp}&nonce={$nonce}&sign={$sign}&body=".urlencode($body));

PHP webhook接收方举例
<?php
// 不加签时仅需要这一句即可获取到所有POST请求接收到json数据
$raw = file_get_contents("php://input");
$info = json_decode($raw, true);
$signSecret = "abc";

if(isset($info["sign"]) && isset($info["nonce"]) && isset($info["timestamp"])) {
	// 验签: md5(timestamp#signSecret#nonce)
	$serverSign = md5("{$info["timestamp"]}#{$signSecret}#{$info["nonce"]}");
	if($serverSign == $info["sign"]) {
		// 执行webhook通知业务逻辑
		exit();
	}
}
echo "permission deny";

四、进阶——MCP、SKILL

1. 一封传话支持通过 Model Context Protocol (MCP) 与 AI 助手(如 Trae, Claude, Cursor, OpenClaw 等)深度集成,让 AI 助手能够主动向您汇报任务成果或发送重要通知;

2. Model Context Protocol (MCP) 是一个开放协议,旨在标准化 AI 助手如何与其工作所在的外部工具和资源进行通信。通过添加一封传话的 MCP 服务器,您可以赋予您的 AI 助手发送通知和汇报进度的能力;

3. push-server-skill 是基于 pushServer MCP 构建的高级技能,旨在让 AI 助手以更结构化的方式报告任务。

MCP & SKILL 配置,请直接将下面的markdown文档喂给AI助手安装skill即可
---
name: "push-server-skill"
description: "Sends push notifications via the internal pushServer MCP. Invoke to report task results or send rich text notifications to the user."
---

# Push Server Skill

This skill allows the AI to report task outcomes or send important notifications to the user through the internal `pushServer` MCP.

## When to Invoke
- After completing a significant coding task or milestone.
- When the user explicitly asks for a notification or result report.
- To send rich-text (HTML、Markdown) formatted results to the user's notification channel.

## 配置说明 (用户必读)
使用此技能前,请添加以下MCP服务器:
- **名称**: `pushServer`
- **URL**: `https://www.phprm.com/services/push/mcp`
- **Headers**:
  - `X-Push-Channel-Code`: `您的32位通道码` (必须配置,否则无法接收推送)
  - `X-Mcp-Source`: `您的项目名称` (可选)

## 使用规范
1. **内容要求**:
   - **标题 (`head`)**: 必须为纯文本,支持 Unicode,长度限制 200 字符以内。
   - **内容 (`body`)**: (可选) 建议使用 **Markdown** 格式进行排版(如使用标题、列表、代码块等),长度限制 50,000 字符以内。
   - **跳转 (`url`)**: (可选) 如果有相关的网页链接(如 PR 地址、构建日志等),请提供 URL 供用户点击跳转,长度限制 500 字符以内。
   - **指定通道码 (`channelCode`)**: (可选) 覆盖 Header 中的通道码,不指定时将以 Header 中预设X-Push-Channel-Code进行推送。

2. **识别结果**: 任务完成后,自动将核心成果总结为符合上述规范的推送内容。如果任务非常简单,可以只提供 `head`。
3. **格式化**: 如果提供 `body`,请确保 Markdown 语法正确,以提供最佳的阅读体验。
4. **调用工具**: 使用 `pushServer` MCP 工具 `send_push_message`:
   - `head`: 任务简述。
   - `body`: (可选) Markdown 格式的详细汇报。
   - `url`: (可选) 目标链接。
   - `channelCode`: (可选,是否指定channelCode进行推送,不指定时将以 Header 中预设X-Push-Channel-Code进行推送)。

## 示例
- **任务汇报**:
  - head: "代码优化完成"
  - body: "**优化清单**\n- **性能**: 减少了冗余的会话查找\n- **稳定性**: 增加了异常捕获\n