Telegram messages for blocked and finished tasks
By Jake Marsh, who builds Taskhold. Updated 2026-10-26. Facts about other tools checked 2026-10-26. 3 min read.
A Telegram bot is a quick way to get agent questions on your phone. This script follows Taskhold's event stream and messages you through your own bot when an agent blocks or finishes a task, with a link to the live board where you reply.
What you get
One Telegram message when an agent blocks a task with a question, and one when it finishes a whole task (not each step). Each says which agent, the task title, the question or the summary, and links to the live board, where you reply. Your own changes never trigger a message.
Before you begin
- A bot token from @BotFather (/newbot).
- Your chat id: send your bot any message, then open https://api.telegram.org/bot<token>/getUpdates and read message.chat.id.
- A Taskhold API key from Settings > API keys, named after this script so you can revoke it on its own.
- bash, curl and jq on the machine that runs the script.
The script
Save this as taskhold-telegram.sh and make it executable (chmod +x). The top half is the Telegram part; the loop below it is the same for every notifier.
#!/bin/bash
# taskhold-telegram.sh: message you on Telegram when an agent blocks or finishes a Taskhold task.
# Needs curl and jq. Run: TASKHOLD_API_KEY=atd_sk_... ./taskhold-telegram.sh
key=${TASKHOLD_API_KEY:?set TASKHOLD_API_KEY}
board=https://taskhold.com/dashboard/live
last=""
: "${TELEGRAM_BOT_TOKEN:?set TELEGRAM_BOT_TOKEN}" "${TELEGRAM_CHAT_ID:?set TELEGRAM_CHAT_ID}"
notify() { # kind, title, detail, agent
if [ "$1" = blocked ]; then h="$4 needs you"; else h="$4 finished a task"; fi
curl -s -o /dev/null "https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendMessage" \
-d "chat_id=$TELEGRAM_CHAT_ID" \
--data-urlencode "text=$(printf '%s\n%s\n%s\n%s' "$h" "$2" "$3" "$board" | cut -c1-4000)"
}
while :; do
while IFS= read -r line; do
case "$line" in
"id: "*) last=${line#id: } ;;
"data: "*)
e=${line#data: }
# Agents only: a task (not a step) finished, or any task or step blocked.
jq -e '.type == "task.status" and .actor == "agent" and (.data.to == "blocked" or (.data.to == "done" and .task_id == .root_task_id))' <<<"$e" >/dev/null || continue
kind=$(jq -r .data.to <<<"$e")
title=$(jq -r '.task_title // "a task"' <<<"$e")
agent=$(jq -r '.actor_name // "An agent"' <<<"$e")
detail=$(jq -r 'if .data.to == "blocked" then .data.blocked_reason else .data.completed_summary end // ""' <<<"$e")
notify "$kind" "$title" "$detail" "$agent" ;;
esac
done < <(curl -sN https://taskhold.com/api/events/stream -H "Authorization: Bearer $key" ${last:+-H "Last-Event-ID: $last"})
sleep 3
doneRun it anywhere a process can stay up, such as a spare terminal, a tmux window or a small server:
TELEGRAM_BOT_TOKEN=123:abc TELEGRAM_CHAT_ID=42 TASKHOLD_API_KEY=atd_sk_... ./taskhold-telegram.shThe server ends each stream after 10 minutes and the script reconnects with the last event id, so events that happen in between arrive once, in order. Details on the stream: events and the live stream.
One limit to know
The bot can only message you after you have messaged it first, which is also how you find the chat id. Replies you type to the bot go nowhere: answer on the board, where the agent reads them.
See how far along your coding agents are.
$12/month or $120/year after the trial. Card up front. Cancel before day 7 and you pay nothing. Every agent you run is included.
Sources
- Telegram Bot API: sendMessage, checked 2026-10-26
Related
Updated 2026-10-26. Something wrong or out of date? Email hello@greatwork.company.