Skip to content

SMS SkillUp

An AI-powered SMS business coaching system that provides entrepreneurship guidance to Kenyan youth (18-35) through feature phones, supporting both English and Kiswahili languages with RAG-backed knowledge retrieval.

Purpose

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

Based on the workflow implementation, this system serves as "Biashara Mentor" - an SMS business coach specifically designed for Kenyan youth entrepreneurs aged 18-35 who use feature phones. The system provides accessible business guidance through text messaging, covering 13 key entrepreneurship topics from business selection to financial management. It maintains conversation context, detects user language preferences, and delivers contextual follow-up questions to keep users engaged in their entrepreneurial journey.

How It Works

  1. Message Reception: The system receives SMS messages through Africa's Talking API or WhatsApp messages via Twilio webhook
  2. Language Detection: AI agent detects whether the incoming message is in English or Kiswahili and responds in the same language
  3. Knowledge Retrieval: For every user question, the system queries a PostgreSQL vector database containing SkillUp business training content
  4. AI Response Generation: OpenAI's GPT-4o-mini generates contextual responses using RAG (Retrieval Augmented Generation) with Cohere reranking for improved relevance
  5. Response Classification: The system determines if the response is a normal message (≤160 characters) or a topic selection menu that needs to be split
  6. Message Delivery: Responses are sent back via SMS (Africa's Talking) or WhatsApp (Twilio), with topic menus split into multiple messages for readability
  7. Session Management: Conversation history is maintained using session memory to provide personalized, contextual guidance

Workflow Diagram

graph TD
    A[SMS/WhatsApp Webhook] --> B[SkillUp SMS Support Agent]
    B --> C[Text Clean up]
    C --> D[Classify Response Type]
    D --> E{Response Type?}
    E -->|Normal| F[Send Single Message]
    E -->|Topic Selection| G[Split into 3 Parts]
    G --> H[Send Part 1]
    H --> I[Send Part 2]
    I --> J[Send Part 3]

    K[OpenAI Chat Model] --> B
    L[Simple Memory] --> B
    M[Vector Store] --> B
    N[Embeddings OpenAI] --> M
    O[Reranker Cohere] --> M

    P[Form Submission] --> Q[Document Loader]
    Q --> R[Text Splitter]
    R --> S[Vector Storage]
    N --> S

Trigger

  • Primary: SMS webhook at /webhook/eda54d73-9621-4f15-b1db-4affd2f92668 (currently disabled)
  • Secondary: WhatsApp webhook (referenced but not directly visible in main flow)
  • Administrative: Two form triggers for uploading training documents to the vector database

Nodes Used

Node Type Purpose
Webhook Receives incoming SMS messages from Africa's Talking
AI Agent Main conversation handler with language detection and contextual questioning
OpenAI Chat Model GPT-4o-mini for generating responses
Vector Store (PGVector) Stores and retrieves SkillUp training content
Embeddings OpenAI Creates vector embeddings for document storage and retrieval
Reranker Cohere Improves relevance of retrieved documents
Memory Buffer Maintains conversation context across sessions
Code (JavaScript) Text cleanup, response classification, and message splitting
HTTP Request Sends SMS responses via Africa's Talking API
Twilio Sends WhatsApp responses
Form Trigger Allows document uploads for knowledge base updates
Document Loader Processes uploaded training documents
Text Splitter Chunks documents for vector storage

External Services & Credentials Required

  • OpenAI API: For chat model and embeddings (credential: "Waringa")
  • Cohere API: For document reranking (credential: "CohereApi account")
  • PostgreSQL: Vector database for knowledge storage (credential: "Postgres Waringa")
  • Africa's Talking: SMS delivery service (API key embedded in workflow)
  • Twilio: WhatsApp message delivery (credential: "Waringa")

Environment Variables

No explicit environment variables are used. API keys and credentials are stored in n8n's credential system.

Data Flow

Input: - SMS messages with user questions about business topics - User's phone number for session identification - Optional document uploads via forms

Processing: - Language detection (English/Kiswahili) - Vector similarity search against SkillUp knowledge base - AI-generated contextual responses with follow-up questions - Response formatting and splitting for SMS constraints

Output: - SMS/WhatsApp responses (≤160 characters for regular messages) - Multi-part topic selection menus - Contextual business guidance with actionable advice

Error Handling

The workflow includes basic error responses for: - Invalid topic selections (prompts for valid numbers 1-13) - Unclear messages (requests clarification with examples) - Unrelated questions (redirects to business topics)

Error responses are language-aware and maintain engagement rather than dismissing users.

Known Limitations

  • SMS responses are limited to 160 characters (except topic menus)
  • No abbreviations, URLs, or complex formatting in responses
  • Relies entirely on RAG content - no general knowledge responses
  • Topic selection menus require manual splitting into multiple messages
  • SMS webhook is currently disabled in the workflow

No related workflows are explicitly mentioned in the current configuration.

Setup Instructions

  1. Import Workflow: Import the JSON into your n8n instance
  2. Configure Credentials:
    • Set up OpenAI API credentials for chat model and embeddings
    • Configure Cohere API for reranking
    • Set up PostgreSQL connection for vector storage
    • Configure Twilio credentials for WhatsApp
    • Set up Africa's Talking API key
  3. Database Setup: Ensure PostgreSQL has the sms_rag_for_skilup_final table with vector extensions
  4. Upload Training Content: Use the form triggers to upload SkillUp business training documents
  5. Enable Webhook: Activate the SMS webhook and configure your SMS provider to send messages to the webhook URL
  6. Test: Send test messages to verify language detection, knowledge retrieval, and response delivery
  7. Monitor: Check that vector queries execute properly and responses stay within character limits