A Telegram bot that connects to Pinecone for coffee shop inventory and uses GPT to provide enthusiastic (and sometimes overzealous) sales responses to customers.
- 🤖 Telegram Bot integration with BotFather
- 📊 Pinecone vector database for inventory management
- 🧠 OpenAI GPT integration with "sales-focused" prompts
- 🔥 Intentionally enthusiastic and "hallucinatory" responses to drive sales
- ☕ Coffee shop specific inventory and menu system
- Node.js (v16 or higher)
- A Telegram account
- OpenAI API account
- Pinecone account (optional - has fallback mock data)
- Message @BotFather on Telegram
- Send
/newbotcommand - Follow the instructions to create your bot
- Save the bot token you receive
- OpenAI: Get your API key from OpenAI Platform
- Pinecone: Get your API key from Pinecone Console
npm installCreate a .env file with your API keys:
# Telegram Bot Configuration
TELEGRAM_BOT_TOKEN=your_bot_token_here
# OpenAI Configuration
OPENAI_API_KEY=your_openai_api_key_here
# Pinecone Configuration (optional)
PINECONE_API_KEY=your_pinecone_api_key_here
PINECONE_INDEX_NAME=coffee-shop-inventory
PINECONE_ENVIRONMENT=your_pinecone_environment# Development mode with auto-restart
npm run dev
# Production mode
npm start/start- Welcome message and introduction/menu- Display current coffee shop menu/help- Show available commands and usage instructions
- User Message: Customer sends a message to your Telegram bot
- Inventory Lookup: Bot queries Pinecone for relevant inventory items
- AI Response: OpenAI generates an enthusiastic sales response
- Reply: Bot sends the response back to the customer on Telegram
The bot is designed with an intentionally "aggressive" sales prompt that:
- ✨ Makes every item sound amazing and life-changing
- 🎉 Suggests upsells and combinations
- 🔥 Creates excitement about limited-time offers
- 💰 Pushes higher-priced items
- 🎭 Uses dramatic language about quality and benefits
- 🚀 Never says "no" - always finds alternatives to sell
coffee-shop-bot/
├── bot.js # Main bot logic
├── config.js # Configuration management
├── services/
│ ├── pinecone.js # Pinecone vector database service
│ └── openai.js # OpenAI GPT integration
├── package.json # Dependencies and scripts
├── .env # Environment variables (create this)
├── .gitignore # Git ignore rules
└── README.md # This file
Edit services/openai.js to change the sales strategy and prompting style.
The bot includes mock inventory data. To use real Pinecone data:
- Set up your Pinecone index
- Add your inventory data to Pinecone
- Configure the vector embeddings
Add new bot commands in the setupEventHandlers() method in bot.js.
For production deployment:
- Use a VPS or cloud service (AWS, DigitalOcean, etc.)
- Set up environment variables
- Use PM2 or similar for process management:
npm install -g pm2
pm2 start bot.js --name coffee-bot
pm2 startup
pm2 save- Bot not responding: Check your Telegram bot token
- No AI responses: Verify your OpenAI API key and credits
- Inventory errors: Pinecone service will fall back to mock data
- Polling errors: Ensure your bot token is correct and bot is not running elsewhere
- Never commit your
.envfile to version control - Use environment variables in production
- Regularly rotate your API keys
- Monitor API usage and costs
MIT License - feel free to modify and use for your projects!