waken-telegram
Telegram Source/Output for Waken —
long-polling in, sendMessage out.
Unlike waken-claude/waken-openai/... (Target adapters wrapping an
AI-agent backend), this package plugs into the other end of the runtime:
Telegram is a channel, so it ships a Source (turns incoming messages into
Events) and an Output (delivers a Response back to the chat it came
from), not a Target.
Install
pip install waken-telegram
Set TELEGRAM_BOT_TOKEN in your environment — get one from
@BotFather.
Usage
from waken import Runtime, target_fn, Event, Response
from waken_telegram import TelegramSource, TelegramOutput
@target_fn
async def echo(event: Event) -> Response:
return Response(text=event.payload["prompt"])
runtime = Runtime()
runtime.target("echo", echo)
runtime.source("telegram", TelegramSource(target="echo"))
runtime.output("telegram", TelegramOutput())
runtime.run()
Message a bot registered under TELEGRAM_BOT_TOKEN and it replies through
the same chat — TelegramSource stashes the chat's id on
Event.metadata["chat_id"], and TelegramOutput reads it back off to know
where to send the response.
Design notes
- Long polling, not webhooks.
TelegramSourcecallsBot.get_updatesin a background loop rather than standing up a webhook receiver — no public HTTP endpoint, no signature-verification story. It also sidesteps a real limitation in corewaken's webhook route today: it only passes handlers the parsed JSON body, with no request headers, which blocks any signature-verified webhook flow. That's a gap inwakencore, not something worked around here. - Sessions are keyed by the Telegram
chat_idviaruntime.session("telegram", str(chat_id)), so a Target sees the samesession_idacross a chat's messages. - Text messages only, by design. Photos, stickers, voice notes, and
every other Telegram message type are ignored in v1 — a deliberate scope
boundary, not an oversight. Extending
TelegramSource._poll_onceto branch on moreMessagefields is the natural next step if you need it.
Development
git clone https://github.com/WakenHQ/waken-telegram
cd waken-telegram
pip install -e ".[dev]"
pytest
Tests mock telegram.Bot entirely — no network access or real bot token
needed to run the suite.
License
Metadata
Release files for waken-telegram 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| waken_telegram-0.1.0.tar.gz | 7.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| waken_telegram-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.4 kB
Release files / waken_telegram-0.1.0.tar.gz
| Download URL | waken_telegram-0.1.0.tar.gz |
|---|---|
| Size | 7.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dfea5d4cb806fb197872da8d26a5907fd756e45917074c4b92a813fb57388b70
|
|
BLAKE2b-256 checksum How to use checksums |
401206db9ebb5cb74d85895d5e1728f275de553b8065ea839f90b7bb4670c59d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 5, 2026.
Transparency logRelease files / waken_telegram-0.1.0-py3-none-any.whl
| Download URL | waken_telegram-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
993abd020972d4edfd41f0f46802710f72107ee042500a4e55a396523512bacd
|
|
BLAKE2b-256 checksum How to use checksums |
0c9e6b130eac6f0acacac7635b4ebfa416a30d59a66bfc948059b14afab01d68
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 5, 2026.
Transparency log