Emanuell112 downloadsSend notifications and approval requests with buttons to Telegram from AI agents and scripts, with strict security limits.
Telegram AI Gateway is an Obsidian plugin that enables AI agents (Claude Code, Antigravity) and automation scripts to send rich notifications and interactive approval requests with inline buttons to Telegram, with strict security controls and zero open network ports.
It operates as an integrated module of the AI Ecosystem and integrates seamlessly with Environment Keys for encrypted credential storage and AI Templates for structured Markdown templates.
telegram_ask_approval). Returns immediately with a pending ID; clients poll telegram_get_approval with a 25s wait window to await decisions without client timeouts.telegram_ask_question), each with two to four options as buttons, multiple choice and a free text answer. Same shape as Claude Code's AskUserQuestion. The question never expires unless you ask it to.telegram_resolve_approval), automatically updating the Telegram message status and removing buttons.data.json. The token is stored encrypted in Environment Keys and referenced via placeholder ({{secret:TELEGRAM_BOT_TOKEN}}), ensuring it never appears in logs or inspector tools.template_id + data)..telegram-queue) for automatic transmission.| Tool | Description |
|---|---|
telegram_send_message |
Send a notification to Telegram. Accepts optional template_id and data when AI Templates is active. |
telegram_ask_approval |
Send a decision request with interactive buttons. Returns { id, status: "pending" }. |
telegram_get_approval |
Poll for user decision (supports wait up to 25s for loop polling without timeouts). |
telegram_resolve_approval |
Resolve pending approval(s) directly from chat/terminal. |
telegram_ask_question |
Ask one to four questions with option buttons, multiSelect and free text. Returns { id, status: "pending" }. |
telegram_get_question |
Poll the answers (supports wait up to 25s). When answered returns answers keyed by question text. |
telegram_resolve_question |
End pending question(s) as answered_elsewhere (answered on the PC) or interrupted, cleaning the Telegram messages. |
All endpoints are hosted on the AI Ecosystem local server:
POST /api/v1/telegram-ai-gateway/sendPOST /api/v1/telegram-ai-gateway/approvalGET /api/v1/telegram-ai-gateway/approval/:id?wait=25POST /api/v1/telegram-ai-gateway/resolvePOST /api/v1/telegram-ai-gateway/questionGET /api/v1/telegram-ai-gateway/question/:id?wait=25POST /api/v1/telegram-ai-gateway/question/resolveGET /api/v1/telegram-ai-gateway/statustelegram_ask_question (REST: POST /question) takes questions (1 to 4; each with question, header of up to 12 characters, options 2 to 4 with label and optional description, and multiSelect) and the optional allow_free_text (default true), expires_in_minutes, chat_id, title, context, urgent and silent. It uses the same policy as approvals (AI sending allowed, quiet hours, rate limit, owner or allowed chat) and needs the bot token and the owner chat id; the pedidos_aprovacao notify event must be enabled.
Other (type) / Outro (digitar) when free text is allowed.Send / Enviar button submits the selection. The answer is the list of labels.data.json. When the question ends, from any side, the messages are edited to the final status and lose their buttons. Pending questions survive a plugin reload and keep working.expires_in_minutes is given (the approval expiry setting does not apply).telegram_get_question returns { status: "answered", answers: { "<question text>": "<label>" } }; multiSelect gives a list of labels, typed text gives the text and also free_text: { "<question text>": true }.telegram_resolve_question with answered_elsewhere or interrupted, so no message stays at waiting.Claude Code's AskUserQuestion hook can use these tools to send its questions to Telegram.
The AI Ecosystem core can install Claude Code hooks and a setup skill for this module in the vault's .claude/ folder:
.claude/skills/configurar-telegram-ai-gateway/, hook entries in .claude/settings.local.json (or settings.json), state in .claude/ai-ecosystem/, and a block in GEMINI.md for Antigravity..claude/ entries is overwritten.No protection hook for this module. The guided setup:
TELEGRAM_BOT_TOKEN; the setup key token_secret only receives the secret name./start to the bot. The first private chat becomes the owner, only while no owner is set, and Obsidian shows a notice.eventos (stored, informational for now).Telegram AI Gateway é um plugin para Obsidian que permite que agentes de IA (Claude Code, Antigravity) e scripts de automação enviem notificações formatadas e pedidos de aprovação interativos com botões para o Telegram, com controles rigorosos de segurança e sem abrir portas próprias de rede.
Opera como módulo integrado do AI Ecosystem, com integração nativa com o Environment Keys para proteção de credenciais e com o AI Templates para moldes de mensagens.
telegram_ask_approval). Responde imediatamente com ID pendente; clientes consultam telegram_get_approval com espera de até 25s por chamada, permitindo espera sem limite de tempo sem timeout de ferramentas.telegram_ask_question), cada uma com de duas a quatro opções como botões, escolha múltipla e resposta livre. Mesmo formato do AskUserQuestion do Claude Code. A pergunta nunca expira, a menos que você peça.telegram_resolve_approval), atualizando a mensagem com o marcador de status e removendo os botões.{{secret:TELEGRAM_BOT_TOKEN}}), nunca aparecendo em logs ou no inspetor..telegram-queue).setIcon.telegram_ask_question (REST: POST /question) recebe questions (de 1 a 4; cada uma com question, header de até 12 caracteres, options de 2 a 4 com label e description opcional, e multiSelect) e, opcionalmente, allow_free_text (padrão true), expires_in_minutes, chat_id, title, context, urgent e silent. Segue a mesma política das aprovações (envio de IA permitido, horário de silêncio, limite de envios, chat do dono ou permitido) e exige o token do bot e o chat id do dono; o evento pedidos_aprovacao precisa estar ativo.
Outro (digitar) / Other (type) quando a resposta livre é permitida.Enviar / Send envia a seleção. A resposta é a lista de rótulos.data.json. Quando a pergunta termina, de qualquer lado, as mensagens são editadas para o status final e perdem os botões. Perguntas pendentes sobrevivem ao recarregamento do plugin e continuam funcionando.expires_in_minutes for informado (a configuração de expiração das aprovações não vale aqui).telegram_get_question devolve { status: "answered", answers: { "<texto da pergunta>": "<rótulo>" } }; multiSelect devolve uma lista de rótulos e o texto digitado devolve o texto e também free_text: { "<texto da pergunta>": true }.telegram_resolve_question com answered_elsewhere ou interrupted, para nenhuma mensagem ficar em aguardando.telegram_ask_question, telegram_get_question e telegram_resolve_question; POST /api/v1/telegram-ai-gateway/question, GET /api/v1/telegram-ai-gateway/question/:id?wait=25 e POST /api/v1/telegram-ai-gateway/question/resolve.O hook do AskUserQuestion do Claude Code pode usar essas tools para mandar as perguntas ao Telegram.
O núcleo AI Ecosystem pode instalar hooks do Claude Code e uma skill de configuração para este módulo na pasta .claude/ do cofre:
.claude/skills/configurar-telegram-ai-gateway/, entradas de hook em .claude/settings.local.json (ou settings.json), estado em .claude/ai-ecosystem/ e um bloco no GEMINI.md para o Antigravity..claude/ é sobrescrito.Este módulo não tem hook de proteção. A configuração guiada:
TELEGRAM_BOT_TOKEN; a chave token_secret recebe só o nome do secret./start para o bot. A primeira conversa privada vira a dona, só enquanto não houver dona definida, e o Obsidian mostra um aviso.eventos (guardada, informativa por enquanto).MIT © Emanuell Pires