--- title: JARVIS Telegram Bot emoji: 🤖 colorFrom: indigo colorTo: purple sdk: docker app_port: 7860 pinned: false --- # J.A.R.V.I.S. — Telegram Bot (Hugging Face primary, no Render) Polls `@AyomideJarvis_bot` and replies via the Muse Spark brain, with Firebase memory/notes/reminders and PC-task queueing. All Telegram traffic goes through `telegram_transport.py` (direct or via the Cloudflare relay). ## Space Secrets (Settings → Variables and secrets) — exact list | Secret | Required | Value | |---|---|---| | `TELEGRAM_BOT_TOKEN` | yes | Bot token from @BotFather (no quotes) | | `OPENCODE_API_KEY` | yes | Muse Spark / OpenCode Zen key | | `OPENCODE_MODEL` | yes | `muse-spark-1.3-contributor-free` | | `FIREBASE_CREDENTIALS_JSON` | yes | Full service-account JSON (one line) | | `JARVIS_TG_UID` | optional | Your Telegram numeric ID (blank = open) | | `TELEGRAM_TRANSPORT` | yes | `auto` (start here), then `proxy` once relay is tested | | `TELEGRAM_PROXY_URL` | for proxy | `https://jarvis-tg-relay..workers.dev` | | `TELEGRAM_PROXY_AUTH` | for proxy | Same secret as Worker `TELEGRAM_RELAY_SECRET` | | `N8N_REMINDER_WEBHOOK` | optional | n8n webhook for reminder fan-out | | `TELEGRAM_MODE` | optional | `polling` (default) or `webhook` | | `SPACE_PUBLIC_URL` | webhook only | `https://.hf.space` | | `TELEGRAM_WEBHOOK_SECRET` | webhook only | Long random string (also given to Telegram) | No secrets in source code — the bot exits with `TELEGRAM_NO_TOKEN` if the token is missing. ## Files in this folder (deployed to the Space root) - `app.py` — entrypoint (`CMD python app.py`) - `telegram_bot.py` — canonical bot (brain, Firebase, queue, webhook/polling) - `telegram_transport.py` — direct/proxy transport + `/diag` matrix - `requirements.txt`, `Dockerfile`, `README.md` ## Endpoints (`:7860`) - `/` — health: model, mode, transport, polls, offset, Telegram reachability - `/diag` — network test matrix JSON (DNS/TCP/HTTPS/getMe direct-vs-proxy, no secrets) - `/webhook/` — Telegram webhook receiver (webhook mode only)