WhatsApp Learning Platform (Workflow 0022)¶
An intelligent WhatsApp-based learning platform that delivers structured educational content through conversational interactions. Students can join courses, receive multimedia content (text, audio, dialogues), complete knowledge checks, and receive AI-powered feedback on their responses.
Purpose¶
No business context provided yet — add a context.md to enrich this documentation.
This workflow creates a complete learning management system accessible through WhatsApp, enabling: - Course enrollment via webhook links - Progressive content delivery with multimedia support - Interactive knowledge assessments - AI-powered response evaluation and feedback - Session management and progress tracking
How It Works¶
- Course Enrollment: Students join courses by accessing a webhook URL with course parameters
- Session Initialization: User sessions are created in Redis with course details and progress tracking
- Welcome Message: New students receive a WhatsApp welcome message with instructions
- Content Delivery: Students interact via WhatsApp to receive course content progressively
- Multimedia Processing: Text content can be converted to audio using ElevenLabs TTS
- Knowledge Checks: Interactive questions test student understanding
- AI Feedback: OpenAI evaluates student responses and provides personalized feedback
- Progress Tracking: User progress is continuously updated and saved
- Course Management: Administrators can upload course content in multiple formats (Word, PDF, JSON)
Workflow Diagram¶
graph TD
A[Join Course Webhook] --> B[Welcome Response]
A --> C[Initialize User Session]
C --> D[Send Welcome WhatsApp]
E[WhatsApp Webhook] --> F[Get User Session]
F --> G[Check User Session]
G -->|Valid Session| H[Process User Input]
G -->|No Session| I[Send No Session Message]
H --> J[Get Course Content]
J --> K[Route Action]
K --> L[Get Current Content]
L --> M[Route Content Type]
M -->|Text| N[Send Text Content]
M -->|Audio| O[Convert to Audio 11Labs]
O --> P[Send Audio Content]
M -->|Dialogue| Q[Process Dialogue]
Q --> R[Convert Dialogue to Audio]
R --> S[Send Dialogue Audio]
M -->|Knowledge Check| T[Send Knowledge Check]
M -->|Student Response| U[Send Student Prompt]
N --> V[Update Progress]
P --> V
S --> V
T --> V
U --> V
V --> W[Save User Session]
X[Course Upload Webhook] --> Y[Detect File Type]
Y -->|Word| Z[Convert Word to Text]
Y -->|PDF| AA[Convert PDF to Text]
Y -->|JSON| BB[Handle JSON Input]
Z --> CC[Parse Course Content]
AA --> CC
BB --> CC
CC --> DD[Save Course Content]
DD --> EE[Course Upload Response]
FF[AI Evaluate Response] --> GG[Send AI Feedback]
Triggers¶
- Join Course Webhook (
/join-course): Enrolls students in courses - WhatsApp Webhook (
/whatsapp-webhook): Handles incoming WhatsApp messages - Course Upload Webhook (
/upload-course): Accepts course content uploads
Nodes Used¶
| Node Type | Purpose |
|---|---|
| Webhook | Receives course enrollment and WhatsApp message requests |
| Respond to Webhook | Sends HTTP responses to webhook calls |
| Redis | Stores and retrieves user sessions and course content |
| Twilio | Sends WhatsApp messages to students |
| OpenAI | Evaluates student responses and generates feedback |
| HTTP Request | Calls ElevenLabs API for text-to-speech conversion |
| Code | Processes user input, parses content, and manages workflow logic |
| If | Checks user session validity |
| Switch | Routes content based on type and user actions |
| Set | Stores configuration values |
External Services & Credentials Required¶
- Twilio: WhatsApp Business API integration
- Account SID and Auth Token
- WhatsApp-enabled phone number
- Redis: Session and content storage
- Connection string or host/port/password
- OpenAI: AI response evaluation
- API key with GPT model access
- ElevenLabs: Text-to-speech conversion
- API key and voice ID
Environment Variables¶
Configure these in the Configuration node:
- twilio_number: Your Twilio WhatsApp number
- elevenlabs_voice_id: ElevenLabs voice ID for audio generation
Data Flow¶
Input¶
- Course Enrollment:
phone,course_id,course_namevia query parameters - WhatsApp Messages: Twilio webhook payload with user messages
- Course Content: Word documents, PDFs, or JSON course structures
Output¶
- WhatsApp Messages: Text, audio, and interactive content delivery
- Session Data: User progress and course state in Redis
- Course Storage: Parsed and structured course content in Redis
Data Structure¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | |
Error Handling¶
- Invalid Sessions: Users without valid sessions receive guidance messages
- Missing Content: Graceful handling when course content is unavailable
- File Processing Errors: Error responses for failed document conversions
- API Failures: Basic error handling for external service calls
Known Limitations¶
- PDF text extraction uses basic buffer conversion (consider pdf-parse library for production)
- Limited dialogue speaker detection in content parsing
- No user authentication beyond phone number validation
- Basic error handling for external API failures
Related Workflows¶
No related workflows specified in the current context.
Setup Instructions¶
-
Import Workflow: Import the JSON into your n8n instance
-
Configure Credentials:
- Add Twilio credentials (Account SID, Auth Token)
- Add Redis connection details
- Add OpenAI API key
- Add ElevenLabs API credentials
-
Update Configuration Node:
- Set your Twilio WhatsApp number
- Configure ElevenLabs voice ID
-
Set Up Webhooks:
- Configure Twilio webhook URL to point to
/whatsapp-webhook - Note the course enrollment URL:
/join-course - Note the course upload URL:
/upload-course
- Configure Twilio webhook URL to point to
-
Test the Flow:
- Upload a course using the upload webhook
- Create a course enrollment link with required parameters
- Test WhatsApp interactions with a valid phone number
-
Production Considerations:
- Implement proper error logging
- Add user authentication if required
- Consider upgrading PDF parsing for better text extraction
- Set up monitoring for external API calls