aplus notification cli for aplus-frontend team.
npm install @aplus-frontend/notification-cliaplus飞书消息通知工具,用于向飞书群组发送多种类型的消息,支持文本、卡片和富文本格式。
> 提示: 该工具可在开发流程中用于自动化通知,如部署完成、更新提醒等。
``bash`
npx @aplus-frontend/notification-cli [命令] [选项]
`bash`
npm install @aplus-frontend/notification-cli -g
`bash显示帮助信息
notification-cli --help
可用命令
| 命令 | 描述 |
| ------ | ------------------ |
|
send | 发送消息到飞书群组 |$3
| 选项 | 描述 |
| ------------------------- | ----------------------------------------------------- |
|
-m, --msg-type | 消息类型,默认为text,可选值: text, interactive, post |
| -r, --receive-ids | 接收群组ID,多个ID用逗号分隔 |
| -c, --content | 消息内容 |
| -f, --file | 从JSON文件读取消息内容(适用于复杂交互式消息) |消息类型说明
$3
最简单的消息类型,直接发送纯文本内容。
`bash
notification-cli send -r "oc_123456" -c "这是一条文本消息"
`$3
支持Markdown格式的消息,可以包含标题、文本格式、链接、图片等富文本内容。
`bash
notification-cli send -m interactive -r "oc_123456" -c "卡片消息"
`$3
最复杂的消息类型,支持完全自定义的富文本结构,可以包含多种元素如文本、超链接、图片、分割线、代码块等。
`bash
notification-cli send -m post -r "oc_123456" -f message.json
`复杂消息示例
创建一个
message.json文件,包含以下内容:`json
{
"zh_cn": {
"title": "aplus-ui 6.0.0发版,更新内容如下:",
"content": [
[
{
"emoji_type": "APPLAUSE",
"tag": "emotion"
}
],
[
{
"tag": "at",
"user_id": "all"
}
],
[
{
"tag": "text",
"text": "1. ApProductInfo 样式调整",
"style": [""]
}
],
[
{
"tag": "text",
"text": "2. ApGrid 修复虚拟滚动问题",
"style": [""]
}
]
]
}
}
``MIT