Telegram Source/Output for Waken — long-polling in, sendMessage out.
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file waken_telegram-0.1.0.tar.gz.
File metadata
- Download URL: waken_telegram-0.1.0.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dfea5d4cb806fb197872da8d26a5907fd756e45917074c4b92a813fb57388b70
|
|
| MD5 |
28b90046638851bce7922bd3dd751f64
|
|
| BLAKE2b-256 |
401206db9ebb5cb74d85895d5e1728f275de553b8065ea839f90b7bb4670c59d
|
Provenance
The following attestation bundles were made for waken_telegram-0.1.0.tar.gz:
Publisher:
publish.yml on WakenHQ/waken-telegram
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
waken_telegram-0.1.0.tar.gz -
Subject digest:
dfea5d4cb806fb197872da8d26a5907fd756e45917074c4b92a813fb57388b70 - Sigstore transparency entry: 2082043348
- Sigstore integration time:
-
Permalink:
WakenHQ/waken-telegram@3a688d75fc0052121058bf8ec9cb84968b6155e9 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/WakenHQ
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3a688d75fc0052121058bf8ec9cb84968b6155e9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file waken_telegram-0.1.0-py3-none-any.whl.
File metadata
- Download URL: waken_telegram-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
993abd020972d4edfd41f0f46802710f72107ee042500a4e55a396523512bacd
|
|
| MD5 |
8d2261542d461f4d11568fed8dca443c
|
|
| BLAKE2b-256 |
0c9e6b130eac6f0acacac7635b4ebfa416a30d59a66bfc948059b14afab01d68
|
Provenance
The following attestation bundles were made for waken_telegram-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on WakenHQ/waken-telegram
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
waken_telegram-0.1.0-py3-none-any.whl -
Subject digest:
993abd020972d4edfd41f0f46802710f72107ee042500a4e55a396523512bacd - Sigstore transparency entry: 2082043409
- Sigstore integration time:
-
Permalink:
WakenHQ/waken-telegram@3a688d75fc0052121058bf8ec9cb84968b6155e9 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/WakenHQ
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3a688d75fc0052121058bf8ec9cb84968b6155e9 -
Trigger Event:
push
-
Statement type: