configure-notifications by yeachan-heo/oh-my-claudecode
npx skills add https://github.com/yeachan-heo/oh-my-claudecode --skill configure-notifications设置 OMC 通知集成,以便在会话结束、需要输入或完成后台任务时收到提醒。
根据用户的请求或参数检测他们想要的提供商:
问题: "您希望配置哪个通知服务?"
选项:
设置 Telegram 通知,以便 OMC 在会话结束、需要输入或完成后台任务时向您发送消息。
这是一个交互式的自然语言配置技能。通过使用 AskUserQuestion 提问来引导用户完成设置。将结果写入 ~/.claude/.omc-config.json。
CONFIG_FILE="$HOME/.claude/.omc-config.json"
if [ -f "$CONFIG_FILE" ]; then
HAS_TELEGRAM=$(jq -r '.notifications.telegram.enabled // false' "$CONFIG_FILE" 2>/dev/null)
CHAT_ID=$(jq -r '.notifications.telegram.chatId // empty' "$CONFIG_FILE" 2>/dev/null)
PARSE_MODE=$(jq -r '.notifications.telegram.parseMode // "Markdown"' "$CONFIG_FILE" 2>/dev/null)
if [ "$HAS_TELEGRAM" = "true" ]; then
echo "EXISTING_CONFIG=true"
echo "CHAT_ID=$CHAT_ID"
echo "PARSE_MODE=$PARSE_MODE"
else
echo "EXISTING_CONFIG=false"
fi
else
echo "NO_CONFIG_FILE"
fi
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
如果找到现有配置,向用户显示当前配置并询问是否要更新或重新配置。
如果用户没有机器人,引导他们创建一个:
要设置 Telegram 通知,您需要一个 Telegram 机器人令牌和您的聊天 ID。
创建机器人(如果您还没有):
1. 打开 Telegram 并搜索 @BotFather
2. 发送 /newbot
3. 选择一个名称(例如,"My OMC Notifier")
4. 选择一个用户名(例如,"my_omc_bot")
5. BotFather 会给您一个令牌,例如:123456789:ABCdefGHIjklMNOpqrsTUVwxyz
获取您的聊天 ID:
1. 与您的新机器人开始聊天(发送 /start)
2. 访问:https://api.telegram.org/bot<YOUR_TOKEN>/getUpdates
3. 查找 "chat":{"id":YOUR_CHAT_ID}
- 个人聊天 ID 是正数(例如,123456789)
- 群组聊天 ID 是负数(例如,-1001234567890)
使用 AskUserQuestion:
问题: "粘贴您的 Telegram 机器人令牌(来自 @BotFather)"
用户将在"其他"字段中输入他们的令牌。
验证令牌:
digits:alphanumeric(例如,123456789:ABCdefGHI...)使用 AskUserQuestion:
问题: "粘贴您的 Telegram 聊天 ID(来自 getUpdates API 的数字)"
用户将在"其他"字段中输入他们的聊天 ID。
验证聊天 ID:
必须是一个数字(个人聊天为正数,群组为负数)
如果无效,提供帮助以找到它:
BOT_TOKEN="USER_PROVIDED_TOKEN" echo "正在获取最近的消息以查找您的聊天 ID..." curl -s "https://api.telegram.org/bot${BOT_TOKEN}/getUpdates" | jq '.result[-1].message.chat.id // .result[-1].message.from.id // "未找到消息 - 请先向您的机器人发送 /start"'
使用 AskUserQuestion:
问题: "您更喜欢哪种消息格式?"
选项:
使用带有 multiSelect 的 AskUserQuestion:
问题: "哪些事件应触发 Telegram 通知?"
选项(multiSelect: true):
默认选择:session-end + ask-user-question。
读取现有配置,合并新的 Telegram 设置,然后写回:
CONFIG_FILE="$HOME/.claude/.omc-config.json"
mkdir -p "$(dirname "$CONFIG_FILE")"
if [ -f "$CONFIG_FILE" ]; then
EXISTING=$(cat "$CONFIG_FILE")
else
EXISTING='{}'
fi
# BOT_TOKEN, CHAT_ID, PARSE_MODE 是从用户处收集的
echo "$EXISTING" | jq \
--arg token "$BOT_TOKEN" \
--arg chatId "$CHAT_ID" \
--arg parseMode "$PARSE_MODE" \
'.notifications = (.notifications // {enabled: true}) |
.notifications.enabled = true |
.notifications.telegram = {
enabled: true,
botToken: $token,
chatId: $chatId,
parseMode: $parseMode
}' > "$CONFIG_FILE"
对于每个未选中的事件,禁用它:
# 示例:如果未选中 session-start,则禁用它
echo "$(cat "$CONFIG_FILE")" | jq \
'.notifications.events = (.notifications.events // {}) |
.notifications.events["session-start"] = {enabled: false}' > "$CONFIG_FILE"
写入配置后,提供发送测试通知的选项:
使用 AskUserQuestion:
问题: "发送测试通知以验证设置?"
选项:
BOT_TOKEN="USER_PROVIDED_TOKEN"
CHAT_ID="USER_PROVIDED_CHAT_ID"
PARSE_MODE="Markdown"
RESPONSE=$(curl -s -w "\n%{http_code}" \
"https://api.telegram.org/bot${BOT_TOKEN}/sendMessage" \
-d "chat_id=${CHAT_ID}" \
-d "parse_mode=${PARSE_MODE}" \
-d "text=OMC 测试通知 - Telegram 已配置!")
HTTP_CODE=$(echo "$RESPONSE" | tail -1)
BODY=$(echo "$RESPONSE" | head -1)
if [ "$HTTP_CODE" = "200" ]; then
echo "测试通知发送成功!"
else
echo "失败(HTTP $HTTP_CODE):"
echo "$BODY" | jq -r '.description // "未知错误"' 2>/dev/null || echo "$BODY"
fi
报告成功或失败。常见问题:
/start显示最终配置摘要:
Telegram 通知已配置!
机器人: @your_bot_username
聊天 ID: 123456789
格式: Markdown
事件: session-end, ask-user-question
配置已保存至:~/.claude/.omc-config.json
您也可以通过环境变量设置这些:
OMC_TELEGRAM_BOT_TOKEN=123456789:ABCdefGHI...
OMC_TELEGRAM_CHAT_ID=123456789
重新配置:/oh-my-claudecode:configure-notifications telegram
配置 Discord:/oh-my-claudecode:configure-notifications discord
配置 Slack:/oh-my-claudecode:configure-notifications slack
用户可以通过在 shell 配置文件中设置环境变量来完全跳过此向导:
export OMC_TELEGRAM_BOT_TOKEN="123456789:ABCdefGHIjklMNOpqrsTUVwxyz"
export OMC_TELEGRAM_CHAT_ID="123456789"
环境变量会被通知系统自动检测,无需 .omc-config.json。
设置 Discord 通知,以便 OMC 在会话结束、需要输入或完成后台任务时通知您。
这是一个交互式的自然语言配置技能。通过使用 AskUserQuestion 提问来引导用户完成设置。将结果写入 ~/.claude/.omc-config.json。
CONFIG_FILE="$HOME/.claude/.omc-config.json"
if [ -f "$CONFIG_FILE" ]; then
# 检查现有的 discord 配置
HAS_DISCORD=$(jq -r '.notifications.discord.enabled // false' "$CONFIG_FILE" 2>/dev/null)
HAS_DISCORD_BOT=$(jq -r '.notifications["discord-bot"].enabled // false' "$CONFIG_FILE" 2>/dev/null)
WEBHOOK_URL=$(jq -r '.notifications.discord.webhookUrl // empty' "$CONFIG_FILE" 2>/dev/null)
MENTION=$(jq -r '.notifications.discord.mention // empty' "$CONFIG_FILE" 2>/dev/null)
if [ "$HAS_DISCORD" = "true" ] || [ "$HAS_DISCORD_BOT" = "true" ]; then
echo "EXISTING_CONFIG=true"
echo "WEBHOOK_CONFIGURED=$HAS_DISCORD"
echo "BOT_CONFIGURED=$HAS_DISCORD_BOT"
[ -n "$WEBHOOK_URL" ] && echo "WEBHOOK_URL=$WEBHOOK_URL"
[ -n "$MENTION" ] && echo "MENTION=$MENTION"
else
echo "EXISTING_CONFIG=false"
fi
else
echo "NO_CONFIG_FILE"
fi
如果找到现有配置,向用户显示当前配置并询问是否要更新或重新配置。
使用 AskUserQuestion:
问题: "您希望如何发送 Discord 通知?"
选项:
如果用户选择了 Webhook:
使用 AskUserQuestion:
问题: "粘贴您的 Discord webhook URL。要创建一个:服务器设置 > 集成 > Webhooks > 新建 Webhook > 复制 URL"
用户将在"其他"字段中输入他们的 webhook URL。
验证 URL:
https://discord.com/api/webhooks/ 或 https://discordapp.com/api/webhooks/ 开头如果用户选择了 Bot API:
询问两个问题:
使用 AskUserQuestion:
问题: "您希望通知提及(提醒)某人吗?"
选项:
询问:"要提及的 Discord 用户 ID 是什么?(右键点击用户 > 复制用户 ID,需要开发者模式)"
提及格式为:<@USER_ID>(例如,<@1465264645320474637>)
询问:"要提及的 Discord 角色 ID 是什么?(服务器设置 > 角色 > 右键点击角色 > 复制角色 ID)"
提及格式为:<@&ROLE_ID>(例如,<@&123456789>)
使用带有 multiSelect 的 AskUserQuestion:
问题: "哪些事件应触发 Discord 通知?"
选项(multiSelect: true):
默认选择:session-end + ask-user-question。
使用 AskUserQuestion:
问题: "自定义机器人显示名称?(在 Discord 中显示为 webhook 发送者名称)"
选项:
读取现有配置,合并新的 Discord 设置,然后写回:
CONFIG_FILE="$HOME/.claude/.omc-config.json"
mkdir -p "$(dirname "$CONFIG_FILE")"
if [ -f "$CONFIG_FILE" ]; then
EXISTING=$(cat "$CONFIG_FILE")
else
EXISTING='{}'
fi
使用收集的值构建通知对象,并使用 jq 合并到 .omc-config.json 中:
# WEBHOOK_URL, MENTION, USERNAME 是从用户处收集的
# EVENTS 是启用的事件列表
echo "$EXISTING" | jq \
--arg url "$WEBHOOK_URL" \
--arg mention "$MENTION" \
--arg username "$USERNAME" \
'.notifications = (.notifications // {enabled: true}) |
.notifications.enabled = true |
.notifications.discord = {
enabled: true,
webhookUrl: $url,
mention: (if $mention == "" then null else $mention end),
username: (if $username == "" then null else $username end)
}' > "$CONFIG_FILE"
echo "$EXISTING" | jq \
--arg token "$BOT_TOKEN" \
--arg channel "$CHANNEL_ID" \
--arg mention "$MENTION" \
'.notifications = (.notifications // {enabled: true}) |
.notifications.enabled = true |
.notifications["discord-bot"] = {
enabled: true,
botToken: $token,
channelId: $channel,
mention: (if $mention == "" then null else $mention end)
}' > "$CONFIG_FILE"
对于每个未选中的事件,禁用它:
# 示例:如果未选中 session-start,则禁用它
echo "$(cat "$CONFIG_FILE")" | jq \
'.notifications.events = (.notifications.events // {}) |
.notifications.events["session-start"] = {enabled: false}' > "$CONFIG_FILE"
写入配置后,提供发送测试通知的选项:
使用 AskUserQuestion:
问题: "发送测试通知以验证设置?"
选项:
# 对于 webhook:
curl -s -o /dev/null -w "%{http_code}" \
-H "Content-Type: application/json" \
-d "{\"content\": \"${MENTION:+$MENTION\\n}OMC 测试通知 - Discord 已配置!\"}" \
"$WEBHOOK_URL"
报告成功或失败。如果失败,帮助用户调试(检查 URL、权限等)。
显示最终配置摘要:
Discord 通知已配置!
方法: Webhook / Bot API
提及: <@1465264645320474637>(或"无")
事件: session-end, ask-user-question
用户名: OMC
配置已保存至:~/.claude/.omc-config.json
您也可以通过环境变量设置这些:
OMC_DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/...
OMC_DISCORD_MENTION=<@1465264645320474637>
重新配置:/oh-my-claudecode:configure-notifications discord
配置 Telegram:/oh-my-claudecode:configure-notifications telegram
配置 Slack:/oh-my-claudecode:configure-notifications slack
用户可以通过在 shell 配置文件中设置环境变量来完全跳过此向导:
Webhook 方法:
export OMC_DISCORD_WEBHOOK_URL="https://discord.com/api/webhooks/..."
export OMC_DISCORD_MENTION="<@1465264645320474637>" # 可选
Bot API 方法:
export OMC_DISCORD_NOTIFIER_BOT_TOKEN="your-bot-token"
export OMC_DISCORD_NOTIFIER_CHANNEL="your-channel-id"
export OMC_DISCORD_MENTION="<@1465264645320474637>" # 可选
环境变量会被通知系统自动检测,无需 .omc-config.json。
设置 Slack 通知,以便 OMC 在会话结束、需要输入或完成后台任务时向您发送消息。
这是一个交互式的自然语言配置技能。通过使用 AskUserQuestion 提问来引导用户完成设置。将结果写入 ~/.claude/.omc-config.json。
CONFIG_FILE="$HOME/.claude/.omc-config.json"
if [ -f "$CONFIG_FILE" ]; then
HAS_SLACK=$(jq -r '.notifications.slack.enabled // false' "$CONFIG_FILE" 2>/dev/null)
WEBHOOK_URL=$(jq -r '.notifications.slack.webhookUrl // empty' "$CONFIG_FILE" 2>/dev/null)
MENTION=$(jq -r '.notifications.slack.mention // empty' "$CONFIG_FILE" 2>/dev/null)
CHANNEL=$(jq -r '.notifications.slack.channel // empty' "$CONFIG_FILE" 2>/dev/null)
if [ "$HAS_SLACK" = "true" ]; then
echo "EXISTING_CONFIG=true"
[ -n "$WEBHOOK_URL" ] && echo "WEBHOOK_URL=$WEBHOOK_URL"
[ -n "$MENTION" ] && echo "MENTION=$MENTION"
[ -n "$CHANNEL" ] && echo "CHANNEL=$CHANNEL"
else
echo "EXISTING_CONFIG=false"
fi
else
echo "NO_CONFIG_FILE"
fi
如果找到现有配置,向用户显示当前配置并询问是否要更新或重新配置。
如果用户没有 webhook,引导他们创建一个:
要设置 Slack 通知,您需要一个 Slack 传入 webhook URL。
创建 Webhook:
1. 访问 https://api.slack.com/apps
2. 点击"创建新应用" > "从头开始"
3. 命名您的应用(例如,"OMC Notifier")并选择您的工作区
4. 在左侧边栏中转到"Incoming Webhooks"
5. 将"激活传入 Webhooks"切换为 ON
6. 点击"添加新 Webhook 到工作区"
7. 选择应发布通知的频道
8. 复制 webhook URL(以 https://hooks.slack.com/services/... 开头)
使用 AskUserQuestion:
问题: "粘贴您的 Slack 传入 webhook URL(以 https://hooks.slack.com/services/... 开头)"
用户将在"其他"字段中输入他们的 webhook URL。
验证 URL:
https://hooks.slack.com/services/ 开头使用 AskUserQuestion:
问题: "您希望通知提及(提醒)某人吗?"
选项:
询问:"要提及的 Slack 成员 ID 是什么?(点击用户个人资料 > 更多 (⋯) > 复制成员 ID)"
提及格式为:<@MEMBER_ID>(例如,<@U1234567890>)
提及格式为:<!channel>
提及格式为:<!here>
使用带有 multiSelect 的 AskUserQuestion:
问题: "哪些事件应触发 Slack 通知?"
选项(multiSelect: true):
默认选择:session-end + ask-user-question。
使用 AskUserQuestion:
问题: "覆盖默认通知频道?(Webhook 已有一个默认频道)"
选项:
如果覆盖,询问频道名称(例如,#alerts)。
使用 AskUserQuestion:
问题: "自定义机器人显示名称?(在 Slack 中显示为 webhook 发送者名称)"
选项:
读取现有配置,合并新的 Slack 设置,然后写回:
CONFIG_FILE="$HOME/.claude/.omc-config.json"
mkdir -p "$(dirname "$CONFIG_FILE")"
if [ -f "$CONFIG_FILE" ]; then
EXISTING=$(cat "$CONFIG_FILE")
else
EXISTING='{}'
fi
# WEBHOOK_URL, MENTION, USERNAME, CHANNEL 是从用户处收集的
echo "$EXISTING" | jq \
--arg url "$WEBHOOK_URL" \
--arg mention "$MENTION" \
--arg username "$USERNAME" \
--arg channel "$CHANNEL" \
'.notifications = (.notifications // {enabled: true}) |
.notifications.enabled = true |
.notifications.slack = {
enabled: true,
webhookUrl: $url,
mention: (if $mention == "" then null else $mention end),
username: (if $username == "" then null else $username end),
channel: (if $channel == "" then null else $channel end)
}' > "$CONFIG_FILE"
对于每个未选中的事件,禁用它:
# 示例:如果未选中 session-start,则禁用它
echo "$(cat "$CONFIG_FILE")" | jq \
'.notifications.events = (.notifications.events // {}) |
.notifications.events["session-start"] = {enabled: false}' > "$CONFIG_FILE"
写入配置后,提供发送测试通知的选项:
使用 AskUserQuestion:
问题: "发送测试通知以验证设置?"
选项:
# 对于 webhook:
MENTION_PREFIX=""
if [ -n "$MENTION" ]; then
MENTION_PREFIX="${MENTION}\n"
fi
curl -s -o /dev/null -w "%{http_code}" \
-H "Content-Type: application/json" \
-d "{\"text\": \"${MENTION_PREFIX}OMC 测试通知 - Slack 已配置!\"}" \
"$WEBHOOK_URL"
报告成功或失败。常见问题:
显示最终配置摘要:
Slack 通知已配置!
Webhook: https://hooks.slack.com/services/T00/B00/xxx...
提及: <@U1234567890>(或"无")
频道: #alerts(或"webhook 默认")
事件: session-end, ask-user-question
用户名: OMC
配置已保存至:~/.claude/.omc-config.json
您也可以通过环境变量设置这些:
OMC_SLACK_WEBHOOK_URL=https://hooks.slack.com/services/...
OMC_SLACK_MENTION=<@U1234567890>
重新配置:/oh-my-claudecode:configure-notifications slack
配置 Discord:/oh-my-claudecode:configure-notifications discord
配置 Telegram:/oh-my-claudecode:configure-notifications telegram
用户可以通过在 shell 配置文件中设置环境变量来完全跳过此向导:
export OMC_SLACK_WEBHOOK_URL="https://hooks.slack.com/services/T00/B00/xxx"
export OMC_SLACK_MENTION="<@U1234567890>" # 可选
环境变量会被通知系统自动检测,无需 .omc-config.json。
| 类型 | 格式 | 示例 |
|---|---|---|
| 用户 | <@MEMBER_ID> | <@U1234567890> |
| 频道 | <!channel> | <!channel> |
| Here | <!here> | <!here> |
| Everyone | <!everyone> | <!everyone> |
| 用户组 | <!subteam^GROUP_ID> | <!subteam^S1234567890> |
所有通知平台都需要通过每个会话的 CLI 标志激活:
omc --telegram — 激活 Telegram 通知(设置 OMC_TELEGRAM=1)omc --discord — 激活 Discord 通知(设置 OMC_DISCORD=1)omc --slack — 激活 Slack 通知(设置 OMC_SLACK=1)omc --webhook — 激活 webhook 通知(设置 OMC_WEBHOOK=1)omc --openclaw — 激活 OpenClaw 网关集成(设置 OMC_OPENCLAW=1)没有这些标志,已配置的平台将保持休眠状态。这可以防止在开发过程中发送不需要的通知,同时保持配置持久性。
示例:
omc --telegram --discord — Telegram + Discord 激活omc --telegram --slack --webhook — Telegram + Slack + Webhook 激活omc --telegram --openclaw — Telegram + OpenClaw 激活omc — 不发送通知(所有平台都需要显式激活)使用 omc_config.hook.json 为每个事件和每个平台自定义通知消息。
如果触发器或参数包含 "hook"、"template" 或 "customize messages" → 遵循此部分。
检查 ~/.claude/omc_config.hook.json 是否存在。如果存在,显示当前配置。如果不存在,解释其作用。
钩子事件模板允许您自定义发送到每个平台的通知消息。
您可以为 Discord、Telegram 和 Slack 设置不同的消息,并控制哪些事件在哪个平台上触发。
配置文件:~/.claude/omc_config.hook.json
使用 AskUserQuestion:
问题: "您希望为哪个事件配置模板?"
选项:
显示所选事件可用的模板变量:
可用模板变量:
原始字段:
{{sessionId}} - 会话标识符
{{timestamp}} - ISO 时间戳
{{tmuxSession}} - tmux 会话名称
{{projectPath}} - 完整项目目录路径
{{projectName}} - 项目目录基本名称
{{reason}} - 停止/结束原因
{{activeMode}} - 活动 OMC 模式名称
{{question}} - 问题文本(仅限 ask-user-question)
{{agentName}} - 代理名称(仅限 agent-call)
{{agentType}} - 代理类型(仅限 agent-call)
计算字段(智能格式化):
{{duration}} - 人类可读的持续时间(例如,"5m 23s")
{{time}} - 本地时间字符串
{{modesDisplay}} - 逗号分隔的模式或空
{{iterationDisplay}} - "3/10" 格式或空
{{agentDisplay}} - "2/5 已完成" 或空
{{projectDisplay}} - 项目名称及回退值
{{footer}} - tmux + 项目信息行
{{tmuxTailBlock}} - 最近输出(代码块中)或空
{{reasonDisplay}} - 原因(带"未知"回退)
条件语句:
{{#if variableName}}当变量为真时显示的内容{{/if}}
使用 AskUserQuestion:
问题: "输入此事件的消息模板(使用 {{variables}} 表示动态内容)"
选项:
如果选择"简单摘要",使用预构建的紧凑模板:
{{projectDisplay}} 会话已结束 ({{duration}}) — {{reasonDisplay}}{{projectDisplay}} 需要输入:{{question}}{{projectDisplay}} 处于空闲状态。{{#if reason}}原因:{{reason}}{{/if}}会话已开始:{{projectDisplay}} 于 {{time}}使用 AskUserQuestion:
问题: "您希望为特定平台设置不同的消息吗?"
选项:
如果按平台:分别为每个启用的平台询问模板。
读取或创建 ~/.claude/omc_config.hook.json 并合并新设置:
{
"version": 1,
"enabled": true,
"events": {
"<event-name>": {
"enabled": true,
"template": "<user-provided-template>",
"platforms": {
"discord": { "template": "<discord-specific>" },
"telegram": { "template": "<telegram-specific>" }
}
}
}
}
使用 validateTemplate() 验证模板,检查未知变量。如果发现任何未知变量,警告用户并提供更正选项。
提供使用新模板发送测试通知的选项。
{
"version": 1,
"enabled": true,
"events": {
"session-end": {
"enabled": true,
"template": "会话 {{sessionId}} 在 {{duration}} 后结束。原因:{{reasonDisplay}}",
"platforms": {
"discord": {
"template": "**会话完成** | `{{projectDisplay}}` | {{duration}} | {{reasonDisplay}}"
},
"telegram": {
"template": "完成:{{projectDisplay}} ({{duration}})\n{{#if contextSummary}}摘要:{{contextSummary}}{{/if}}"
}
}
},
"ask-user-question": {
"enabled": true,
"template": "{{#if question}}{{question}}{{/if}}\n正在等待 {{projectDisplay}} 的输入"
}
}
}
/oh-my-claudecode:configure-openclaw — 配置 OpenClaw 网关集成为超出原生 Discord/Telegram/Slack 集成的服务配置自定义 webhook 和 CLI 命令。
如果用户说 "custom integration"、"openclaw"、"n8n"、"webhook"、"cli
Set up OMC notification integrations so you're alerted when sessions end, need input, or complete background tasks.
Detect which provider the user wants based on their request or argument:
Question: "Which notification service would you like to configure?"
Options:
Set up Telegram notifications so OMC can message you when sessions end, need input, or complete background tasks.
This is an interactive, natural-language configuration skill. Walk the user through setup by asking questions with AskUserQuestion. Write the result to ~/.claude/.omc-config.json.
CONFIG_FILE="$HOME/.claude/.omc-config.json"
if [ -f "$CONFIG_FILE" ]; then
HAS_TELEGRAM=$(jq -r '.notifications.telegram.enabled // false' "$CONFIG_FILE" 2>/dev/null)
CHAT_ID=$(jq -r '.notifications.telegram.chatId // empty' "$CONFIG_FILE" 2>/dev/null)
PARSE_MODE=$(jq -r '.notifications.telegram.parseMode // "Markdown"' "$CONFIG_FILE" 2>/dev/null)
if [ "$HAS_TELEGRAM" = "true" ]; then
echo "EXISTING_CONFIG=true"
echo "CHAT_ID=$CHAT_ID"
echo "PARSE_MODE=$PARSE_MODE"
else
echo "EXISTING_CONFIG=false"
fi
else
echo "NO_CONFIG_FILE"
fi
If existing config is found, show the user what's currently configured and ask if they want to update or reconfigure.
Guide the user through creating a bot if they don't have one:
To set up Telegram notifications, you need a Telegram bot token and your chat ID.
CREATE A BOT (if you don't have one):
1. Open Telegram and search for @BotFather
2. Send /newbot
3. Choose a name (e.g., "My OMC Notifier")
4. Choose a username (e.g., "my_omc_bot")
5. BotFather will give you a token like: 123456789:ABCdefGHIjklMNOpqrsTUVwxyz
GET YOUR CHAT ID:
1. Start a chat with your new bot (send /start)
2. Visit: https://api.telegram.org/bot<YOUR_TOKEN>/getUpdates
3. Look for "chat":{"id":YOUR_CHAT_ID}
- Personal chat IDs are positive numbers (e.g., 123456789)
- Group chat IDs are negative numbers (e.g., -1001234567890)
Use AskUserQuestion:
Question: "Paste your Telegram bot token (from @BotFather)"
The user will type their token in the "Other" field.
Validate the token:
digits:alphanumeric (e.g., 123456789:ABCdefGHI...)Use AskUserQuestion:
Question: "Paste your Telegram chat ID (the number from getUpdates API)"
The user will type their chat ID in the "Other" field.
Validate the chat ID:
Must be a number (positive for personal, negative for groups)
If invalid, offer to help them find it:
BOT_TOKEN="USER_PROVIDED_TOKEN" echo "Fetching recent messages to find your chat ID..." curl -s "https://api.telegram.org/bot${BOT_TOKEN}/getUpdates" | jq '.result[-1].message.chat.id // .result[-1].message.from.id // "No messages found - send /start to your bot first"'
Use AskUserQuestion:
Question: "Which message format do you prefer?"
Options:
Use AskUserQuestion with multiSelect:
Question: "Which events should trigger Telegram notifications?"
Options (multiSelect: true):
Default selection: session-end + ask-user-question.
Read the existing config, merge the new Telegram settings, and write back:
CONFIG_FILE="$HOME/.claude/.omc-config.json"
mkdir -p "$(dirname "$CONFIG_FILE")"
if [ -f "$CONFIG_FILE" ]; then
EXISTING=$(cat "$CONFIG_FILE")
else
EXISTING='{}'
fi
# BOT_TOKEN, CHAT_ID, PARSE_MODE are collected from user
echo "$EXISTING" | jq \
--arg token "$BOT_TOKEN" \
--arg chatId "$CHAT_ID" \
--arg parseMode "$PARSE_MODE" \
'.notifications = (.notifications // {enabled: true}) |
.notifications.enabled = true |
.notifications.telegram = {
enabled: true,
botToken: $token,
chatId: $chatId,
parseMode: $parseMode
}' > "$CONFIG_FILE"
For each event NOT selected, disable it:
# Example: disable session-start if not selected
echo "$(cat "$CONFIG_FILE")" | jq \
'.notifications.events = (.notifications.events // {}) |
.notifications.events["session-start"] = {enabled: false}' > "$CONFIG_FILE"
After writing config, offer to send a test notification:
Use AskUserQuestion:
Question: "Send a test notification to verify the setup?"
Options:
BOT_TOKEN="USER_PROVIDED_TOKEN"
CHAT_ID="USER_PROVIDED_CHAT_ID"
PARSE_MODE="Markdown"
RESPONSE=$(curl -s -w "\n%{http_code}" \
"https://api.telegram.org/bot${BOT_TOKEN}/sendMessage" \
-d "chat_id=${CHAT_ID}" \
-d "parse_mode=${PARSE_MODE}" \
-d "text=OMC test notification - Telegram is configured!")
HTTP_CODE=$(echo "$RESPONSE" | tail -1)
BODY=$(echo "$RESPONSE" | head -1)
if [ "$HTTP_CODE" = "200" ]; then
echo "Test notification sent successfully!"
else
echo "Failed (HTTP $HTTP_CODE):"
echo "$BODY" | jq -r '.description // "Unknown error"' 2>/dev/null || echo "$BODY"
fi
Report success or failure. Common issues:
/start to the botDisplay the final configuration summary:
Telegram Notifications Configured!
Bot: @your_bot_username
Chat ID: 123456789
Format: Markdown
Events: session-end, ask-user-question
Config saved to: ~/.claude/.omc-config.json
You can also set these via environment variables:
OMC_TELEGRAM_BOT_TOKEN=123456789:ABCdefGHI...
OMC_TELEGRAM_CHAT_ID=123456789
To reconfigure: /oh-my-claudecode:configure-notifications telegram
To configure Discord: /oh-my-claudecode:configure-notifications discord
To configure Slack: /oh-my-claudecode:configure-notifications slack
Users can skip this wizard entirely by setting env vars in their shell profile:
export OMC_TELEGRAM_BOT_TOKEN="123456789:ABCdefGHIjklMNOpqrsTUVwxyz"
export OMC_TELEGRAM_CHAT_ID="123456789"
Env vars are auto-detected by the notification system without needing .omc-config.json.
Set up Discord notifications so OMC can ping you when sessions end, need input, or complete background tasks.
This is an interactive, natural-language configuration skill. Walk the user through setup by asking questions with AskUserQuestion. Write the result to ~/.claude/.omc-config.json.
CONFIG_FILE="$HOME/.claude/.omc-config.json"
if [ -f "$CONFIG_FILE" ]; then
# Check for existing discord config
HAS_DISCORD=$(jq -r '.notifications.discord.enabled // false' "$CONFIG_FILE" 2>/dev/null)
HAS_DISCORD_BOT=$(jq -r '.notifications["discord-bot"].enabled // false' "$CONFIG_FILE" 2>/dev/null)
WEBHOOK_URL=$(jq -r '.notifications.discord.webhookUrl // empty' "$CONFIG_FILE" 2>/dev/null)
MENTION=$(jq -r '.notifications.discord.mention // empty' "$CONFIG_FILE" 2>/dev/null)
if [ "$HAS_DISCORD" = "true" ] || [ "$HAS_DISCORD_BOT" = "true" ]; then
echo "EXISTING_CONFIG=true"
echo "WEBHOOK_CONFIGURED=$HAS_DISCORD"
echo "BOT_CONFIGURED=$HAS_DISCORD_BOT"
[ -n "$WEBHOOK_URL" ] && echo "WEBHOOK_URL=$WEBHOOK_URL"
[ -n "$MENTION" ] && echo "MENTION=$MENTION"
else
echo "EXISTING_CONFIG=false"
fi
else
echo "NO_CONFIG_FILE"
fi
If existing config is found, show the user what's currently configured and ask if they want to update or reconfigure.
Use AskUserQuestion:
Question: "How would you like to send Discord notifications?"
Options:
If user chose Webhook:
Use AskUserQuestion:
Question: "Paste your Discord webhook URL. To create one: Server Settings > Integrations > Webhooks > New Webhook > Copy URL"
The user will type their webhook URL in the "Other" field.
Validate the URL:
https://discord.com/api/webhooks/ or https://discordapp.com/api/webhooks/If user chose Bot API:
Ask two questions:
Use AskUserQuestion:
Question: "Would you like notifications to mention (ping) someone?"
Options:
Ask: "What is the Discord user ID to mention? (Right-click user > Copy User ID, requires Developer Mode)"
The mention format is: <@USER_ID> (e.g., <@1465264645320474637>)
Ask: "What is the Discord role ID to mention? (Server Settings > Roles > right-click role > Copy Role ID)"
The mention format is: <@&ROLE_ID> (e.g., <@&123456789>)
Use AskUserQuestion with multiSelect:
Question: "Which events should trigger Discord notifications?"
Options (multiSelect: true):
Default selection: session-end + ask-user-question.
Use AskUserQuestion:
Question: "Custom bot display name? (Shows as the webhook sender name in Discord)"
Options:
Read the existing config, merge the new Discord settings, and write back:
CONFIG_FILE="$HOME/.claude/.omc-config.json"
mkdir -p "$(dirname "$CONFIG_FILE")"
if [ -f "$CONFIG_FILE" ]; then
EXISTING=$(cat "$CONFIG_FILE")
else
EXISTING='{}'
fi
Build the notifications object with the collected values and merge into .omc-config.json using jq:
# WEBHOOK_URL, MENTION, USERNAME are collected from user
# EVENTS is the list of enabled events
echo "$EXISTING" | jq \
--arg url "$WEBHOOK_URL" \
--arg mention "$MENTION" \
--arg username "$USERNAME" \
'.notifications = (.notifications // {enabled: true}) |
.notifications.enabled = true |
.notifications.discord = {
enabled: true,
webhookUrl: $url,
mention: (if $mention == "" then null else $mention end),
username: (if $username == "" then null else $username end)
}' > "$CONFIG_FILE"
echo "$EXISTING" | jq \
--arg token "$BOT_TOKEN" \
--arg channel "$CHANNEL_ID" \
--arg mention "$MENTION" \
'.notifications = (.notifications // {enabled: true}) |
.notifications.enabled = true |
.notifications["discord-bot"] = {
enabled: true,
botToken: $token,
channelId: $channel,
mention: (if $mention == "" then null else $mention end)
}' > "$CONFIG_FILE"
For each event NOT selected, disable it:
# Example: disable session-start if not selected
echo "$(cat "$CONFIG_FILE")" | jq \
'.notifications.events = (.notifications.events // {}) |
.notifications.events["session-start"] = {enabled: false}' > "$CONFIG_FILE"
After writing config, offer to send a test notification:
Use AskUserQuestion:
Question: "Send a test notification to verify the setup?"
Options:
# For webhook:
curl -s -o /dev/null -w "%{http_code}" \
-H "Content-Type: application/json" \
-d "{\"content\": \"${MENTION:+$MENTION\\n}OMC test notification - Discord is configured!\"}" \
"$WEBHOOK_URL"
Report success or failure. If it fails, help the user debug (check URL, permissions, etc.).
Display the final configuration summary:
Discord Notifications Configured!
Method: Webhook / Bot API
Mention: <@1465264645320474637> (or "none")
Events: session-end, ask-user-question
Username: OMC
Config saved to: ~/.claude/.omc-config.json
You can also set these via environment variables:
OMC_DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/...
OMC_DISCORD_MENTION=<@1465264645320474637>
To reconfigure: /oh-my-claudecode:configure-notifications discord
To configure Telegram: /oh-my-claudecode:configure-notifications telegram
To configure Slack: /oh-my-claudecode:configure-notifications slack
Users can skip this wizard entirely by setting env vars in their shell profile:
Webhook method:
export OMC_DISCORD_WEBHOOK_URL="https://discord.com/api/webhooks/..."
export OMC_DISCORD_MENTION="<@1465264645320474637>" # optional
Bot API method:
export OMC_DISCORD_NOTIFIER_BOT_TOKEN="your-bot-token"
export OMC_DISCORD_NOTIFIER_CHANNEL="your-channel-id"
export OMC_DISCORD_MENTION="<@1465264645320474637>" # optional
Env vars are auto-detected by the notification system without needing .omc-config.json.
Set up Slack notifications so OMC can message you when sessions end, need input, or complete background tasks.
This is an interactive, natural-language configuration skill. Walk the user through setup by asking questions with AskUserQuestion. Write the result to ~/.claude/.omc-config.json.
CONFIG_FILE="$HOME/.claude/.omc-config.json"
if [ -f "$CONFIG_FILE" ]; then
HAS_SLACK=$(jq -r '.notifications.slack.enabled // false' "$CONFIG_FILE" 2>/dev/null)
WEBHOOK_URL=$(jq -r '.notifications.slack.webhookUrl // empty' "$CONFIG_FILE" 2>/dev/null)
MENTION=$(jq -r '.notifications.slack.mention // empty' "$CONFIG_FILE" 2>/dev/null)
CHANNEL=$(jq -r '.notifications.slack.channel // empty' "$CONFIG_FILE" 2>/dev/null)
if [ "$HAS_SLACK" = "true" ]; then
echo "EXISTING_CONFIG=true"
[ -n "$WEBHOOK_URL" ] && echo "WEBHOOK_URL=$WEBHOOK_URL"
[ -n "$MENTION" ] && echo "MENTION=$MENTION"
[ -n "$CHANNEL" ] && echo "CHANNEL=$CHANNEL"
else
echo "EXISTING_CONFIG=false"
fi
else
echo "NO_CONFIG_FILE"
fi
If existing config is found, show the user what's currently configured and ask if they want to update or reconfigure.
Guide the user through creating a webhook if they don't have one:
To set up Slack notifications, you need a Slack incoming webhook URL.
CREATE A WEBHOOK:
1. Go to https://api.slack.com/apps
2. Click "Create New App" > "From scratch"
3. Name your app (e.g., "OMC Notifier") and select your workspace
4. Go to "Incoming Webhooks" in the left sidebar
5. Toggle "Activate Incoming Webhooks" to ON
6. Click "Add New Webhook to Workspace"
7. Select the channel where notifications should be posted
8. Copy the webhook URL (starts with https://hooks.slack.com/services/...)
Use AskUserQuestion:
Question: "Paste your Slack incoming webhook URL (starts with https://hooks.slack.com/services/...)"
The user will type their webhook URL in the "Other" field.
Validate the URL:
https://hooks.slack.com/services/Use AskUserQuestion:
Question: "Would you like notifications to mention (ping) someone?"
Options:
Ask: "What is the Slack member ID to mention? (Click on a user's profile > More (⋯) > Copy member ID)"
The mention format is: <@MEMBER_ID> (e.g., <@U1234567890>)
The mention format is: <!channel>
The mention format is: <!here>
Use AskUserQuestion with multiSelect:
Question: "Which events should trigger Slack notifications?"
Options (multiSelect: true):
Default selection: session-end + ask-user-question.
Use AskUserQuestion:
Question: "Override the default notification channel? (The webhook already has a default channel)"
Options:
If override, ask for the channel name (e.g., #alerts).
Use AskUserQuestion:
Question: "Custom bot display name? (Shows as the webhook sender name in Slack)"
Options:
Read the existing config, merge the new Slack settings, and write back:
CONFIG_FILE="$HOME/.claude/.omc-config.json"
mkdir -p "$(dirname "$CONFIG_FILE")"
if [ -f "$CONFIG_FILE" ]; then
EXISTING=$(cat "$CONFIG_FILE")
else
EXISTING='{}'
fi
# WEBHOOK_URL, MENTION, USERNAME, CHANNEL are collected from user
echo "$EXISTING" | jq \
--arg url "$WEBHOOK_URL" \
--arg mention "$MENTION" \
--arg username "$USERNAME" \
--arg channel "$CHANNEL" \
'.notifications = (.notifications // {enabled: true}) |
.notifications.enabled = true |
.notifications.slack = {
enabled: true,
webhookUrl: $url,
mention: (if $mention == "" then null else $mention end),
username: (if $username == "" then null else $username end),
channel: (if $channel == "" then null else $channel end)
}' > "$CONFIG_FILE"
For each event NOT selected, disable it:
# Example: disable session-start if not selected
echo "$(cat "$CONFIG_FILE")" | jq \
'.notifications.events = (.notifications.events // {}) |
.notifications.events["session-start"] = {enabled: false}' > "$CONFIG_FILE"
After writing config, offer to send a test notification:
Use AskUserQuestion:
Question: "Send a test notification to verify the setup?"
Options:
# For webhook:
MENTION_PREFIX=""
if [ -n "$MENTION" ]; then
MENTION_PREFIX="${MENTION}\n"
fi
curl -s -o /dev/null -w "%{http_code}" \
-H "Content-Type: application/json" \
-d "{\"text\": \"${MENTION_PREFIX}OMC test notification - Slack is configured!\"}" \
"$WEBHOOK_URL"
Report success or failure. Common issues:
Display the final configuration summary:
Slack Notifications Configured!
Webhook: https://hooks.slack.com/services/T00/B00/xxx...
Mention: <@U1234567890> (or "none")
Channel: #alerts (or "webhook default")
Events: session-end, ask-user-question
Username: OMC
Config saved to: ~/.claude/.omc-config.json
You can also set these via environment variables:
OMC_SLACK_WEBHOOK_URL=https://hooks.slack.com/services/...
OMC_SLACK_MENTION=<@U1234567890>
To reconfigure: /oh-my-claudecode:configure-notifications slack
To configure Discord: /oh-my-claudecode:configure-notifications discord
To configure Telegram: /oh-my-claudecode:configure-notifications telegram
Users can skip this wizard entirely by setting env vars in their shell profile:
export OMC_SLACK_WEBHOOK_URL="https://hooks.slack.com/services/T00/B00/xxx"
export OMC_SLACK_MENTION="<@U1234567890>" # optional
Env vars are auto-detected by the notification system without needing .omc-config.json.
| Type | Format | Example |
|---|---|---|
| User | <@MEMBER_ID> | <@U1234567890> |
| Channel | <!channel> | <!channel> |
| Here | <!here> | <!here> |
| Everyone | <!everyone> |
All notification platforms require activation via CLI flags per session:
omc --telegram — Activates Telegram notifications (sets OMC_TELEGRAM=1)omc --discord — Activates Discord notifications (sets OMC_DISCORD=1)omc --slack — Activates Slack notifications (sets OMC_SLACK=1)omc --webhook — Activates webhook notifications (sets OMC_WEBHOOK=1)omc --openclaw — Activates OpenClaw gateway integration (sets OMC_OPENCLAW=1)Without these flags, configured platforms remain dormant. This prevents unwanted notifications during development while keeping configuration persistent.
Examples:
omc --telegram --discord — Telegram + Discord activeomc --telegram --slack --webhook — Telegram + Slack + Webhook activeomc --telegram --openclaw — Telegram + OpenClaw activeomc — No notifications sent (all platforms require explicit activation)Customize notification messages per event and per platform using omc_config.hook.json.
If the trigger or argument contains "hook", "template", or "customize messages" → follow this section.
Check if ~/.claude/omc_config.hook.json exists. If it does, show the current configuration. If not, explain what it does.
Hook event templates let you customize the notification messages sent to each platform.
You can set different messages for Discord vs Telegram vs Slack, and control which
events fire on which platform.
Config file: ~/.claude/omc_config.hook.json
Use AskUserQuestion:
Question: "Which event would you like to configure templates for?"
Options:
Display the template variables available for the chosen event:
Available template variables:
RAW FIELDS:
{{sessionId}} - Session identifier
{{timestamp}} - ISO timestamp
{{tmuxSession}} - tmux session name
{{projectPath}} - Full project directory path
{{projectName}} - Project directory basename
{{reason}} - Stop/end reason
{{activeMode}} - Active OMC mode name
{{question}} - Question text (ask-user-question only)
{{agentName}} - Agent name (agent-call only)
{{agentType}} - Agent type (agent-call only)
COMPUTED (smart formatting):
{{duration}} - Human-readable duration (e.g., "5m 23s")
{{time}} - Locale time string
{{modesDisplay}} - Comma-separated modes or empty
{{iterationDisplay}} - "3/10" format or empty
{{agentDisplay}} - "2/5 completed" or empty
{{projectDisplay}} - Project name with fallbacks
{{footer}} - tmux + project info line
{{tmuxTailBlock}} - Recent output in code fence or empty
{{reasonDisplay}} - Reason with "unknown" fallback
CONDITIONALS:
{{#if variableName}}content shown when truthy{{/if}}
Use AskUserQuestion:
Question: "Enter the message template for this event (use {{variables}} for dynamic content)"
Options:
If "Simple summary", use a pre-built compact template:
{{projectDisplay}} session ended ({{duration}}) — {{reasonDisplay}}Input needed on {{projectDisplay}}: {{question}}{{projectDisplay}} is idle. {{#if reason}}Reason: {{reason}}{{/if}}Session started: {{projectDisplay}} at {{time}}Use AskUserQuestion:
Question: "Do you want different messages for specific platforms?"
Options:
If per-platform: ask for each enabled platform's template separately.
Read or create ~/.claude/omc_config.hook.json and merge the new settings:
{
"version": 1,
"enabled": true,
"events": {
"<event-name>": {
"enabled": true,
"template": "<user-provided-template>",
"platforms": {
"discord": { "template": "<discord-specific>" },
"telegram": { "template": "<telegram-specific>" }
}
}
}
}
Validate the template using validateTemplate() to check for unknown variables. If any are found, warn the user and offer to correct.
Offer to send a test notification with the new template.
{
"version": 1,
"enabled": true,
"events": {
"session-end": {
"enabled": true,
"template": "Session {{sessionId}} ended after {{duration}}. Reason: {{reasonDisplay}}",
"platforms": {
"discord": {
"template": "**Session Complete** | `{{projectDisplay}}` | {{duration}} | {{reasonDisplay}}"
},
"telegram": {
"template": "Done: {{projectDisplay}} ({{duration}})\n{{#if contextSummary}}Summary: {{contextSummary}}{{/if}}"
}
}
},
"ask-user-question": {
"enabled": true,
"template": "{{#if question}}{{question}}{{/if}}\nWaiting for input on {{projectDisplay}}"
}
}
}
/oh-my-claudecode:configure-openclaw — Configure OpenClaw gateway integrationConfigure custom webhooks and CLI commands for services beyond the native Discord/Telegram/Slack integrations.
If the user says "custom integration", "openclaw", "n8n", "webhook", "cli command", or similar → follow this section.
If ~/.claude/omc_config.openclaw.json exists, detect and offer migration:
Step 1: Detect Legacy Config
LEGACY_CONFIG="$HOME/.claude/omc_config.openclaw.json"
if [ -f "$LEGACY_CONFIG" ]; then
echo "LEGACY_FOUND=true"
# Check if already migrated
if jq -e '.customIntegrations.integrations[] | select(.preset == "openclaw")' "$CONFIG_FILE" >/dev/null 2>&1; then
echo "ALREADY_MIGRATED=true"
else
echo "ALREADY_MIGRATED=false"
fi
else
echo "LEGACY_FOUND=false"
fi
Step 2: Offer Migration If legacy found and not migrated:
Question: "Existing OpenClaw configuration detected. Would you like to migrate it to the new format?"
Options:
If migrate:
omc_config.openclaw.json.omc-config.jsonomc_config.openclaw.json.bakStep 1: Select Integration Type
Question: "Which type of custom integration would you like to configure?"
Options:
Step 2: Gateway URL
Question: "What is your gateway/webhook URL?"
Validation:
Step 3: Authentication (Optional)
Question: "Does your gateway require authentication?"
Options:
If Bearer: ask for token If Custom: ask for header name and value
Step 4: Events
Use AskUserQuestion with multiSelect:
Question: "Which events should trigger this integration?"
Options (with defaults from preset):
Default for OpenClaw: session-start, session-end, stop Default for n8n: session-end, ask-user-question
Step 5: Test
Question: "Send a test notification to verify the configuration?"
Options:
If test:
# For webhook integrations
curl -X POST \
-H "Content-Type: application/json" \
${AUTH_HEADER:+"-H \"$AUTH_HEADER\""} \
-d '{"event":"test","instruction":"OMC test notification","timestamp":"'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"}' \
"$WEBHOOK_URL"
Show result (HTTP status, any error).
Step 6: Write Configuration
Merge into .omc-config.json:
{
"notifications": { /* existing native configs */ },
"customIntegrations": {
"enabled": true,
"integrations": [
{
"id": "my-openclaw",
"type": "webhook",
"preset": "openclaw",
"enabled": true,
"config": {
"url": "https://my-gateway.example.com/wake",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer ..."
},
"bodyTemplate": "{\\"event\\":\\"{{event}}\\",\\"instruction\\":\\"Session {{sessionId}} {{event}}\\",\\"timestamp\\":\\"{{timestamp}}\\"}",
"timeout": 10000
},
"events": ["session-start", "session-end"]
}
]
}
}
Step 2: URL Ask for webhook URL (HTTPS required).
Step 3: Method Ask for HTTP method (GET, POST, PUT, PATCH, DELETE). Default: POST.
Step 4: Headers Ask for headers in "Name: Value" format, one per line. Default: Content-Type: application/json
Step 5: Body Template Show available template variables and ask for body template (JSON or other format).
Default:
{
"event": "{{event}}",
"sessionId": "{{sessionId}}",
"projectName": "{{projectName}}",
"timestamp": "{{timestamp}}"
}
Step 6: Timeout Ask for timeout in milliseconds (1000-60000). Default: 10000.
Step 7: Events Multi-select events.
Step 8: Test and Save Same as preset flow.
Step 2: Command
Question: "What command should be executed? (single executable, no arguments)"
Example: curl, /usr/local/bin/my-script, notify-send
Validation:
Step 3: Arguments
Question: "Command arguments (use {{variable}} for dynamic values). Enter one per line."
Example:
-X
POST
-d
{"event":"{{event}}","session":"{{sessionId}}"}
https://my-api.com/notify
Show available template variables reference.
Step 4: Timeout Ask for timeout (1000-60000ms). Default: 5000.
Step 5: Events Multi-select events.
Step 6: Test and Save
For test, execute command with test values:
$COMMAND "${ARGS[@]//{{event}}/test}"
Show stdout/stderr and exit code.
List existing:
jq '.customIntegrations.integrations[] | {id, type, preset, enabled, events}' "$CONFIG_FILE"
Disable/Enable:
# Disable
jq '.customIntegrations.integrations = [.customIntegrations.integrations[] | if .id == "my-integration" then .enabled = false else . end]' "$CONFIG_FILE"
# Enable
jq '.customIntegrations.integrations = [.customIntegrations.integrations[] | if .id == "my-integration" then .enabled = true else . end]' "$CONFIG_FILE"
Remove:
jq '.customIntegrations.integrations = [.customIntegrations.integrations[] | select(.id != "my-integration")]' "$CONFIG_FILE"
All custom integrations support these template variables:
| Variable | Description | Example |
|---|---|---|
{{sessionId}} | Unique session ID | sess_abc123 |
{{projectPath}} | Full project path | /home/user/my-project |
{{projectName}} | Project directory name | my-project |
{{timestamp}} |
Session-end only:
{{agentsSpawned}}, {{agentsCompleted}}, {{modesUsed}}, {{contextSummary}}Ask-user-question only:
{{question}}src/notifications/template-variables.tssrc/notifications/validation.tssrc/notifications/presets.tsWeekly Installs
83
Repository
GitHub Stars
11.2K
First Seen
Feb 22, 2026
Security Audits
Gen Agent Trust HubWarnSocketWarnSnykFail
Installed on
opencode83
kimi-cli82
gemini-cli82
github-copilot82
cursor82
amp82
Skills CLI 使用指南:AI Agent 技能包管理器安装与管理教程
44,900 周安装
规范归档指南:变更提案归档与规范增量合并工作流程详解
227 周安装
Manim数学动画引擎教程 - Python编程创建数学可视化与教育视频
219 周安装
零售专家:零售系统、POS解决方案、库存管理与全渠道策略专业指南
82 周安装
Monorepo架构师:精通Nx、Turborepo、Bazel、Lerna的单仓库构建与优化
224 周安装
CRA迁移Next.js指南:148条规则,从React Router到App Router完整迁移
228 周安装
Elasticsearch安全故障排除指南:诊断401/403错误、TLS证书、API密钥和许可证问题
227 周安装
<!everyone> |
| User Group | <!subteam^GROUP_ID> | <!subteam^S1234567890> |
| ISO 8601 timestamp |
2026-03-05T14:30:00Z |
{{event}} | Event name | session-end |
{{duration}} | Human-readable duration | 45s |
{{durationMs}} | Duration in milliseconds | 45000 |
{{reason}} | Stop/end reason | completed |
{{tmuxSession}} | tmux session name | claude:my-project |