Message Push Service

把消息推送到手机或邮箱的通知服务。当前接入 Server酱(微信推送)、邮件、邮件定时推送 3 条线路,后续可继续扩展更多推送平台/线路。

/api/push/

Service Description

消息推送服务把「服务器 / 脚本 / 设备上发生的事」发送到手机或邮箱,适合告警、任务完成通知、定时任务结果汇总等场景。当前有 3 条线路:Server酱(微信推送)、邮件 与 邮件定时推送。

Which channel the message actually reaches (WeChat service account, WeCom app message, WeCom/DingTalk/Feishu group bot, Bark, PushDeer or a custom webhook) is decided by the channel configuration in the ServerChan console — switching channels requires no code change.

The SendKey is hosted server-side: add an account whose platform is "ServerChan" in the superadmin console's Account Management, and put the SendKey in the credential field (stored encrypted, never shown on pages). Callers neither need to nor should pass a SendKey.

The email channel comes from the former Email Service's send feature: POST /api/push/email/send and the old /api/email/v1/send share one implementation with identical parameters and response, and the old route keeps working.

邮件定时推送线路用于「不守着也要按时发」的场景:创建一份推送计划,由站内常驻调度线程到点自动发送 —— 可只发一次,也可每 N 分钟重复发送;停机后再启动会自动补发,不会漏发。任务按接入项目隔离。

These endpoints require a project signature; every push leaves a record in the console's Push Logs (both successes and failures).

Response Format

Every endpoint returns the same JSON envelope; the payload is always inside data:

{
  "code": 10000,
  "msg": "成功",
  "data": { ... }
}
  • code: business status code. 10000 means success; anything else is an error — see the Error Codes page for the full list.
  • msg: a human-readable message you can show to end users, but never use it for program logic.
  • data: the payload; usually null on error. Each endpoint's Response section lists its data fields.

Judge success by code, not by the HTTP status code. View all error codes

ServerChan

ServerChan (sct.ftqq.com) WeChat push Signature Required

Push messages via a ServerChan SendKey; the SendKey is hosted server-side (console's Account Management). Project signature required.

POST /api/push/serverchan/send Total calls: 0

Send Message

Send a message; it is delivered to WeChat (or any other channel configured in your ServerChan console) through ServerChan.

Required: message title, up to 32 characters, no line breaks

Optional: message content, Markdown supported (paid members' cards can show the full text)

Optional: the message channel for this push; if not selected, the default channel set on the "Channel Config" page of ServerChan is used. To push to two channels at once, pass a combined value separated by | (e.g. 9|66). Channel values: Fangtang WeChat service account=9, WeCom app message=66, WeCom group bot=1, DingTalk group bot=2, Feishu group bot=3, Bark iOS=8, PushDeer=18, official Android client=98, test account=0, custom=88.

Optional: short-link title for the card message

Optional: message tags, separated by |

Optional: WeCom member openids to copy the message to, separated by |

Optional: whether to hide the source IP of this call; when hidden, ServerChan does not record the caller IP.

Optional: when set, desp is end-to-end encrypted before pushing, so the message stays ciphertext on ServerChan / WeChat; the recipient must enter the same password on the message detail page to read it. Share the password out-of-band — this platform does not store it.

  • title is at most 32 characters with no line breaks; desp supports Markdown.
  • The SendKey is hosted server-side (console Account Management → pick the "ServerChan" platform and put the SendKey in the credential field); callers do not pass it.
  • Free ServerChan accounts are limited to 5 messages per day and 50 per minute; when exceeded, the upstream returns an error code (this API reports it as an external service error).
  • When the upstream returns a non-zero code, this API returns 40001 with the upstream reason in msg.
  • Sending is asynchronous: a successful response only means it was queued. Use the status query endpoint and check wxstatus for actual delivery.
  • Passing encrypt_password enables end-to-end encryption: the push log stores the ciphertext, not the plaintext content.
Response Common envelope
Field Type Description
pushid string Identifier of this push; use it with the status query endpoint
readkey string Read key used for the status query endpoint and the reading page URL
encrypted bool Whether this push is end-to-end encrypted (true when encrypt_password was passed)
Example response
{"pushid": "11223344", "readkey": "abcdef123456", "encrypted": false}
GET /api/push/serverchan/status Total calls: 0

Query Push Status

Use the pushid + readkey returned by "Send Message" to check this message's actual delivery result (wxstatus).

Required: the pushid returned by the send endpoint

Required: the readkey returned by the send endpoint

  • ServerChan sends asynchronously: a successful send response only means "queued". Whether it actually reached WeChat is shown by wxstatus from this endpoint.
  • An empty wxstatus means the task may not have run yet; retry later.
Response Common envelope

data is the upstream push-detail JSON; wxstatus is the raw WeChat API result (empty means it may not have run yet). Refer to the actual response.

XiaoYingAPI · Unified API Aggregation Service