A WhatsApp bot powered by LangChain and OpenAI that processes messages, handles multimedia content, and provides AI-assisted responses. The bot can understand YouTube links, process general queries, and maintain conversation context.
-
LangChain Service (
app/services/langchain_service.py):- Handles AI response generation using LangChain
- Processes YouTube links and extracts transcripts
- Manages conversation chains and intent detection
-
OpenAI Service (
app/services/openai_service.py):- Manages OpenAI API interactions
- Handles thread management for conversations
- Processes multimedia content
- Views (
app/views.py):- Manages incoming WhatsApp webhook events
- Handles message verification and security
- Routes messages to appropriate processors
-
WhatsApp Utils (
app/utils/whatsapp_utils.py):- Processes incoming messages
- Handles media downloads
- Formats responses for WhatsApp
-
Progress Tracker (
app/utils/progress_tracker.py):- Monitors application progress
- Logs important events
- Provides debugging information
- Security Decorators (
app/decorators/security.py):- Validates webhook signatures
- Ensures secure communication
- Protects endpoints
-
Message Processing
- Text message handling
- Image processing
- Document handling
- Audio/Video message support
-
AI Capabilities
- Context-aware conversations
- YouTube content analysis
- Natural language understanding
- Multi-purpose response generation
-
System Features
- Progress tracking
- Error handling
- Secure webhook verification
- Environment configuration
- Meta Developer Account
- WhatsApp Business API access
- OpenAI API key
- Required Python packages (see requirements.txt)
The application uses environment variables for configuration:
- ACCESS_TOKEN
- APP_ID
- APP_SECRET
- VERIFY_TOKEN
- OPENAI_API_KEY
- OPENAI_ASSISTANT_ID
- Set up environment variables
- Install dependencies:
pip install -r requirements.txt - Run the application:
python run.py
- Access
/progressendpoint for real-time progress monitoring - Check console logs for detailed debugging information
- Monitor webhook events through Meta's developer dashboard
- Enhanced multimedia processing
- Additional AI model integration
- Advanced conversation management
- Analytics and reporting features