Skip to main content

Telegram webhook server that runs Claude Code or Codex in the background

Project description

Telecode

Tests PyPI

Telegram webhook server that routes messages to Claude or Codex, supports inline options, and can execute local shell commands via a slash command.

Install

From PyPI:

pip install telecode

From source:

pip install -e .

Quick Start

  1. Run the server.
telecode

The CLI will prompt for missing config (bot token and tunnel URL) and save them to ./.telecode.

Tunnel + Webhook

You need a public tunnel to your local port (default 8000).

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:

  1. ~/.telecode (global)
  2. ./.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: claude or codex.
  • TELECODE_HOST - Server host (default 0.0.0.0).
  • TELECODE_PORT - Server port (default 8000).
  • TELECODE_ALLOWED_USERS - Comma/space-separated user IDs or usernames (e.g., 12345,@name).
  • TELECODE_VERBOSE - Set to 1 for verbose console logging.
  • 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).

Images

  • 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).

Inline Options

If the model replies with numbered options (e.g., 1. Foo, 2) Bar), Telecode will render inline buttons and send the selected option back into the same chat session.

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

telecode-0.1.0.tar.gz (16.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

telecode-0.1.0-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file telecode-0.1.0.tar.gz.

File metadata

  • Download URL: telecode-0.1.0.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for telecode-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4db7e846d37e0fc1a548dab827a94428912282fea7cd17f55a6ec363232e20b1
MD5 f2baff7cf1a7f05c5ea8f333a30c4f84
BLAKE2b-256 525b26b3dbbcaf9ce3d5261ec5f6458e23239239c0ef91a2996705425f79bec5

See more details on using hashes here.

Provenance

The following attestation bundles were made for telecode-0.1.0.tar.gz:

Publisher: release.yml on polinom/telecode

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file telecode-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: telecode-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for telecode-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1ecabbdc9b9361d2917208919cf8c007dd9a5ea238a5ae1e25fc2cc0913b7f67
MD5 1fa00ca04c47613d3c25962c2f5f6a84
BLAKE2b-256 1522ea7fae3d9ed57f63ee970debc17fc9aed13e1a516bd2da4053b6508a8ce1

See more details on using hashes here.

Provenance

The following attestation bundles were made for telecode-0.1.0-py3-none-any.whl:

Publisher: release.yml on polinom/telecode

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page