WhatsApp Learning Management System (0022)¶
A comprehensive n8n workflow that delivers interactive learning experiences through WhatsApp, supporting course uploads, student enrollment, and AI-powered learning assistance with multi-format content delivery including text, audio, and dialogue.
Purpose¶
No business context provided yet — add a context.md to enrich this documentation.
This workflow creates a complete learning management system accessible via WhatsApp, enabling: - Course administrators to upload and structure learning content from Word/PDF documents - Students to join courses via webhook links and receive personalized learning experiences - Interactive learning sessions with text, audio, dialogue, and knowledge checks - AI-powered response evaluation and feedback - Progress tracking and session management
How It Works¶
The workflow operates through three main pathways:
Course Upload Flow: 1. Administrators upload course content via webhook (Word, PDF, or JSON) 2. Content is parsed and converted to structured learning units with blocks 3. Course data is stored in Redis for retrieval during learning sessions
Student Enrollment: 1. Students access a join-course webhook link with course parameters 2. User session is initialized in Redis with course details 3. Welcome message is sent via WhatsApp with instructions to start
Learning Delivery: 1. Students interact via WhatsApp messages (START, NEXT, responses) 2. System retrieves user session and course content from Redis 3. Content is delivered based on type (text, audio via ElevenLabs, dialogue, knowledge checks) 4. AI evaluates student responses and provides feedback 5. Progress is tracked and sessions are updated in Redis
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 -->|Has 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 -->|Knowledge Check| Q[Send Knowledge Check]
M -->|Dialogue| R[Process Dialogue]
R --> S[Convert Dialogue to Audio]
S --> T[Send Dialogue Audio]
M -->|Student Response| U[Send Student Prompt]
N --> V[Update Progress]
P --> V
Q --> 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): Receives incoming WhatsApp messages - Course Upload Webhook (
/upload-course): Accepts course content uploads
Nodes Used¶
| Node Type | Purpose |
|---|---|
| Webhook | Receives HTTP requests for course joining, WhatsApp messages, and content uploads |
| Respond to Webhook | Sends HTTP responses back to webhook callers |
| Redis | Stores and retrieves user sessions and course content |
| Twilio | Sends WhatsApp messages to students |
| Code (JavaScript) | Processes user input, parses content, manages learning flow |
| HTTP Request | Calls ElevenLabs API for text-to-speech conversion |
| OpenAI | Evaluates student responses and provides AI feedback |
| Switch | Routes workflow based on content types and user actions |
| If | Conditional logic for user session validation |
| Set | Configuration node for environment variables |
External Services & Credentials Required¶
- Twilio: WhatsApp Business API integration
- Account SID and Auth Token
- WhatsApp-enabled phone number
- ElevenLabs: Text-to-speech conversion
- API key and voice ID
- OpenAI: AI response evaluation
- API key for GPT models
- Redis: Session and content storage
- Connection string or host/port/password
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 join requests with phone number, course ID, and course name - WhatsApp messages from students - Course content files (Word/PDF) or structured JSON
Processing:
- User sessions stored as JSON in Redis with keys like user_+1234567890
- Course content stored as structured JSON in Redis with keys like course_12345
- Content parsed into units and blocks with types (TEXT, AUDIO, DIALOGUE, KNOWLEDGE_CHECK, STUDENT_RESPONSE)
Output: - WhatsApp messages (text, audio, prompts) - HTTP responses confirming actions - Updated user progress and session data
Error Handling¶
- User session validation prevents unauthorized access
- Content type detection handles multiple file formats
- Fallback messages for missing course content
- Basic error responses for failed file processing
Known Limitations¶
- PDF text extraction is basic and may need enhancement with pdf-parse library
- Audio generation depends on ElevenLabs API availability
- No user authentication beyond phone number verification
- Limited error recovery for failed API calls
Related Workflows¶
No related workflows specified in the current context.
Setup Instructions¶
- Import the workflow into your n8n instance
- Configure credentials:
- Add Twilio credentials (Account SID, Auth Token)
- Add ElevenLabs API credentials
- Add OpenAI API credentials
- Configure Redis connection
- Update Configuration node:
- Set your Twilio WhatsApp number
- Set ElevenLabs voice ID
- Activate webhook endpoints:
- Note the webhook URLs for course joining and WhatsApp integration
- Configure Twilio webhook URL to point to
/whatsapp-webhook
- Test the flow:
- Upload a sample course via
/upload-course - Create a join link:
your-n8n-url/webhook/join-course?phone=+1234567890&course_id=test&course_name=Test Course - Send WhatsApp messages to test the learning flow
- Upload a sample course via
- Activate the workflow to start processing requests
The workflow will be ready to handle course uploads, student enrollment, and interactive learning sessions through WhatsApp.