Skip to main content
Chapter 4 Remote Control: Telegram, WhatsApp, Slack & iMessage

Hooks: Proactive Pings When Work Is Done

6 min read Lesson 26 / 65 Preview

Hooks: from reactive to proactive

The Heartbeat handles time-based triggers ("every weekday at 9am"). Hooks handle event-based triggers ("when this happens"). Together they cover almost every workflow you will ever want.

A few useful Hooks

  • PostToolUse — fires after any tool call. Use it to log every shell command for audit.
  • OnTaskComplete — fires when a multi-step task ends. Send a Telegram ping with the summary.
  • OnInbox — fires when a file lands in ~/inbox/. Trigger an OCR/summarize flow.
  • OnError — fires on any tool failure. Notify if the same error happens twice in a row.

A working "remember me" Hook

- name: ping-on-completion
  on: task_complete
  channel: telegram
  template: |
    Done: {{ task.summary }}
    Spent: {{ task.duration_seconds }}s, {{ task.tokens }} tokens.
    Cost: ${{ task.cost_usd }}.

This single Hook is worth the entire chapter. After installing it, your agent stops being a thing you check on and starts being a thing that reports back.

Hook hygiene

  • Rate-limit your Hooks — three notifications a minute is helpful, thirty is spam
  • Whitelist channels — Hooks should fire only into channels you opted in
  • Test Hooks in the debug console first — there is a "fire dummy event" button for exactly this

Try it

Add the ping-on-completion Hook above. Run any non-trivial task from Telegram. Confirm you get a single, well-formatted summary message back when it is done.

Next Lesson Voice Input with Whisper & FFmpeg
Engr Mejba Ahmed

Engr Mejba Ahmed

Claude Code Expert · Online

👋

Hey there!

Quick Actions

WhatsApp Instant reply

Chat on WhatsApp

+880 1723 741224 · Instant reply

Popular Questions

Engr Mejba Ahmed is connected
Engr Mejba Ahmed is typing...
Engr Mejba Ahmed avatar

✉ Want me to follow up? Drop your email

Engr Mejba Ahmed avatar

📞 Connect Directly

Choose how you'd like to reach me

WhatsApp

+880 1723 741224

Email

[email protected]

✓ Details sent! I'll get back to you shortly.

Powered by OpenAI

335+

Blog Posts

25

AI Courses

63

Projects

Services & Expertise

Pricing & Process

Learning & Resources

Connect & Support