Telegram webhook server that runs Claude Code or Codex in the background
Project description
Telecode
Telegram webhook server that routes messages to Claude or Codex and can execute local shell commands via a slash command.
Install
From PyPI:
pip install telecode
From source:
pip install -e .
Quick Start
- Run the server.
telecode
The CLI will prompt for missing config (bot token) and save it to ./.telecode. If TELEGRAM_TUNNEL_URL is missing, it will auto-start ngrok by default.
Tunnel + Webhook
You need a public tunnel to your local port (default 8000). By default, Telecode will start ngrok for you (requires ngrok Python SDK + a valid NGROK_AUTHTOKEN). To disable auto-start, use --no-ngrok or set TELECODE_NGROK=0.
If ngrok isn't authenticated yet, Telecode will prompt for the authtoken and save it to ~/.telecode.
Auto-started tunnels are subject to ngrok free plan limits: https://ngrok.com/docs/pricing-limits/free-plan-limits
ngrok http 8000
Telecode will generate a fresh webhook secret on each startup and set the webhook automatically using your bot token.
Configuration
Config is read from:
~/.telecode(global)./.telecode(local, overrides global)
When Telecode prompts interactively or you change engine via slash command, it writes to the local ./.telecode.
Common keys:
TELEGRAM_BOT_TOKEN- Telegram bot token from @BotFather.TELEGRAM_TUNNEL_URL- Public tunnel URL (e.g.,https://xxxx.ngrok-free.app).TELECODE_ENGINE- Default engine:claudeorcodex.TELECODE_HOST- Server host (default0.0.0.0).TELECODE_PORT- Server port (default8000).TELECODE_ALLOWED_USERS- Comma/space-separated user IDs or usernames (e.g.,12345,@name).TELECODE_VERBOSE- Set to1for verbose console logging.TELECODE_NGROK- Set to0to disable auto-starting ngrok.NGROK_AUTHTOKEN- ngrok auth token for auto-started tunnels.TELECODE_TTS- Set to1to enable TTS audio responses.TTS_TOKEN- Fish Audio API token (optional; can be stored in.telecode).TTS_MODEL- Fish Audio model (default:s1).TELECODE_SESSION_CLAUDE- Stored session id for Claude.TELECODE_SESSION_CODEX- Stored session id for Codex.TELECODE_ENGINE_OVERRIDE_<chat_id>- Per-chat engine override.
Example ./.telecode:
TELEGRAM_BOT_TOKEN=123456:ABCDEF...
TELEGRAM_TUNNEL_URL=https://xxxx.ngrok-free.app
TELECODE_ENGINE=claude
TELECODE_ALLOWED_USERS=12345678,@myuser
Telegram Commands
/engine- show current engine./engine claude- switch to Claude./engine codex- switch to Codex./claude- shortcut to Claude./codex- shortcut to Codex./cli <cmd>- run a shell command on the server (uses current working directory)./tts_on- enable TTS audio responses (global)./tts_off- disable TTS audio responses (global).
Images
Voice Messages
Voice notes require Whisper. Install it and ensure ffmpeg is available:
pip install openai-whisper
Install ffmpeg (macOS):
brew install ffmpeg
- Photos and image documents are supported.
- Images are downloaded to
./.telecode_tmp/and passed to the active engine. - Codex receives images via
--image. - Claude receives image file paths in the prompt (and the directory is allowed via
--add-dir).
Logging
Run with -v for verbose logging:
telecode -v
This prints inbound/outbound messages, commands, and exceptions.
Project details
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 telecode-0.1.4.tar.gz.
File metadata
- Download URL: telecode-0.1.4.tar.gz
- Upload date:
- Size: 18.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b38f3b8a31c8df023460d0ed0cff519401f272c8c2153bb03976d4315e7778d
|
|
| MD5 |
e90eaf5d63c1a286b1bd43f54e6a9a7e
|
|
| BLAKE2b-256 |
fff70c8a2547250c5359ae1763ccf00956cfcdc5a86b6dd9acf0a4b06d6b6acf
|
Provenance
The following attestation bundles were made for telecode-0.1.4.tar.gz:
Publisher:
release.yml on polinom/telecode
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
telecode-0.1.4.tar.gz -
Subject digest:
6b38f3b8a31c8df023460d0ed0cff519401f272c8c2153bb03976d4315e7778d - Sigstore transparency entry: 789171658
- Sigstore integration time:
-
Permalink:
polinom/telecode@189c12bb40afead3d3d8f48cc05c6f8842e7632f -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/polinom
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@189c12bb40afead3d3d8f48cc05c6f8842e7632f -
Trigger Event:
push
-
Statement type:
File details
Details for the file telecode-0.1.4-py3-none-any.whl.
File metadata
- Download URL: telecode-0.1.4-py3-none-any.whl
- Upload date:
- Size: 18.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac656230d6d939cf89b6ddb650fb300723d01d1f9f74ed415d260f7681afa0c4
|
|
| MD5 |
454a35ad895488045acafef2124fe57c
|
|
| BLAKE2b-256 |
562cc5846487623bc4a01f8cb62371b7f68cd382e92b20be18a2f4ecb9664773
|
Provenance
The following attestation bundles were made for telecode-0.1.4-py3-none-any.whl:
Publisher:
release.yml on polinom/telecode
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
telecode-0.1.4-py3-none-any.whl -
Subject digest:
ac656230d6d939cf89b6ddb650fb300723d01d1f9f74ed415d260f7681afa0c4 - Sigstore transparency entry: 789171661
- Sigstore integration time:
-
Permalink:
polinom/telecode@189c12bb40afead3d3d8f48cc05c6f8842e7632f -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/polinom
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@189c12bb40afead3d3d8f48cc05c6f8842e7632f -
Trigger Event:
push
-
Statement type: