Configuration
Complete guide to environment variables and configuration.
Quick Setup
Copy the example file and edit with your values:
bash
cp .env.example .env
# Edit .env with your API keys and bot tokensRequired Variables
These variables must be set for the application to run:
bash
# MongoDB Connection
MONGO_URI=mongodb://localhost:27017
# Application Mode
IS_PROD=false
# At least one bot token
CHATBOT_TELEGRAM_BOT_TOKEN=<your-token>Optional Variables
OpenAI Integration (Chatbot)
bash
OPENAI_API_KEY=sk-...Anthropic Integration (Chatbot)
bash
ANTHROPIC_API_KEY=sk-ant-...Google Sheets Logging (Production only)
bash
SHEETS_CLIENT_EMAIL=your-service-account@project.iam.gserviceaccount.com
SHEETS_PRIVATE_KEY=-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n
SHEETS_LOGS_SPREADSHEET_ID=your-spreadsheet-idDevelopment Configuration
bash
# Run a specific bot in development
LOCAL_ACTIVE_BOT_ID=chatbot
# Bot tokens for other bots
COACH_TELEGRAM_BOT_TOKEN=...
LANGLY_TELEGRAM_BOT_TOKEN=...
MAGISTER_TELEGRAM_BOT_TOKEN=...
WOLT_TELEGRAM_BOT_TOKEN=...
WORLDLY_TELEGRAM_BOT_TOKEN=...Environment Variables by Bot
Chatbot
bash
CHATBOT_TELEGRAM_BOT_TOKEN=required
OPENAI_API_KEY=required for AI features
ANTHROPIC_API_KEY=optional, alternative to OpenAI
GITHUB_TOKEN=optional, for GitHub integration
WEATHERAPI_KEY=optional, for weather featuresCoach
bash
COACH_TELEGRAM_BOT_TOKEN=required
SCORES_365_API_KEY=required for sports dataLangly
bash
LANGLY_TELEGRAM_BOT_TOKEN=requiredMagister
bash
MAGISTER_TELEGRAM_BOT_TOKEN=requiredWolt
bash
WOLT_TELEGRAM_BOT_TOKEN=requiredWorldly
bash
WORLDLY_TELEGRAM_BOT_TOKEN=requiredGetting Telegram Bot Tokens
- Open Telegram and search for @BotFather
- Send
/newbotcommand - Follow the prompts to create a new bot
- Copy the bot token and add it to your
.envfile
MongoDB Setup
Local MongoDB
Install MongoDB Community Edition from mongodb.com
bash
# On macOS with Homebrew
brew install mongodb-community
brew services start mongodb-community
# Connection string
MONGO_URI=mongodb://localhost:27017MongoDB Atlas (Cloud)
- Create a free account at mongodb.com/cloud/atlas
- Create a cluster
- Get your connection string
- Add it to
.env
bash
MONGO_URI=mongodb+srv://username:password@cluster.mongodb.net/API Keys Setup
OpenAI
- Visit platform.openai.com
- Create an API key
- Add to
.env:OPENAI_API_KEY=sk-...
Anthropic
- Visit console.anthropic.com
- Create an API key
- Add to
.env:ANTHROPIC_API_KEY=sk-ant-...
.env Example File
See .env.example in the repository for a complete template with all available variables and their purposes.
Verification
After setting up your environment variables, verify the configuration:
bash
npm run build # TypeScript should compile
npm run lint # No linting errors
npm test # Tests should passThen start the application:
bash
npm run start:devCheck the console logs to ensure the bot(s) started successfully.