Skip to content

Telegram Bot Integration for Agents (TGRAM-001) #86

Closed as not planned
Closed as not planned

Description

@vybe

Summary

Enable each Trinity agent to have its own Telegram bot account for bidirectional chat and notification forwarding. Users can message agents, receive notifications, and approve/reject actions directly from Telegram — a mobile-first interface for agent management.

Requirements doc: docs/requirements/TELEGRAM_INTEGRATION.md

Motivation

  • Identified as a gap in the OpenClaw comparison (2026-02-13 decision log)
  • Listed in roadmap archive as MEDIUM priority backlog item
  • Enables "review agent work while drinking coffee" UX
  • Architecture designed to support WhatsApp/Discord/other channels later

Key Design Decisions

  • Per-agent bots: Each agent gets its own Telegram bot (token via @Botfather)
  • Credential reuse: Bot tokens use existing CRED-002 injection system (zero changes needed)
  • Multi-bot single endpoint: All bots share one webhook URL, differentiated by random secret in path
  • Notification bridge: Hooks into existing NOTIF-001 system to forward notifications to Telegram
  • Library: aiogram 3.x (fully async, aligns with FastAPI)
  • Dev/prod modes: Polling for development, webhook for production

Implementation Phases

  1. Core Infrastructure (MVP) — DB tables, webhook receiver, message routing, polling mode, basic UI
  2. Notification Bridge — Forward NOTIF-001 notifications to Telegram with type-based formatting
  3. Interactive Features — Inline keyboards for approve/reject on "question" notifications
  4. Webhook Mode — Production webhook setup with secret validation
  5. Polish & UX — QR codes, markdown conversion, conversation context, test messages

Scope

New Files

  • src/backend/routers/telegram.py — Webhook receiver, registration endpoints
  • src/backend/services/telegram_service.py — Bot lifecycle, messaging, polling/webhook
  • src/backend/db/telegram.py — Database operations

Modified Files

  • src/backend/db/schema.py — 2 new tables (telegram_bindings, telegram_chat_links)
  • src/backend/main.py — Mount router, start polling on startup
  • src/backend/routers/notifications.py — Hook notification broadcast to Telegram
  • src/frontend/src/views/AgentDetail.vue — Telegram status panel

New Dependency

  • aiogram 3.x

Related

  • NOTIF-001: Upstream notification system (Telegram forwards these)
  • SLACK-001: Sibling channel integration (same architectural pattern)
  • CRED-002: Credential injection (reused for bot tokens)

Activity

  1. added
    enhancement
    on Mar 9, 2026
  2. vybe commented on Mar 30, 2026

    @vybe
    ContributorAuthor

    Actualization (2026-03-30)

    Duplicate of #103 — both track Telegram Bot Integration (TGRAM-001). Issue #103 has more detail and is ranked in the project board at P1c.

    Additionally, #216 was filed on 2026-03-27 with an expanded scope (media support, public link sharing).

    Recommendation: Close as duplicate of #103. #216 extends the scope further.

  3. vybe commented on Mar 30, 2026

    @vybe
    ContributorAuthor

    Closing — duplicate of #103 (TGRAM-001). See also #216 for expanded scope.

  4. added
    complexity-medium
    on Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    complexity-mediumenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions