Skip to content

E!BA and SkillUp Bots

A comprehensive WhatsApp-based support system that provides AI-powered assistance to program staff running E!BA Academy and SkillUp bootcamps. The workflow handles both text and voice messages, uses RAG (Retrieval-Augmented Generation) to query procedure handbooks, and delivers contextual guidance to trainers, program officers, and field staff.

Purpose

No business context provided yet — add a context.md to enrich this documentation.

This workflow serves as an intelligent support assistant for two educational programs: - E!BA Academy: A 4-week non-residential bootcamp for out-of-school youth (18-30) in Uganda - SkillUp Bootcamp: A 4-week in-person + 2-week virtual entrepreneurship program in Kenya

The system helps program staff (trainers, field operations assistants, program officers) get instant answers about procedures, safeguarding protocols, retention strategies, and daily operations by querying comprehensive procedure handbooks.

How It Works

  1. Message Reception: Users send WhatsApp messages (text or voice) to dedicated phone numbers
  2. Input Processing: The system detects message type and processes voice messages through OpenAI transcription
  3. Route Determination: Messages are routed to either E!BA or SkillUp support agents based on the receiving number
  4. Knowledge Retrieval: AI agents query PostgreSQL vector stores containing procedure handbooks using RAG
  5. Response Generation: GPT models generate contextual responses with conversation memory
  6. Format Optimization: Responses are cleaned of markdown and formatted for WhatsApp
  7. Delivery: Responses are sent back via Twilio WhatsApp API
  8. Logging: All interactions are logged to Airtable for monitoring and improvement

The system also includes a feedback collection mechanism and file upload capabilities for updating the knowledge base.

Workflow Diagram

graph TD
    A[WhatsApp Message] --> B{Message Type?}
    B -->|Voice| C[Download Audio]
    B -->|Text| D[Process Text]
    C --> E[OpenAI Transcription]
    E --> F[Unified Input Processing]
    D --> F
    F --> G{Which Bot?}
    G -->|E!BA| H[E!BA Support Agent]
    G -->|SkillUp| I[SkillUp Support Agent]
    H --> J[Query E!BA Vector Store]
    I --> K[Query SkillUp Vector Store]
    J --> L[Generate Response]
    K --> L
    L --> M[Clean Formatting]
    M --> N[Send WhatsApp Response]
    N --> O[Log to Airtable]

    P[File Upload Form] --> Q[Process Documents]
    Q --> R[Store in Vector Database]

    S[Feedback Form] --> T[Store in Airtable]

Trigger

The workflow has multiple triggers: - WhatsApp Webhook: Receives incoming WhatsApp messages via Twilio - Form Triggers: Handle file uploads for knowledge base updates and feedback collection - Chat Trigger: Alternative interface for testing (currently disabled)

Nodes Used

Node Type Purpose
Webhook Receive WhatsApp messages from Twilio
Form Trigger Handle file uploads and feedback forms
Switch Route messages based on type (voice/text)
HTTP Request Download audio files from Twilio
OpenAI Transcription Convert voice messages to text
Code (JavaScript) Process and unify inputs, clean formatting
AI Agent Generate responses using RAG and conversation memory
Vector Store (PostgreSQL) Store and retrieve document embeddings
OpenAI Chat Model Language model for response generation
Memory Buffer Maintain conversation context
Document Loader Process uploaded files
Text Splitter Chunk documents for embedding
Embeddings OpenAI Generate text embeddings
Cohere Reranker Improve retrieval relevance
Twilio Send WhatsApp responses
Airtable Log conversations and feedback

External Services & Credentials Required

  • OpenAI API: For transcription, embeddings, and chat completion
  • Twilio: For WhatsApp messaging
  • PostgreSQL: Vector database for document storage
  • Cohere API: For result reranking
  • Airtable: For logging and feedback storage
  • Google Cloud Storage: For audio file storage (E!BA voice responses)

Environment Variables

No specific environment variables are documented in the workflow. Credentials are managed through n8n's credential system for: - OpenAI API keys - Twilio account credentials - PostgreSQL connection details - Cohere API key - Airtable API token - Google Cloud Storage credentials

Data Flow

Input: - WhatsApp text messages - WhatsApp voice messages (converted to text) - File uploads (PDF, CSV) for knowledge base updates - Feedback form submissions

Processing: - Voice-to-text transcription - Document embedding and storage - RAG-based knowledge retrieval - Conversational AI response generation - Response formatting and cleanup

Output: - WhatsApp text responses - WhatsApp voice responses (E!BA only) - Airtable logs of all interactions - Updated vector databases with new documents

Error Handling

The workflow includes basic error handling through: - Input validation in JavaScript nodes - Fallback text processing when voice transcription fails - Switch nodes to handle different message types - Try-catch logic in code nodes for data processing

Known Limitations

Based on the workflow configuration: - Voice responses are only generated for E!BA, not SkillUp - Maximum response length constraints for WhatsApp (300-800 characters) - Dependency on external services for core functionality - Limited to PDF and CSV file uploads for knowledge base updates

No related workflows are explicitly mentioned in the current configuration.

Setup Instructions

  1. Import Workflow: Import the JSON configuration into your n8n instance

  2. Configure Credentials:

    • Set up OpenAI API credentials for transcription, embeddings, and chat
    • Configure Twilio credentials for WhatsApp messaging
    • Set up PostgreSQL database connection
    • Add Cohere API credentials for reranking
    • Configure Airtable API token
    • Set up Google Cloud Storage credentials (for E!BA voice responses)
  3. Database Setup:

    • Create PostgreSQL tables: skillup, skillup_original, eba_mini_updated_large_dec_latest, eba_mini_updated_large_new_latest
    • Install pgvector extension for vector similarity search
  4. Webhook Configuration:

    • Configure Twilio webhooks to point to your n8n webhook URLs
    • Set up separate webhooks for E!BA and SkillUp bots
  5. Knowledge Base Population:

    • Use the file upload forms to populate vector stores with procedure handbooks
    • Ensure documents are properly chunked and embedded
  6. Testing:

    • Test with sample WhatsApp messages
    • Verify voice message transcription
    • Check knowledge retrieval accuracy
    • Validate response formatting
  7. Monitoring:

    • Set up Airtable views for conversation monitoring
    • Configure feedback form for continuous improvement
    • Monitor API usage and costs