SMS SkillUp - AI Business Mentor for Kenyan Youth¶
An intelligent SMS and WhatsApp business coaching system that provides personalized entrepreneurship guidance to Kenyan youth (18-35) using feature phones. The system acts as "Biashara Mentor," delivering contextual business advice in both English and Kiswahili through AI-powered conversations backed by a comprehensive knowledge base.
Purpose¶
No business context provided yet — add a context.md to enrich this documentation.
Based on the workflow implementation, this system serves Kenyan youth entrepreneurs who need accessible business mentorship through basic mobile technology. It addresses the digital divide by providing sophisticated AI coaching through simple SMS and WhatsApp interfaces, supporting both English and Kiswahili languages to ensure broad accessibility across different education levels and regional preferences.
How It Works¶
- Message Reception: The system receives incoming messages via WhatsApp webhook or SMS webhook from users seeking business advice
- Language Detection: AI agent automatically detects whether the user is communicating in English or Kiswahili and maintains language consistency throughout the conversation
- Memory Management: User sessions are tracked using phone numbers, maintaining conversation context and business details across multiple interactions
- AI Processing: The SkillUp SMS Support Agent processes user queries using GPT-4o-mini, querying a vectorized knowledge base of business resources
- Knowledge Retrieval: The system searches through business training materials stored in a PostgreSQL vector database, using OpenAI embeddings and Cohere reranking for relevant content
- Response Classification: Responses are classified as either normal replies (≤160 characters) or topic selection menus that need to be split
- Message Formatting: Text is cleaned of markdown formatting to ensure compatibility with basic mobile devices
- Delivery: Responses are sent back via the appropriate channel (WhatsApp or SMS) with proper formatting for the target platform
The system provides 13 core business topics including entrepreneurship, market research, funding, sales, and business management, delivering contextual follow-up questions that guide users through their entrepreneurial journey.
Workflow Diagram¶
graph TD
A[WhatsApp Webhook] --> B[SkillUp SMS Support Agent]
C[SMS Webhook] --> D[SkillUp SMS Support Agent1]
E[OpenAI Chat Model2] --> B
F[Simple Memory] --> B
G[SkillUp SMS Support Resources Vectorized] --> B
H[Embeddings OpenAI2] --> G
I[Reranker Cohere] --> G
J[OpenAI Chat Model] --> D
K[Simple Memory1] --> D
L[SkillUp SMS Support Resources Vectorized1] --> D
M[Embeddings OpenAI] --> L
N[Reranker Cohere1] --> L
B --> O[Text Clean up1]
D --> P[Text Clean up]
O --> Q[Classify Response Type]
P --> R[Classify Response Type1]
Q --> S[If]
R --> T[If1]
S -->|Normal| U[Send WhatsApp response SkillUp SMS]
S -->|Topic List| V[Code in JavaScript2]
T -->|Normal| W[Send SMS]
T -->|Topic List| X[Code in JavaScript]
V --> Y[Send WhatsApp response SkillUp SMS 2]
Y --> Z[Send WhatsApp response SkillUp SMS 3]
Z --> AA[Send WhatsApp response SkillUp SMS 4]
X --> BB[Send SMS1]
BB --> CC[Send SMS2]
CC --> DD[Send SMS3]
EE[On form submission] --> FF[SkillUp SMS Support Storage]
GG[On form submission1] --> HH[SkillUp SMS Support Storage1]
II[Default Data Loader3] --> FF
JJ[Default Data Loader] --> HH
KK[Recursive Character Text Splitter1] --> II
LL[Recursive Character Text Splitter] --> JJ
Trigger¶
The workflow has multiple triggers:
- WhatsApp Webhook: Receives incoming WhatsApp messages (webhook ID not specified in active workflow)
- SMS Webhook: Receives incoming SMS messages via webhook eda54d73-9621-4f15-b1db-4affd2f92668
- Form Submissions: Two form triggers for uploading business training documents to the knowledge base
Nodes Used¶
| Node Type | Purpose |
|---|---|
| AI Agent | Core business mentor that processes user queries and generates contextual responses |
| OpenAI Chat Model | GPT-4o-mini language model for natural conversation generation |
| Vector Store (PGVector) | Stores and retrieves business training content using semantic search |
| OpenAI Embeddings | Converts text to vector embeddings for semantic search |
| Cohere Reranker | Improves search result relevance by reordering retrieved documents |
| Memory Buffer | Maintains conversation context using phone numbers as session keys |
| Code (JavaScript) | Text cleanup, response classification, and message splitting logic |
| HTTP Request | Sends SMS messages via Africa's Talking API |
| Twilio | Sends WhatsApp messages via Twilio API |
| If Condition | Routes responses based on type (normal vs topic selection) |
| Form Trigger | Allows uploading of training documents |
| Document Loader | Processes uploaded documents for knowledge base |
| Text Splitter | Chunks documents for optimal vector storage |
External Services & Credentials Required¶
| Service | Credential Name | Purpose |
|---|---|---|
| OpenAI | OpenAi account |
GPT-4o-mini model and text embeddings |
| Cohere | CohereApi account |
Document reranking for improved search |
| PostgreSQL | Postgres Waringa |
Vector database for knowledge storage |
| Twilio | Waringa |
WhatsApp message delivery |
| Africa's Talking | API key in headers | SMS message delivery |
Environment Variables¶
The workflow uses hardcoded values that should be moved to environment variables:
- Africa's Talking API key: atsk_ae3de07489f045ef1532a7e407df689bcadff2dbc2555361f3055c6774d779c77c5d9954
- SMS sender ID: 24436
- Username: toll_free_sms_ke
Data Flow¶
Input: - WhatsApp messages with user business questions - SMS messages with user business questions - Document uploads for knowledge base training
Processing: - Language detection (English/Kiswahili) - Session management via phone number - Vector search through business training materials - AI-generated contextual responses with follow-up questions
Output: - SMS responses (≤160 characters for normal, split into 3 parts for topic lists) - WhatsApp responses (≤160 characters for normal, split into 3 parts for topic lists) - Responses include actionable business advice and contextual follow-up questions
Error Handling¶
The workflow includes basic error handling through: - Language-specific error responses for invalid inputs - Response classification to handle different message types appropriately - Text cleanup to ensure mobile device compatibility - Conditional routing based on response type to prevent formatting issues
Error responses are contextual and maintain engagement: - Invalid topic numbers prompt users to select valid options - Unclear messages request clarification with examples - Off-topic questions redirect to business-related topics
Known Limitations¶
- SMS responses are strictly limited to 160 characters, which may truncate complex advice
- The system requires active internet connection for AI processing
- Vector database performance depends on the quality and comprehensiveness of uploaded training materials
- Language switching is only supported through explicit user requests
- No built-in analytics or conversation tracking beyond basic session memory
Related Workflows¶
No related workflows specified in the current context.
Setup Instructions¶
-
Import Workflow: Import the JSON workflow into your n8n instance
-
Configure Credentials:
- Set up OpenAI API credentials for GPT-4o-mini and embeddings
- Configure Cohere API credentials for reranking
- Set up PostgreSQL database with vector extension
- Configure Twilio credentials for WhatsApp
- Set up Africa's Talking API credentials
-
Database Setup:
- Create PostgreSQL table
sms_rag_for_skilup_finalwith vector support - Ensure proper indexing for vector similarity search
- Create PostgreSQL table
-
Upload Training Content:
- Use the form triggers to upload business training documents
- Documents will be automatically processed and stored in the vector database
-
Configure Webhooks:
- Set up WhatsApp webhook endpoint in Twilio
- Configure SMS webhook with Africa's Talking
- Update webhook URLs in the respective trigger nodes
-
Environment Variables:
- Move hardcoded API keys to secure environment variables
- Update SMS sender configuration as needed
-
Test the System:
- Send test messages in both English and Kiswahili
- Verify topic selection menu splitting works correctly
- Test conversation memory across multiple messages
-
Monitor Performance:
- Check vector database query performance
- Monitor API rate limits and costs
- Verify message delivery success rates