Cross references:
../../README.md../../docs/telegram-bot.mdScope note:
/start, /welcome, /help, /about, /version, /user, /config, /explain, /debug/invent <story>/random/peek, /peek<n>/vendors, /vendor, /text_vendor, /image_vendor, /models, /test/panels, /objective, /objectives + objective shortcuts (/summary, /fun, /learn, /news, /timeline, /facts, /compare, /5yold, /eli5, /study, /meeting, /howto, /debate)/style + style shortcuts (/classic, /noir, /manga, /superhero, /watercolor, /newspaper, /cinematic, /anime, /cyberpunk, /pixel-art, /retro-pop, /minimalist, /storybook, /ink-wash, /line-art, /clay-3d)/new_style, /language, /mode, /consistency, /detail, /crazyness, /concurrency, /retries/prompts, /set_prompt, /list_options, /options/keys, /setkey, /unsetkey, /reset_config, /restartThis runbook covers deployment of the Telegram webhook bot in telegram/src/webhook-bot.js with persistent storage in Cloudflare R2.
npm ci)Set these in GitHub Secrets (recommended) or local env for manual deployment.
RENDER_API_KEYRENDER_OWNER_IDTELEGRAM_BOT_TOKENTELEGRAM_WEBHOOK_SECRETTELEGRAM_NOTIFY_CHAT_IDTELEGRAM_TEST_CHAT_IDCOMICBOT_ALLOWED_CHAT_IDSGEMINI_API_KEYOPENAI_API_KEYOPENROUTER_API_KEYHUGGINGFACE_INFERENCE_API_TOKENCLOUDFLARE_ACCOUNT_IDCLOUDFLARE_WORKERS_AI_TOKEN (Cloudflare Workers AI provider token)CLOUDFLARE_ACCOUNT_API_TOKEN (Cloudflare account token for R2 bucket API/provisioning)CLOUDFLARE_API_TOKEN (compatibility alias; set to the same value as CLOUDFLARE_WORKERS_AI_TOKEN)--cloudflare-api-token deploy argument (deprecated and rejected)R2_S3_ENDPOINTR2_BUCKETR2_ACCESS_KEY_IDR2_SECRET_ACCESS_KEYValidate mapping and required env values before deploy:
npm run secrets:validate:deploy
npm run secrets:validate:deploy:ci
Audit GitHub repo plus environment secrets before dispatching the workflow:
npm run secrets:validate:deploy:github:staging
npm run secrets:validate:deploy:github:production
Predeploy also enforces strict Cloudflare token roles:
CLOUDFLARE_WORKERS_AI_TOKEN = Workers AI provider tokenCLOUDFLARE_ACCOUNT_API_TOKEN = Cloudflare account API tokenCLOUDFLARE_API_TOKEN is set, it must match CLOUDFLARE_WORKERS_AI_TOKENCI workflows also enforce these checks:
.github/workflows/bot-deploy.yml.github/workflows/bot-tests.ymlPrimary path:
npm run bot:deploy:auto -- --target render --env staging --branch stage1 --env-only
Useful variants:
npm run bot:deploy:auto -- --target render --env staging --branch stage1 --env-only --with-render-smoke
npm run bot:deploy:auto -- --target cloudflare --env-only --with-cloudflare-smoke
npm run bot:deploy:auto -- --target both --env staging --branch stage1 --env-only --with-render-smoke --with-cloudflare-smoke
By default, bot:deploy:auto now runs a post-deploy sanity E2E check for Render (telegram/scripts/postdeploy-sanity.js).
Skip it only when needed:
npm run bot:deploy:auto -- --target render --env staging --branch stage1 --env-only --skip-sanity
drop_pending_updates=trueUnrecognized command. noise in the user-facing Telegram chat.GET /healthz returns 200/help and /about in Telegram/crazyness value affects story invention intensityX(Y) prefix formatmade with Web2Comics)Detected link, parsing page: <url>)sendMessage API probe--env production --branch main