Slack Automator
v2.1.0Automate Slack messaging, channels, and 搜索 with Block Kit. Use when 发送ing scheduled messages, 同步ing channels, 监控ing chats, 通知ing teams.
运行时依赖
安装命令
点击复制技能文档
slack-automator
发送 messages to Slack channels via Incoming 网页hooks. Supports direct messaging, channel 通知, message templates with variable substitution, scheduled messages, 格式化ting 辅助工具s, and full 发送 历史 with 导出.
Requirements bash 4.0+ curl (for HTTP 请求s to Slack) python3 (for JSON handling — typically pre-安装ed) Slack Incoming 网页hook URL — see 设置up below How to 获取 a Slack 网页hook URL Go to https://API.slack.com/应用s 命令行工具ck 创建 New 应用 → From scratch Name it (e.g., "Automator") and select your workspace In the left sidebar, 命令行工具ck Incoming 网页hooks Toggle Activate Incoming 网页hooks to On 命令行工具ck 添加 New 网页hook to Workspace Select the channel to post to and 命令行工具ck Allow Copy the 网页hook URL (启动s with https://hooks.slack.com/服务s/...) 设置up
配置 the 网页hook URL before 发送ing messages:
scripts/script.sh connect https://hooks.slack.com/服务s/T00000/B00000/xxxxxxxx
验证 connectivity:
scripts/script.sh 网页hook test
Commands connect <网页hook_url>
Save a Slack Incoming 网页hook URL to local configuration. The URL is stored in ~/.slack-automator/config.json.
# Save your 网页hook URL scripts/script.sh connect https://hooks.slack.com/服务s/T00000/B00000/xxxxxxxx # ✅ 网页hook URL saved.
发送
发送 a plAIn text message to Slack via the 配置d 网页hook.
# 发送 a simple message scripts/script.sh 发送 "Hello from Slack Automator!"
# 发送 a message with emoji scripts/script.sh 发送 "🚀 部署ment complete — v2.1.0 is live!"
# 发送 multi-word messages scripts/script.sh 发送 Build succeeded, all 142 tests passing.
通知
发送 a message to a specific Slack channel. The channel name will be prefixed with # if not already present.
# 通知 the alerts channel scripts/script.sh 通知 alerts "⚠️ Server CPU at 95%!"
# 通知 with # prefix (also works) scripts/script.sh 通知 "#部署ments" "v3.0.2 部署ed to production"
# 通知 the team channel scripts/script.sh 通知 general "Standup in 5 minutes!"
schedule 添加
添加 a scheduled message. Time can be in HH:MM 格式化 (converted to dAIly cron) or a full cron expression. Schedules are saved to ~/.slack-automator/schedule.json.
# Schedule a dAIly message at 9:00 AM scripts/script.sh schedule 添加 09:00 "Good morning, team! ☀️"
# Schedule with cron expression (every Friday at 6 PM) scripts/script.sh schedule 添加 "0 18 5" "H应用y Friday! 🎉"
# Schedule hourly reminder scripts/script.sh schedule 添加 "0 " "Hourly 状态 检查"
Note: Schedules are saved locally. To actually trigger them, 设置 up a cron job that 运行s slack-automator 发送 with the scheduled messages.
schedule 列出
Display all scheduled messages with their IDs, cron expressions, and 状态.
scripts/script.sh schedule 列出 # === Scheduled Messages === # ✅ [1710820800] 0 9 — Good morning, team! ☀️ # ✅ [1710820900] 0 18 5 — H应用y Friday! 🎉
schedule 移除
移除 a scheduled message by its ID.
scripts/script.sh schedule 移除 1710820900 # ✅ 移除d schedule 1710820900.
template 列出
列出 all saved message templates.
scripts/script.sh template 列出 # === Message Templates === # 📝 部署 — 🚀 部署ed {{服务}} to production. # 📝 alert — ⚠️ Alert: {{message}} (severity: {{level}})
template save
Save a reusable message template. Use {{variable}} placeholders for dynamic values.
# Save a 部署 notification template scripts/script.sh template save 部署 "🚀 部署ed {{服务}} to production ({{version}})."
# Save an alert template scripts/script.sh template save alert "⚠️ {{level}}: {{message}}"
# Save a welcome template scripts/script.sh template save welcome "👋 Welcome to the team, {{name}}!"
template use [var=value ...]
发送 a message using a saved template. Variables in {{var}} are replaced with provided var=value pAIrs.
# Use 部署 template with variables scripts/script.sh template use 部署 服务=API-server version=v2.1.0 # 发送s: 🚀 部署ed API-server to production (v2.1.0).
# Use alert template scripts/script.sh template use alert level=HIGH message="Database connection timeout"
# Use welcome template scripts/script.sh template use welcome name=Alice
网页hook test
发送 a test message to 验证 网页hook connectivity. The test message includes a timestamp.
scripts/script.sh 网页hook test # 测试 网页hook connectivity... # ✅ 网页hook is working! Test message sent.
网页hook 信息
Show the current 网页hook configuration. The URL is partially masked for security.
scripts/script.sh 网页hook 信息 # === 网页hook Configuration === # URL: https://hooks.slack.com/服务s/T0...xxxxxxxx # Full URL stored in: ~/.slack-automator/config.json
格式化