telegram-bridge

Operates Telegram turns, replies, attachments, buttons, voice, and Threaded Mode routing for Pi sessions.

Updated Aug 2, 2026
One-click install
npx skills add https://github.com/mikalv/pi-extensions --skill telegram-bridge-mikalv
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: telegram-bridge
Source: https://github.com/mikalv/pi-extensions/tree/main/packages/pi-telegram/skills/telegram-bridge
Command: npx skills add https://github.com/mikalv/pi-extensions --skill telegram-bridge-mikalv

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? It defines how an AI agent should handle requests arriving from Telegram through the pi-telegram bridge, covering reply ownership, direct delivery, attachments, interactive buttons, voice messages, and multi-thread routing without breaking bridge transport rules. ## Core Features & Use Cases - Turn Recognition and Reply Ownership: Parses structured Telegram context markers like [telegram|thread:name|from:user], [reply], [attachments], and [voice] so the agent answers the current turn correctly without duplicating delivery. - Direct Delivery and Attachments: Uses telegram_message and telegram_attach for explicit cross-target delivery and file sending, with fail-closed behavior for unknown or unauthorized targets. - Assistant-Authored Buttons and Voice: Emits telegram_button and telegram_voice HTML comments to create prompt buttons and TTS voice messages, including JSON, matrix, and Compact Matrix Literal forms. - Threaded Mode and Diagnosis: Routes across live Pi Threads, configures inbound/outbound handlers in telegram.json, and diagnoses bridge health via telegram-status and state/log files. - Use Case: A user messages your Pi agent from Telegram asking for a generated report; the agent replies in phone-friendly Markdown, attaches the file with telegram_attach, and offers follow-up action buttons. ## Quick Start Ask the agent to reply to the incoming Telegram message and attach the generated report file to the current Telegram conversation.

Frequently Asked Questions about telegram-bridge

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I reply to a Telegram message from a Pi agent?▼

During an active Telegram turn, just answer normally in concise Telegram Rich Markdown; the bridge owns delivery to the current target. Do not call telegram_message for the current target, as that would duplicate the ordinary reply.

How do I send a file to a Telegram chat from the agent?▼

Call telegram_attach with the local file path instead of naming or pasting the file. During an active Telegram turn, omit targeting so the file joins the current reply; outside a turn, only attach when the user explicitly requests file delivery.

How do I add interactive buttons to Telegram replies?▼

Emit telegram_button HTML comments at column zero with a label and self-contained prompt, using JSON objects, matrices, or Compact Matrix Literal. A button click creates a new user request and does not bypass confirmation for dangerous actions.

When should I use telegram_message instead of a normal reply?▼

Use telegram_message only when the user explicitly requests Telegram delivery from a local turn or names a different concrete target such as a chat_id or another live Thread. Unknown, ambiguous, offline, or unauthorized targets fail closed.

How do I diagnose Telegram bridge delivery problems?▼

Run telegram-status for compact health, then telegram-status --debug for bounded diagnostics. For deeper evidence, inspect state.json and logs.jsonl under ~/.pi/agent/tmp/telegram, and never mutate bridge state or lock files to force recovery.

Can the bridge send voice messages automatically?▼

Yes, automatic voice modes are hidden, mirror, and always, controlled by bridge policy and indicated by a [voice] line in the turn context. You can also emit an explicit telegram_voice comment with TTS-friendly text, and the bridge creates the OGG audio itself.