WhatsApp Course Delivery System (Workflow 0022)¶
A complete WhatsApp-based learning management system that enables course enrollment, interactive content delivery, and progress tracking through conversational messaging. Students can join courses via links, receive structured learning content, and interact with AI-powered assessments.
Purpose¶
No business context provided yet — add a context.md to enrich this documentation.
This workflow creates a comprehensive mobile learning platform that delivers educational content through WhatsApp. It serves students who need accessible, mobile-first learning experiences and educators who want to reach learners through familiar messaging platforms. The system handles the complete learning journey from enrollment to completion, with session management and progress tracking.
How It Works¶
- Course Enrollment: Students click a join link containing their phone number and course details
- Session Creation: The system creates a Redis session to track the student's progress and course data
- Welcome Message: Students receive a WhatsApp welcome message with instructions to start learning
- Interactive Learning: Students send commands (START, NEXT, HELP) or responses to learning prompts
- Content Delivery: The system retrieves course content from Redis and delivers it based on the student's current position
- Content Types: Supports text content, audio conversion via ElevenLabs, dialogue scenarios, and knowledge checks
- AI Assessment: OpenAI evaluates student responses and provides personalized feedback
- Progress Tracking: Each completed block updates the student's progress in Redis
- Course Management: Administrators can upload course content in Word, PDF, or JSON formats
Workflow Diagram¶
graph TD
A[Join Course Webhook] --> B[Configuration]
A --> C[Welcome Response]
B --> D[Initialize User Session]
D --> E[Send Welcome WhatsApp]
F[WhatsApp Webhook] --> G[Get User Session]
G --> H[Check User Session]
H --> I[Process User Input]
H --> J[Send No Session Message]
I --> K[Get Course Content]
K --> L[Route Action]
L --> M[Get Current Content]
M --> N[Route Content Type]
N --> O[Send Text Content]
N --> P[Convert to Audio]
N --> Q[Send Student Prompt]
N --> R[Process Dialogue]
N --> S[Send Knowledge Check]
P --> T[Send Audio Content]
R --> U[Convert Dialogue to Audio]
U --> V[Send Dialogue Audio]
O --> W[Update Progress]
T --> W
Q --> W
V --> W
S --> W
W --> X[Save User Session]
Y[Course Upload Webhook] --> Z[Detect File Type]
Z --> AA[Convert Word to Text]
Z --> BB[Convert PDF to Text]
Z --> CC[Handle JSON Input]
AA --> DD[Parse Course Content]
BB --> DD
CC --> DD
DD --> EE[Save Course Content]
EE --> FF[Course Upload Response]
GG[AI Evaluate Response] --> HH[Send AI Feedback]
Triggers¶
This workflow has three webhook triggers:
- Join Course:
/join-course- Handles student enrollment with phone number and course details - WhatsApp Messages:
/whatsapp-webhook- Processes incoming WhatsApp messages from students - Course Upload:
/upload-course- Allows administrators to upload course content files
Nodes Used¶
| Node Type | Purpose |
|---|---|
| Webhook | Receives course join requests, WhatsApp messages, and course uploads |
| Redis | Stores and retrieves user sessions and course content |
| Twilio | Sends WhatsApp messages to students |
| Code (JavaScript) | Processes user input, parses course content, and manages learning flow |
| HTTP Request | Converts text to audio using ElevenLabs API |
| OpenAI | Evaluates student responses and provides AI feedback |
| Switch | Routes content based on type (text, audio, dialogue, etc.) |
| If | Checks if user sessions exist |
| Set | Configures Twilio phone number and ElevenLabs voice settings |
| Respond to Webhook | Returns responses to webhook callers |
External Services & Credentials Required¶
- Redis: Session and content storage
- Credential:
redis(connection details)
- Credential:
- Twilio: WhatsApp messaging
- Credential:
twilioApi(Account SID, Auth Token)
- Credential:
- OpenAI: AI response evaluation
- Credential:
openAiApi(API key)
- Credential:
- ElevenLabs: Text-to-speech conversion
- Credential:
elevenlabsApi(API key)
- Credential:
Environment Variables¶
The workflow uses a Configuration node with these settings:
- twilio_number: "14155238886" (WhatsApp Business number)
- elevenlabs_voice_id: "21m00Tcm4TlvDq8ikWAM" (Voice model for audio conversion)
Data Flow¶
Input (Course Join):
- phone: Student's phone number in E.164 format (+254...)
- course_id: Unique identifier for the course
- course_name: Display name of the course
Input (WhatsApp Messages):
- From: Student's WhatsApp number
- Body: Message content (START, NEXT, HELP, or learning responses)
- MessageType: Type of WhatsApp message
Input (Course Upload): - File data (Word, PDF, or JSON) - Course metadata (name, description, etc.)
Output: - WhatsApp messages with learning content - Audio files for spoken content - Progress tracking data - AI-generated feedback
Error Handling¶
- No User Session: Students without valid sessions receive instructions to join a course
- Missing Course Content: Error messages when course data cannot be found
- File Processing Failures: Graceful handling of document conversion errors
- API Failures: Basic error responses for external service issues
Known Limitations¶
- PDF text extraction is basic and may need enhancement with pdf-parse library
- Switch nodes appear to have incomplete routing configurations
- Audio content delivery may require additional media hosting setup
- Limited error recovery for failed external API calls
Related Workflows¶
No related workflows mentioned in the current context.
Setup Instructions¶
- Import Workflow: Import the JSON into your n8n instance
- Configure Credentials:
- Set up Redis connection with your database details
- Add Twilio API credentials (Account SID, Auth Token)
- Configure OpenAI API key
- Add ElevenLabs API key for voice synthesis
- Update Configuration:
- Modify the Twilio phone number in the Configuration node
- Set the appropriate ElevenLabs voice ID
- Test Webhooks:
- Course join:
GET /webhook-test/join-course?phone=+254712287952&course_id=test&course_name=Demo - WhatsApp: Send Twilio webhook payload to
/webhook-test/whatsapp-webhook - Upload:
POSTcourse data to/webhook-test/upload-course
- Course join:
- Upload Course Content: Use the upload endpoint to add learning materials
- Configure Twilio: Set the WhatsApp webhook URL to point to your n8n instance
- Activate Workflow: Enable the workflow to start processing requests