8000 feat(chat): built-in Telegram bot, on a shared chat-channel layer by adeelahmad · Pull Request #293 · adeelahmad/lense · GitHub
[go: up one dir, main page]

Skip to content

feat(chat): built-in Telegram bot, on a shared chat-channel layer - #293

Merged
adeelahmad merged 10 commits into
mainfrom
claude/project-thread-cnpj08
Oct 11, 2026
Merged

adeelahmad merged 10 commits into
mainfrom
claude/project-thread-cnpj08

Conversation

@adeelahmad
Copy link
Copy Markdown
Owner

Requested by Adeel · project thread

Description

Before: the assistant reached Telegram only through Matterbridge (an extra service, config per chat, no voice notes or files).

After: Settings › Telegram: paste a bot token from @Botfather, turn it on, message the bot, click Let in next to your name. Lens reads the bot with getUpdates long polling (no public address) and answers. Private chats are always for Lens; in groups it answers its name, an @bot mention or a reply. Voice notes are transcribed by the server's speech-to-text (the answer starts with "(Heard: …)"), and files are held for the assistant to import, as a file dropped into Chat is. Namespace routing, chats given to a namespace's assistant (<chat id> = ns), approving by "yes", and the account it answers as work as in Matterbridge rooms.

How: new app/domain/channels.py is the shared adapter layer (ready / check / fetch / send / download, plus the per-channel thread, lease and status that used to live in bridge.py). bridge.handle now takes the adapter and serves both; Matterbridge is bridge.MATTERBRIDGE, Telegram is telegram.TELEGRAM. The Slack thread builds its adapter on this. GET /settings/telegram, POST /settings/telegram/test; uploads.take(hold=True) for files arriving whole.

Motivation and Context

Adeel asked for built-in Telegram and Slack integrations, one thread each. This thread owns the shared layer.

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist:

  • The title is a Conventional Commit.
  • My code follows the code style of this project.
  • I added or updated tests (tests/api/test_telegram.py against tests/fake_telegram.py; bridge tests unchanged and passing).
  • Docs updated (docs/chat-rooms.md), threat model (N-BRIDGE row), CHANGELOG.

Done questions

  1. Goal: built-in Telegram with the room features; merges on green. Yes.
  2. Agents: the settings and status are API endpoints like every section; the bot is itself a way to reach the assistant. Yes.
  3. Zero setup: a token and one click; no service, no tunnel. Yes.
  4. Fewest clicks: people who write are listed with Let in; chat ids listed for rooms. Yes.
  5. Settings in the web app with defaults, off by default, not in the wizard. Yes.
  6. Pi: one thread, stdlib HTTP, idle while off. Yes.
  7. Private: token sealed as a secret; answers only people let in (anyone can find a bot); threat model N-BRIDGE updated. Yes.
  8. Cost: Telegram calls are free; answers use the same model path as rooms. n/a for the ledger (no metered call added).
  9. Defaults unchanged; off until turned on; consequential changes still wait for approval. Yes.
  10. Safe upgrades: a new settings section only; the bridge lease record now keeps its row on release (unset holder) instead of deleting it, which old rows tolerate. Yes.
  11. Honest: docs describe only what's built. Yes.
  12. Tested, documented, make openapi. Yes.
  13. No new dependencies. Yes.
  14. Refine later (in telegram.py): inline-keyboard approvals, answers as voice notes, Markdown formatting; /clear and /compact arrive for every channel with feat(chat): /clear and /compact commands, and early compaction near the context limit #269, which hooks into bridge.handle.

🤖 Generated with Claude Code

https://claude.ai/code/session_0194jTK9wbki29B4LcS7aKHG


Generated by Claude Code

Paste a bot token from @Botfather in Settings > Telegram and the assistant
answers there through getUpdates long polling: no Matterbridge, no public
address. It answers only people let in (one click from the settings page),
transcribes voice notes, holds files for the assistant to import, and keeps
everything Matterbridge rooms do (namespace routing, approving by reply).

channels.py is the adapter layer: Matterbridge and Telegram are adapters with
their own thread, lease and status, and bridge.handle serves both.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0194jTK9wbki29B4LcS7aKHG
@adeelahmad adeelahmad self-assigned this Oct 10, 2026
…at channel

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0194jTK9wbki29B4LcS7aKHG
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0194jTK9wbki29B4LcS7aKHG
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0194jTK9wbki29B4LcS7aKHG
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0194jTK9wbki29B4LcS7aKHG
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0194jTK9wbki29B4LcS7aKHG
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0194jTK9wbki29B4LcS7aKHG
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0194jTK9wbki29B4LcS7aKHG
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0194jTK9wbki29B4LcS7aKHG
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0194jTK9wbki29B4LcS7aKHG
@adeelahmad
adeelahmad merged commit 288365a into main Oct 11, 2026
11 checks passed
@adeelahmad
adeelahmad deleted the claude/project-thread-cnpj08 branch October 11, 2026 02:22
adeelahmad pushed a commit that referenced this pull request Oct 11, 2026
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VdrxhwvmLjFsfzQZ5pRJGC
adeelahmad added a commit that referenced this pull request Oct 11, 2026
…monitoring switch as built (#351)

"Ask" names the built-in Telegram bot (#293) and Slack app (#287); "Connect your agents" adds mounting the graph's
files read-only over S3, WebDAV, NFS or SMB (#324, #295, #305) and copying the MCP address from the account menu
(#340); "Watch it run" says one switch in the web app starts Prometheus and Grafana (#337); "Light by default" adds
the cloud model presets (#334). The docs index gains the NFS and SMB pages, and "In progress" keeps only open PRs.


Claude-Session: https://claude.ai/code/session_01HDx7PPUauyjMn1LZs8JAsS

Co-authored-by: Adeel Ahmad <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0