Skip to main content

Configuration

Environment Variables

All environment variables for the Event Handler (set in event_handler/.env):

VariableDescriptionRequired
API_KEYAuthentication key for all endpoints (except /telegram/webhook and /github/webhook which use their own secrets)Yes
GH_TOKENGitHub PAT for creating branches/filesYes
GH_OWNERGitHub repository ownerYes
GH_REPOGitHub repository nameYes
PORTServer port (default: 3000)No
TELEGRAM_BOT_TOKENTelegram bot token from BotFatherFor Telegram
TELEGRAM_CHAT_IDRestricts bot to this chat onlyFor security
TELEGRAM_WEBHOOK_SECRETSecret for webhook validationNo
GH_WEBHOOK_SECRETSecret for GitHub Actions webhook authFor notifications
ANTHROPIC_API_KEYClaude API key for chat functionalityFor chat
OPENAI_API_KEYOpenAI key for voice transcriptionFor voice
EVENT_HANDLER_MODELClaude model for chat (default: claude-sonnet-4)No

GitHub Secrets

Set automatically by the setup wizard:

SecretDescriptionRequired
SECRETSBase64-encoded JSON with protected credentialsYes
LLM_SECRETSBase64-encoded JSON with LLM-accessible credentialsNo
GH_WEBHOOK_SECRETRandom secret for webhook authenticationYes

GitHub Repository Variables

Configure in Settings → Secrets and variables → Actions → Variables:

VariableDescriptionRequiredDefault
GH_WEBHOOK_URLEvent handler URL (e.g., your ngrok URL)Yes
AUTO_MERGESet to false to disable auto-merge of job PRsNoEnabled
ALLOWED_PATHSComma-separated path prefixes for auto-mergeNo/logs
IMAGE_URLDocker image path (e.g., ghcr.io/myorg/mybot)Nostephengpope/thepopebot:latest
MODELAnthropic model ID for the Pi agent (e.g., claude-sonnet-4-5-20250929)NoPi default

ngrok URL Changes

ngrok assigns a new URL each time you restart it (unless you have a paid plan with a static domain). When your ngrok URL changes, run:

npm run setup-telegram

This will verify your server is running, update the GitHub webhook URL, re-register the Telegram webhook, and optionally capture your chat ID for security.


Manual Telegram Setup (Production)

If you're deploying to a platform where you can't run the setup script (Vercel, Railway, etc.), configure Telegram manually:

  1. Set environment variables in your platform's dashboard (see event_handler/.env.example for reference):

    • TELEGRAM_BOT_TOKEN - Your bot token from @BotFather
    • TELEGRAM_WEBHOOK_SECRET - Generate with openssl rand -hex 32
    • TELEGRAM_VERIFICATION - A verification code like verify-abc12345
  2. Deploy and register the webhook:

    curl -X POST https://your-app.vercel.app/telegram/register \
    -H "Content-Type: application/json" \
    -H "x-api-key: YOUR_API_KEY" \
    -d '{"bot_token": "YOUR_BOT_TOKEN", "webhook_url": "https://your-app.vercel.app/telegram/webhook"}'

    This registers your webhook with the secret from your env.

  3. Get your chat ID:

    • Message your bot with your TELEGRAM_VERIFICATION code (e.g., verify-abc12345)
    • The bot will reply with your chat ID
  4. Set TELEGRAM_CHAT_ID:

    • Add the chat ID to your environment variables
    • Redeploy

Now your bot only responds to your authorized chat.