pushplus接口
首页文档中心官网
首页文档中心官网
  1. 消息接口
  • pushplus功能简介
  • 消息接口
    • 消息接口说明
    • 接口返回码说明
    • 发送消息接口
      GET
    • 发送消息接口
      POST
  • 发送消息示例
    • 示例说明
    • 最简单的例子
      GET
    • POST方式推送消息
      POST
    • 一对多消息的例子
      POST
    • json格式的例子
      POST
    • webhook的例子
      POST
    • markdown的例子
      POST
    • 企业微信机器人的例子
      POST
    • 企业微信应用的例子
      POST
    • 增加时间戳的例子
      POST
    • 好友消息例子
      POST
    • 使用邮件渠道的例子
      POST
    • 使用短信渠道的例子
      POST
    • 预处理信息修改消息内容的例子
      POST
  1. 消息接口

发送消息接口

POST
https://www.pushplus.plus/send
请注意body传参的时候Content-Type一定要设置为application/json,否则服务端没法正确识别body中的json格式。

请求参数

Header 参数
Content-Type
string 
必需
示例值:
application/json
Body 参数application/json
token
string 
必需
用户令牌,可直接加到请求地址后,如:http://www.pushplus.plus/send/{token}
title
string 
消息标题
可选
content
string 
必需
具体消息内容,根据不同template支持不同格式
topic
string 
可选
群组编码,不填仅发送给自己;channel为webhook时无效
template
string 
发送模板
可选
channel
string 
发送渠道
可选
webhook
string 
webhook编码
可选
callbackUrl
string 
发送结果回调地址
可选
timestamp
string 
可选
毫秒时间戳。格式如:1632993318000。服务器时间戳大于此时间戳,则消息不会发送
to
string 
可选
好友令牌,微信公众号渠道填写好友令牌,企业微信渠道填写企业微信用户id
pre
string 
可选
预处理信息编码。仅供会员使用。需要先在个人中心中添加预处理代码。
示例
{
  "token": "be8652e98bd04139a13e1bffcd6d0f71",
  "title": "标题",
  "content": "消息内容",
  "topic": "code",
  "template": "html"
}

示例代码

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://www.pushplus.plus/send' \
--header 'Content-Type: application/json' \
--data-raw '{
    "token":"be8652e98bd04139a13e1bffcd6d0f71",
    "title":"标题",
    "content":"消息内容",
    "topic":"code",
    "template":"html"
}'

返回响应

🟢200成功
application/json
Body
code
integer 
响应码
必需
msg
string 
响应说明
必需
data
string 
响应数据
必需
示例
{
  "code": 200,
  "msg": "请求成功",
  "data": "075074e3c17e449e9a0cb79cc6f3fc83"
}
上一页
发送消息接口
下一页
示例说明
Built with