Skip to main content
hook

telegram-notifications — Claude Code hook: Telegram alerts

Sends a Telegram message when Claude Code or a subagent finishes. Useful when you want completion alerts outside the terminal.

Install into Claude Code · claude-code-templates All methods and platforms ↓
npx claude-code-templates@latest --hook automation/telegram-notifications
Open on GitHub

What telegram-notifications does

The hook runs on Stop and SubagentStop events. It sends a Telegram message with a timestamp when Claude Code finishes its work or a subagent completes a task. A shell command uses curl to deliver each alert.

Set TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID in the environment first. If either value is missing, the notification is skipped. Install the hook with the command below; its configuration lives in .claude/settings.json.

What it helps with

  • get a Telegram alert when Claude Code finishes
  • track subagent completion without watching the terminal
  • see when a Claude Code task ended

Example prompts for the agent

  • Send me a Telegram message when you finish this task.
  • Notify me in Telegram after the subagent completes its work.

How to install telegram-notifications

1claude-code-templates

npx claude-code-templates@latest --hook automation/telegram-notifications

2Manually: put the files in place

.claude/settings.json

The hooks block: event (PreToolUse, PostToolUse, Stop…) → command. Personal ones go to ~/.claude/settings.json

Step by step, with commands for each platform: Claude Code hooks: what they are, where to configure them, how to block a risky command

Questions about telegram-notifications

How do I install telegram-notifications in Claude Code?

Run npx claude-code-templates@latest --hook automation/telegram-notifications. The hook configuration is in .claude/settings.json.

What does telegram-notifications do?

It sends Telegram messages on Stop and SubagentStop, when Claude Code or a subagent finishes working.

What does telegram-notifications need to run?

Set the TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID environment variables so the hook can send messages through your Telegram bot.

Source text

telegram-notifications.json · MIT
{
  "description": "Send Telegram notifications when Claude Code finishes working. Requires TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID environment variables. Get bot token from @BotFather, get chat ID by messaging the bot and visiting https://api.telegram.org/bot<TOKEN>/getUpdates",
  "hooks": {
    "Stop": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "if [[ -n \"$TELEGRAM_BOT_TOKEN\" && -n \"$TELEGRAM_CHAT_ID\" ]]; then MESSAGE=\"🤖 Claude Code finished working at $(date '+%Y-%m-%d %H:%M:%S')\"; curl -s -X POST \"https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendMessage\" -d \"chat_id=$TELEGRAM_CHAT_ID\" -d \"text=$MESSAGE\" -d \"parse_mode=HTML\" >/dev/null 2>&1 || echo \"Failed to send Telegram notification\"; else echo \"⚠️ Telegram notification skipped: Set TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID environment variables\"; fi"
          }
        ]
      }
    ],
    "SubagentStop": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "if [[ -n \"$TELEGRAM_BOT_TOKEN\" && -n \"$TELEGRAM_CHAT_ID\" ]]; then MESSAGE=\"🎯 Claude Code subagent completed task at $(date '+%Y-%m-%d %H:%M:%S')\"; curl -s -X POST \"https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendMessage\" -d \"chat_id=$TELEGRAM_CHAT_ID\" -d \"text=$MESSAGE\" -d \"parse_mode=HTML\" >/dev/null 2>&1 || echo \"Failed to send Telegram notification\"; else echo \"⚠️ Telegram notification skipped: Set TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID environment variables\"; fi"
          }
        ]
      }
    ]
  }
}

© davila7 · MIT · davila7/claude-code-templates

Similar hooks

All hooks for Automation and no-code: n8n, Zapier, Make →

From the same set740

The whole set →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor