PushPlus(推送加)是一个集成了微信、短信、邮件、企业微信、钉钉、飞书等多种渠道的实时消息推送平台。
本 Skill 的能力设计是平台无关的,可用于支持 Skill 安装能力的各类 agent/runtime。当前仓库示例以 Python 脚本为主实现,不绑定单一 agent 平台。
当用户需要以下功能时,使用此 Skill:
scripts/pushplus.py 中的 send_message()send_batch_message()scripts/pushplus_openapi.pywechathtmlbatchSendsms、 voicePUSHPLUS_TOKEN:不能执行基础消息发送PUSHPLUS_USER_TOKEN 或 PUSHPLUS_SECRET_KEY:不能执行 OpenAPI 相关能力环境变量名说明必须PUSHPLUS_TOKEN用户 Token/消息 Token使用推送消息,必须配置PUSHPLUS_USER_TOKEN用户 Token(用于 OpenAPI,不支持使用消息token)使用OpenAPI相关功能,必须配置PUSHPLUS_SECRET_KEY用户 SecretKey(用于 OpenAPI)使用OpenAPI相关功能,必须配置
Token 获取地址: https://www.pushplus.plus/uc-dev.html
如果使用OpenAPI相关功能,需要配置 安全IP地址、 开放接口 设置
场景需要的凭据仅发送普通消息PUSHPLUS_TOKEN发送群组消息/多渠道消息PUSHPLUS_TOKEN调用 OpenAPI 查询或管理能力PUSHPLUS_USER_TOKEN + PUSHPLUS_SECRET_KEY
说明:
PUSHPLUS_TOKEN 用于基础推送能力,可为用户 Token 或消息 TokenPUSHPLUS_USER_TOKEN 仅用于 OpenAPI AccessKey 获取,不支持使用消息 Token 替代PUSHPLUS_USER_TOKEN 和 PUSHPLUS_SECRET_KEY使用脚本发送简单消息:
bash
python3 scripts/pushplus.py -t YOUR_TOKEN -c "消息内容" --title "消息标题"
或使用环境变量:
bash
export PUSHPLUS_TOKEN="your_token"
python3 scripts/pushplus.py -c "消息内容"
python
from scripts.pushplus import send_message, send_wechat_message, send_email_message
# 发送微信消息
result = send_wechat_message(
token="YOUR_TOKEN",
title="系统告警",
content="CPU 使用率超过 90%"
)
# 发送邮件
result = send_email_message(
token="YOUR_TOKEN",
title="日报",
content="今日数据统计..."
)
对高风险能力,建议仅在用户明确要求时调用。
text
python3 scripts/pushplus.py [选项]
必填参数:
-t, --token PushPlus Token(也可通过环境变量 PUSHPLUS_TOKEN 设置)
-c, --content 消息内容
可选参数:
--title 消息标题
--topic 群组编码(一对多消息)
--template 消息模板 (html/txt/json/markdown/cloudMonitor/jenkins/route/pay)
--channel 推送渠道 (wechat/webhook/cp/mail/sms/extension/voice/app/clawbot)
--channels 多渠道发送,逗号分隔,如 "wechat,webhook,extension"
--webhook Webhook 编码(已废弃,请使用 --option)
--option 渠道配置参数(原 webhook 参数,多个渠道用逗号分隔)
--options 多渠道配置参数,逗号分隔
--callback-url 回调地址
--timestamp 时间戳(毫秒)
--to 好友令牌,支持多人(逗号分隔)
--pre 预处理编码
-v, --verbose 显示详细信息
bash
python3 scripts/pushplus.py \
-t "YOUR_TOKEN" \
-c "这是一条测试消息"
bash
python3 scripts/pushplus.py \
-t "YOUR_TOKEN" \
-c "服务器 CPU 使用率达到 95%" \
--title "系统告警"
bash
python3 scripts/pushplus.py \
-t "YOUR_TOKEN" \
-c "# 今日日报
## 数据统计
- 新增用户: 100
- 活跃用户数: 1000" \
--template markdown \
--title "日报"
bash
python3 scripts/pushplus.py \
-t "YOUR_TOKEN" \
-c "这是一封测试邮件" \
--title "邮件标题" \
--channel mail
bash
python3 scripts/pushplus.py \
-t "YOUR_TOKEN" \
-c "这是一条群组消息" \
--title "群组通知" \
--topic "GROUP_CODE"
bash
python3 scripts/pushplus.py \
-t "YOUR_TOKEN" \
-c "这是一条钉钉消息" \
--title "钉钉通知" \
--channel webhook \
--option "DINGTALK_WEBHOOK_CODE"
bash
python3 scripts/pushplus.py \
-t "YOUR_TOKEN" \
-c "这是一条多渠道消息" \
--title "多渠道通知" \
--channels "wechat,webhook,extension" \
--options ",webhook_code,"
bash
python3 scripts/pushplus.py \
-t "YOUR_TOKEN" \
-c "这是一条语音消息" \
--title "语音通知" \
--channel voice
bash
python3 scripts/pushplus.py \
-t "YOUR_TOKEN" \
-c "这是一条 App 推送消息" \
--title "App通知" \
--channel app
bash
python3 scripts/pushplus.py \
-t "YOUR_TOKEN" \
-c "测试消息" \
-v
send_message()通用消息发送函数,支持所有参数。
python
def send_message(
token: str,
content: str,
title: Optional[str] = None,
topic: Optional[str] = None,
template: str = "html",
channel: str = "wechat",
webhook: Optional[str] = None, # 已废弃,请使用 option
option: Optional[str] = None,
callback_url: Optional[str] = None,
timestamp: Optional[int] = None,
to: Optional[str] = None,
pre: Optional[str] = None,
verbose: bool = False
) -> Dict[str, Any]
send_batch_message()多渠道同时发送消息。
python
def send_batch_message(
token: str,
content: str,
channels: List[str],
title: Optional[str] = None,
topic: Optional[str] = None,
template: str = "html",
options: Optional[List[str]] = None,
callback_url: Optional[str] = None,
timestamp: Optional[int] = None,
to: Optional[str] = None,
pre: Optional[str] = None,
verbose: bool = False
) -> Dict[str, Any]
python
send_wechat_message(
token: str,
content: str,
title: str = "通知",
topic: str = None
) -> Dict[str, Any]
python
send_email_message(
token: str,
content: str,
title: str,
topic: str = None
) -> Dict[str, Any]
python
send_markdown_message(
token: str,
content: str,
title: str = "通知",
topic: str = None
) -> Dict[str, Any]
python
send_json_message(
token: str,
data: dict,
title: str = "JSON通知",
topic: str = None
) -> Dict[str, Any]
python
send_dingtalk_message(
token: str,
content: str,
title: str = "通知",
webhook: str = None
) -> Dict[str, Any]
send_feishu_message(
token: str,
content: str,
title: str = "通知",
webhook: str = None
) -> Dict[str, Any]
send_work_wechat_message(
token: str,
content: str,
title: str = "通知",
webhook: str = None
) -> Dict[str, Any]
python
send_sms_message(
token: str,
content: str,
title: str = "短信通知"
) -> Dict[str, Any]
python
send_voice_message(
token: str,
content: str,
title: str = "语音通知"
) -> Dict[str, Any]
python
send_app_message(
token: str,
content: str,
title: str = "通知"
) -> Dict[str, Any]
python
send_extension_message(
token: str,
content: str,
title: str = "通知"
) -> Dict[str, Any]
python
send_template_message(
token: str,
content: str,
title: str,
template: str,
**kwargs
) -> Dict[str, Any]
channels 不能为空列表--channels 时, --options 的数量应与渠道数量一致;若某个渠道无需配置参数,应保留空位page_size 最大为 50sms 或 voice模板名称描述html默认模板,支持 HTML 文本txt纯文本展示,不转义 HTMLjson内容基于 JSON 格式展示markdown内容基于 Markdown 格式展示cloudMonitor阿里云监控报警定制模板jenkinsJenkins 插件定制模板route路由器插件定制模板pay支付成功通知模板
渠道是否免费描述wechat免费微信公众号webhook免费第三方 webhook 渠道(企业微信、钉钉、飞书等)cp免费企业微信应用mail免费邮件sms收费短信(10 积分/条,0.1 元)voice收费语音(30 积分/条,0.3 元)extension免费浏览器插件、桌面应用程序app免费App 渠道(支持安卓、鸿蒙、iOS)clawbot免费微信 ClawBot
返回码说明200执行成功302未登录401请求未授权403请求 IP 未授权500系统异常600数据异常888积分不足900用户账号使用受限(请求次数过多)903无效的用户令牌905账户未进行实名认证999服务端验证错误
限制类型实名用户会员用户微信渠道日请求次数200 次2,000 次请求频率1 分钟 5 次10 秒 5 次相同内容1 小时 3 条1 小时 3 条
限制类型实名用户会员用户标题长度100 字200 字内容长度2 万字10 万字
本 Skill 还提供了 pushplus_openapi.py 脚本,支持通过 AccessKey 调用 PushPlus OpenAPI,包括:
get_access_key() - 获取 AccessKey(有效期2小时)list_messages() - 消息列表get_message_result() - 查询发送结果delete_message() - 删除消息get_message_detail() - 消息详情(HTML)get_user_token() - 获取用户 Tokenget_user_info() - 个人资料详情get_limit_time() - 解封剩余时间get_send_count() - 当日请求次数list_tokens() - 消息 Token 列表select_token_list() - Token 下拉选择列表add_token() - 新增消息 Tokenedit_token() - 修改消息 Tokendelete_token() - 删除消息 Tokenlist_topics() - 群组列表get_topic_detail() - 我创建的群组详情get_join_topic_detail() - 我加入的群组详情add_topic() - 新增群组edit_topic() - 修改群组get_topic_qrcode() - 群组二维码exit_topic() - 退出群组delete_topic() - 删除群组set_topic_is_open() - 上下架积分群组list_topic_subscribers() - 群组内用户列表delete_topic_user() - 删除群组内用户edit_topic_user_remark() - 修改订阅人备注list_webhooks() / get_webhook_detail() / add_webhook() / edit_webhook() - Webhook CRUDlist_mp_channels() - 微信公众号渠道列表list_cp_channels() - 企业微信应用渠道列表list_mail_channels() / get_mail_channel_detail() - 邮箱渠道列表/详情get_clawbot_qrcode() / get_clawbot_qrcode_status() - 二维码获取/扫码查询get_clawbot_bind_info() / unbind_clawbot() - 绑定详情/解绑get_clawbot_messages() - 获取发送消息list_default_settings() / get_default_setting_detail() - 默认配置列表/详情add_default_setting() / edit_default_setting() / delete_default_setting() - 默认配置 CRUDset_receive_limit() - 接收消息限制set_send_enabled() - 发送消息开关set_open_message_type() - 消息打开方式set_extension_forward() - 插件渠道转发get_personal_qrcode() - 个人二维码list_friends() - 好友列表delete_friend() - 删除好友edit_friend_remark() - 修改好友备注list_pre_info() / get_pre_info_detail() - 预处理列表/详情add_pre_info() / edit_pre_info() / delete_pre_info() - 预处理 CRUDtest_pre_code() - 测试预处理代码python
from scripts.pushplus_openapi import (
get_access_key,
list_messages,
get_user_info,
list_tokens
)
# 1. 获取 AccessKey(有效期2小时)
result = get_access_key(
user_token="your_user_token",
secret_key="your_secret_key"
)
access_key = result["data"]["accessKey"]
# 2. 使用 AccessKey 调用其他接口
messages = list_messages(access_key, current=1, page_size=20)
user_info = get_user_info(access_key)
tokens = list_tokens(access_key)