AI-powered WhatsApp chatbot built using Groq Llama-3.1-8B + LangChain β acts as a personal executive assistant with memory, scheduling & email automation.
This AI-powered WhatsApp Assistant functions like a personal executive assistant.
It can:
- Schedule meetings
- Send emails
- Remember past conversations
- Run LangChain tools
- Use Groq's ultra-fast Llama-3.1-8B model
- Store long-term memory in SQLite
Perfect for business automation, personal workflow automation, and AI-driven productivity.
- π± WhatsApp Integration using Twilio
- π§ Persistent Memory (SQLite)
- π Meeting Scheduler Tool
- π§ Email Sending Tool
- β‘ Groq Llama-3.1-8B Instant Model
- π LangChain Agent with Custom Tools
- π Environment-based secure configuration
- π ngrok tunneling for webhook testing
WhatsApp_AI_Executive_Assistan/
βββ .venv/ Virtual environment
βββ main.py Flask server (webhook handler)
βββ agent.py LangChain agent logic (Groq LLM)
βββ tools.py Custom tools (email, scheduling)
βββ requirements.txt Python dependencies
βββ .env API keys (DO NOT COMMIT)
βββ chat_history.db SQLite memory database
βββ README.md Documentation
python -m venv .venv
.venv\Scripts\activatepython -m venv .venv
source .venv/bin/activatepip install -r requirements.txtCreate a .env file:
TWILIO_ACCOUNT_SID=your_twilio_sid_here
TWILIO_AUTH_TOKEN=your_twilio_token_here
GROQ_API_KEY=your_groq_api_key_here
MODEL_NAME=llama-3.1-8b-instant
- Visit https://console.groq.com
- Click API Keys
- Create a new key
- Paste it into
.env
python main.pyServer runs at:
http://localhost:5000
Webhook endpoint:
/bot
ngrok http 5000Copy the HTTPS URL and set it in Twilio webhook:
https://your-ngrok-url.ngrok.io/bot
- Visit https://www.twilio.com
- Go to Messaging β Try it out β WhatsApp
- Join the sandbox
- Set webhook:
https://your-ngrok-url.ngrok.io/bot
Each WhatsApp user has a session ID:
whatsapp:+92300xxxxxxx
Memory is stored in the database:
chat_history.db
Even after restarting the server, the bot remembers previous conversations.
- Send:
My secret code is Blue-Owl - Stop the server
- Start the server again
- Send:
What is my secret code?
Expected: Blue-Owl
- βSchedule a meeting with Ali on Monday at 2 PMβ
- βSend an email to hr@company.com saying I will be late.β
- Python 3.11+
- Groq API key
- Twilio WhatsApp Sandbox
- ngrok
.env
.venv/
__pycache__/
*.pyc
chat_history.db
*.db
.DS_Store
β Ensure .env only contains valid key-value pairs.
β ngrok must be running
β Twilio webhook URL must match
β WhatsApp sandbox must be joined
β MODEL_NAME must be llama-3.1-8b-instant
β Groq API key must be valid
MIT License
