关于 configure-notifications
configure-notifications 是用于配置和检查 OMX 通知的技能,指导设置原生服务、Webhook 或 CLI 命令别名及 OpenClaw,并包含配置验证和送达检查。
主要功能
- 01配置 Discord、Telegram 和 Slack
- 02设置 Webhook 与 CLI 别名
- 03配置 OpenClaw 通知钩子
- 04调整详细程度与空闲冷却时间
- 05验证配置与通知送达
适用场景
- 01启用原生聊天通知服务
- 02通过自定义命令转发事件
- 03验证 OpenClaw 通知送达
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ yeachan-heo/ oh-my-codex --skill configure-notifications安装后在 Claude Code 中输入/configure-notifications确认已加载。
详细介绍
配置 OMX 通知
使用此卡片配置 Discord、Telegram、Slack、通用命令别名或 OpenClaw。共享的安全、生命周期、hook、团队、自主性和取消规则位于 templates/AGENTS.md。
1. 检查并选择路径
CONFIG_FILE="$HOME/.codex/.omx-config.json"
if [ -f "$CONFIG_FILE" ]; then
jq -r '{notifications_enabled:(.notifications.enabled // false), discord:(.notifications.discord.enabled // false), discord_bot:(.notifications["discord-bot"].enabled // false), telegram:(.notifications.telegram.enabled // false), slack:(.notifications.slack.enabled // false), openclaw:(.notifications.openclaw.enabled // false), custom_webhook_command:(.notifications.custom_webhook_command.enabled // false), custom_cli_command:(.notifications.custom_cli_command.enabled // false), verbosity:(.notifications.verbosity // "session"), idleCooldownSeconds:(.notifications.idleCooldownSeconds // 60), reply_enabled:(.notifications.reply.enabled // false)}' "$CONFIG_FILE"
else
echo "NO_CONFIG_FILE"
fi
使用 AskUserQuestion 选择:Discord 原生(webhook 或 bot)、Telegram 原生(bot token + chat id)、Slack 原生(incoming webhook)、custom_webhook_command、custom_cli_command、横切设置,或禁用所有通知。
2. 原生提供商
收集并验证提供商的值,然后仅写入以下原生键:notifications.discord、notifications["discord-bot"]、notifications.telegram 或 notifications.slack。不要用通用别名表示原生提供商。
3. 通用别名
对于 custom_webhook_command,收集 URL、可选 headers、method(默认 POST 或 PUT)、events(session-end、ask-user-question、session-start、session-idle、stop)以及指令模板:
jq --arg url "$URL" --arg method "${METHOD:-POST}" --arg instruction "${INSTRUCTION:-OMX event {{event}} for {{projectPath}}}" --argjson headers "${HEADERS_JSON:-{}}" '.notifications=(.notifications//{enabled:true})|.notifications.enabled=true|.notifications.custom_webhook_command={enabled:true,url:$url,headers:$headers,method:$method,instruction:$instruction,events:["session-end","ask-user-question"]}' "$CONFIG_FILE" >"$CONFIG_FILE.tmp" && mv "$CONFIG_FILE.tmp" "$CONFIG_FILE"
对于 custom_cli_command,收集命令模板({{event}}、{{instruction}}、{{sessionId}}、{{projectPath}})、可选 events 以及指令模板:
jq --arg command "$COMMAND_TEMPLATE" --arg instruction "${INSTRUCTION:-OMX event {{event}} for {{projectPath}}}" '.notifications=(.notifications//{enabled:true})|.notifications.enabled=true|.notifications.custom_cli_command={enabled:true,command:$command,instruction:$instruction,events:["session-end","ask-user-question"]}' "$CONFIG_FILE" >"$CONFIG_FILE.tmp" && mv "$CONFIG_FILE.tmp" "$CONFIG_FILE"
OpenClaw 派发需要 OMX_OPENCLAW=1;命令网关还需要 OMX_OPENCLAW_COMMAND=1;超时优先级为 gateways.<name>.timeout > OMX_OPENCLAW_COMMAND_TIMEOUT_MS > 5000 ms。
4. OpenClaw + Clawdbot Agent 模式
仅当请求的路由是投递到 Discord 的 clawdbot agent 轮次时才使用此项。session-stop 通知有意映射到 OpenClaw 的 stop hook。OMX 会对替换内容进行 shell 转义;请保持指令简短,避免不可信的 shell 元字符,追加 || true,并使用 >> 追加 JSONL 日志。
jq --arg command "(clawdbot agent --session-id omx-hooks --message {{instruction}} --thinking minimal --deliver --reply-channel discord --reply-to 'channel:CHANNEL_ID' --timeout 120 --json >>/tmp/omx-openclaw-agent.jsonl 2>&1 || true)" '.notifications=(.notifications//{enabled:true})|.notifications.enabled=true|.notifications.verbosity="verbose"|.notifications.openclaw={enabled:true,gateways:{local:{type:"command",command:$command,timeout:120000}},hooks:{"session-start":{enabled:true,gateway:"local",instruction:"OMX hook=session-start project={{projectName}} session={{sessionId}} tmux={{tmuxSession}}. 한국어로 상태를 #omc-dev에 공유하고 SOUL.md를 참고하세요."},"session-idle":{enabled:true,gateway:"local",instruction:"OMX hook=session-idle session={{sessionId}} tmux={{tmuxSession}}. 한국어로 팔로업을 #omc-dev에 안내하세요."},"ask-user-question":{enabled:true,gateway:"local",instruction:"OMX hook=ask-user-question session={{sessionId}} tmux={{tmuxSession}} question={{question}}. 한국어로 응답 필요를 #omc-dev에 알리세요."},"stop":{enabled:true,gateway:"local",instruction:"OMX hook=session-stop session={{sessionId}} tmux={{tmuxSession}}. 한국어로 중단 상태를 전달하세요."},"session-end":{enabled:true,gateway:"local",instruction:"OMX hook=session-end session={{sessionId}} tmux={{tmuxSession}} reason={{reason}}. 한국어로 완료 요약을 #omc-dev에 남기세요."}}}' "$CONFIG_FILE" >"$CONFIG_FILE.tmp" && mv "$CONFIG_FILE.tmp" "$CONFIG_FILE"
兼容性与优先级约定
显式的 notifications.openclaw 在有效时优先;通用别名将被忽略并给出警告。
在不隐藏输出的情况下验证此模式并检查证据:
clawdbot agent --session-id omx-hooks --message "OMX hook test via clawdbot agent path" --thinking minimal --deliver --reply-channel discord --reply-to 'channel:CHANNEL_ID' --timeout 120 --json
tmux list-sessions -F '#{session_name}' | rg '^omx-' || true
jq '.notifications.openclaw.hooks' "$CONFIG_FILE"
tail -n 120 /tmp/omx-openclaw-agent.jsonl | jq -s '.[] | {timestamp:(.timestamp // .time),status:(.status // .error // "ok")}'
rg '"error"|"failed"|"timeout"' /tmp/omx-openclaw-agent.jsonl | tail -20
对于 HTTP 集成,请同时运行 /hooks/wake 冒烟测试和 /hooks/agent 投递验证。
5. 横切设置与禁用
- 详细程度:
minimal、session(推荐)、agent或verbose。 - 空闲冷却:
notifications.idleCooldownSeconds(环境变量覆盖:OMX_IDLE_COOLDOWN_SECONDS)。 - 配置文件:
notifications.profiles和notifications.defaultProfile。 - 回复监听器:
notifications.reply.enabled;门控条件为OMX_REPLY_ENABLED=true,对于 Discord 还有OMX_REPLY_DISCORD_USER_IDS=...。获得授权的 Discord bot 操作员可以对已跟踪的通知精确匹配status,以获取有界的只读会话摘要。
禁用所有通知:
jq '.notifications.enabled=false' "$CONFIG_FILE" >"$CONFIG_FILE.tmp" && mv "$CONFIG_FILE.tmp" "$CONFIG_FILE"
退出证据
编辑后运行 jq empty "$CONFIG_FILE"。报告配置路径、已启用的原生提供商、已启用的别名、有效的 notifications.openclaw 是否覆盖别名、详细程度、空闲冷却、回复监听器状态以及冒烟测试结果。当 JSON 解析成功且所选路径具备其所需证据时停止;不要仅凭配置就声称投递成功。