Skip to main content

Telegram bot bridge for codex app-server over stdio

Project description

telecodex

ci test codecov PyPI pyversions Current version on PyPI

Telegram bot bridge for codex app-server over stdio JSON-RPC.

The bot receives Telegram messages, sends them to codex app-server, and replies back to Telegram chats.

Requirements

  • Python 3.10+
  • A Telegram bot token (from @BotFather)
  • codex CLI installed with codex app-server available

Install

uv sync --group dev

Configuration

By default, telecodex reads a platform-specific config path:

  • macOS: ~/Library/Application Support/telecodex/config.toml
  • Linux: ~/.config/telecodex/config.toml
  • Windows: %APPDATA%\\telecodex\\config.toml

Example:

[telecodex]
telegram_bot_token = "123456:ABC..."
allowed_chat_id = 123456789
# optional: enable ACP message logging
# acp_log_file = "/path/to/acp-messages.log"
codex_app_server_cmd = "codex app-server"
codex_model = "gpt-5"
codex_cwd = "."
codex_approval_policy = "never"
poll_timeout_seconds = 30

You can choose another config file with:

python3 -m telecodex --config /path/to/config.toml

Option precedence is:

  1. CLI flags
  2. Environment variables (TELEGRAM_BOT_TOKEN, TELEGRAM_ALLOWED_CHAT_ID, TELECODEX_ACP_LOG_FILE, CODEX_*, POLL_TIMEOUT_SECONDS)
  3. TOML config values
  4. Built-in defaults

allowed_chat_id (or TELEGRAM_ALLOWED_CHAT_ID) is mandatory, and the bot only replies to that chat id. ACP/app-server message logging is disabled by default and is enabled only when acp_log_file (or TELECODEX_ACP_LOG_FILE) is set.

Run

# optional: create config.toml at the default platform-specific location shown above
python3 -m telecodex

Telegram commands

On startup, the bot registers Telegram commands:

  • /start: sends hello to Codex to initialize/start the conversation turn
  • /verbose: toggles an internal verbose flag (starts false)
  • /status: shows latest stored ACP rate-limit values (account/rateLimits/updated)

When verbose mode is enabled, every ACP/app-server message that is not normally processed by the bridge is sent back to the allowed chat as raw JSON in Markdown.

Development

  • Lint/format: make lint
  • Lint check only: make lint-check
  • Tests: make test

Protocol flow

The bot uses the codex app-server JSON-RPC flow:

  1. initialize
  2. initialized (notification)
  3. thread/start
  4. turn/start for each Telegram message
  5. stream item/agentMessage/delta
  6. wait for turn/completed

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

telecodex-0.0.1.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

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

telecodex-0.0.1-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file telecodex-0.0.1.tar.gz.

File metadata

  • Download URL: telecodex-0.0.1.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for telecodex-0.0.1.tar.gz
Algorithm Hash digest
SHA256 1ec02dc42e370de782b10ed9e3cb0429d20f15630e7b56cd93488b99cfbf9dc3
MD5 8b67ea6e0fa7bf035e15a213226dc7ba
BLAKE2b-256 d6c5cc95848b224ade48420b00686cd441de5e440a0788d7d91f92150002158e

See more details on using hashes here.

File details

Details for the file telecodex-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: telecodex-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for telecodex-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 91f914c9d1cb327b5424c1aa289a2379df575945b7dd9407cffdc67d8d99d1e4
MD5 71e85e9f1e18aa9497d63600950abb1a
BLAKE2b-256 b26aaef1468450a023cc66b8199bcedbe6254992f4598f12a67d29db376d92bd

See more details on using hashes here.

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