| title | Food Ordering Bot |
|---|---|
| emoji | 🍕 |
| colorFrom | blue |
| colorTo | green |
| sdk | docker |
| app_port | 7860 |
| pinned | false |
Intelligent chatbot for food ordering in Cameroon via Telegram, with Natural Language Processing (French/English) and Spreeloop API integration.
- 🧠 Advanced NLP: Order extraction with Google Gemini 2.0 Flash + Groq fallback
- 🌍 Multilingual: French + English (automatic detection)
- 📦 Complete Management: Dynamic menu, confirmation, API order creation
- 💰 Payment: Cash on delivery
- 🚀 Production-ready: Structured logs, caching, error handling
User (Telegram)
↓
FastAPI Webhook
↓
LLM (Gemini/Groq) → Extract order JSON
↓
Match items to Menu (API)
↓
Confirmation buttons
↓
Spreeloop API → Create order
Required secrets (configure in Space Settings → Repository secrets):
TELEGRAM_BOT_TOKEN=your_telegram_token
GEMINI_API_KEY=your_gemini_key
GROQ_API_KEY=your_groq_key
SPREELOOP_API_URL=https://your-api-url
SPREELOOP_API_TOKEN=your_bearer_token
SPREELOOP_DEFAULT_PLACE_ID=place_123
FIREBASE_CREDENTIALS_JSON={}
ENVIRONMENT=production
LOG_LEVEL=INFOAfter Space is running, configure Telegram webhook:
curl -X POST "https://api.telegram.org/bot<YOUR_TOKEN>/setWebhook?url=https://huggingface.co/spaces/YOUR_USERNAME/food-ordering-bot/webhook"Or use the direct Space URL:
curl -X POST "https://api.telegram.org/bot<YOUR_TOKEN>/setWebhook?url=https://YOUR_USERNAME-food-ordering-bot.hf.space/webhook"- Order: Just type what you want
- Example FR:
"2 pizzas margherita et 1 coca" - Example EN:
"I want 2 grilled chicken"
- Example FR:
- Menu:
/menu- View available products
- User: "je veux 2 pizza margherita"
- Bot: Extracts items + asks for missing info
- User: "Jean Dupont, 675123456, Yaoundé"
- Bot: Shows summary + Confirm/Cancel buttons
- User: Clicks "Confirm"
- Bot: Creates order via API → Shows order number
Visit /health endpoint to check bot status:
https://YOUR_USERNAME-food-ordering-bot.hf.space/health
Expected response:
{
"status": "healthy",
"bot": "running",
"api": "connected"
}View logs in Space → Logs tab:
| Event | Description |
|---|---|
bot_started |
Bot successfully started |
webhook_processed |
User message received |
gemini_extraction_success |
NLP extraction successful |
order_created |
Order created via API |
*_error |
Error to investigate |
- Backend: FastAPI (Python 3.11)
- LLM: Google Gemini 2.0 Flash + Groq Llama 3.2
- Bot: python-telegram-bot 20.7
- API: Spreeloop (Google API Gateway)
- Hosting: Hugging Face Spaces (Docker)
# Install dependencies
pip install -r requirements.txt
# Configure environment
cp .env.example .env
# Edit .env with your credentials
# Run locally
python -m app.main- Check webhook configuration:
curl "https://api.telegram.org/bot<TOKEN>/getWebhookInfo"-
Verify Space is running (green status)
-
Check logs for errors in Space → Logs
- Verify all secrets are configured
- Check logs for missing environment variables
- Ensure Telegram token is valid
- Normal occasionally - Groq fallback activates automatically
- Check subsequent logs for
groq_extraction_success
MIT
Need help? Check the documentation or open an issue.