Skip to content

Call Center - Francis

An AI-powered business coaching system that provides real-time support to Business Advisors (BAs) during phone calls with young entrepreneurs in rural Kenya. The system analyzes youth business situations and delivers actionable micro-strategies that BAs can relay directly to help increase business profits by at least 20%.

Purpose

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

This workflow appears to be designed as a call center support system for business advisors working with youth entrepreneurs. The AI agent "Mshauri" assists BAs during live phone calls by quickly analyzing business situations and providing clear, actionable advice that can be communicated directly to young business owners aged 18-30 in rural Kenya.

How It Works

  1. Chat Initiation: A Business Advisor starts a conversation through the chat interface, typically during or before a call with a youth entrepreneur
  2. Context Analysis: The system identifies if a phone number is provided and retrieves the youth's business performance summary and historical data
  3. AI Processing: The Mshauri AI agent analyzes the situation using Google's Gemini model, considering recent sales, profit trends, and previous micro-actions
  4. Response Generation: The AI provides the BA with a structured response including problem identification, business context, exactly 3 micro-actions with scripts, and follow-up questions
  5. Data Collection: When business numbers are provided, the system can record daily sales data and calculate profits
  6. Memory Retention: Conversation history is maintained to provide context for ongoing coaching relationships

Mermaid Diagram

graph TD
    A[When chat message received] --> B[AI Agent1]
    B --> C[OpenRouter Chat Model]
    B --> D[Simple Memory]
    B --> E[get_summary]

    F[getUserRecord] --> G[getProfitData]
    G --> H[Aggregate]
    H --> I[AI Agent - Disabled]

    I --> J[OpenRouter Chat Model1 - Disabled]
    I --> K[Postgres Chat Memory - Disabled]
    I --> L[dailySalesDataCollection - Disabled]
    I --> M[updateUserDataTool - Disabled]
    I --> N[updateUserStatusTool - Disabled]
    I --> O[Insert rows in a table - Disabled]

    P[setOutputField - Disabled]

Trigger

Chat Trigger: The workflow is triggered when a chat message is received through a public webhook. The initial message displays: "Hi there! 👋I am your Business Adviser. How can I assist you today?"

Nodes Used

Node Type Purpose
Chat Trigger Receives incoming chat messages from Business Advisors
AI Agent Main Mshauri coaching agent that analyzes situations and provides advice
OpenRouter Chat Model Google Gemini 3 Flash Preview model for AI processing
Simple Memory Maintains conversation context with 20-message window
Postgres Database Retrieves user records and profit tracking data
Workflow Tools External tools for data collection and user management
Aggregate Combines business records for analysis

External Services & Credentials Required

  • OpenRouter API: For accessing Google Gemini 3 Flash Preview model
  • PostgreSQL Database: For storing user records, profit tracking data, and chat logs
  • External Workflows:
    • dailySalesDataCollection (ID: fBc6cSMp9Wz1brlZ)
    • updateUserDataTool (ID: xVkMVJOCq5ptCOHj)
    • updateUserStatusTool (ID: nfVcA8ei8x9dE06Z)
    • getSummary (ID: F9KfqTfc89UT8Vv2)

Environment Variables

No specific environment variables are defined in this workflow. Configuration is handled through: - OpenRouter API credentials - PostgreSQL connection settings - Webhook configuration for chat trigger

Data Flow

Input: - Chat messages from Business Advisors - Phone numbers of youth entrepreneurs - Business performance data (sales, costs, profits)

Processing: - Retrieves youth business records from database - Analyzes profit trends and patterns - Generates contextual business advice - Provides scripted responses for BAs

Output: - Structured coaching advice with micro-actions - BA scripts in appropriate language (Swahili/English) - Follow-up questions for next interactions - Recorded conversation logs

Error Handling

The workflow includes escalation protocols for serious situations: - Debt collector harassment - Family conflicts over business money - Youth wanting to close business permanently - Signs of emotional distress or safety concerns

When escalation triggers are detected, the system returns "⚠️ ESCALATION NEEDED" and instructs the BA to connect the youth with their Community Education Advisor (CEA) immediately.

Known Limitations

Based on the system prompt, several limitations are noted: - Many nodes are currently disabled, suggesting this is a development or testing version - The system requires phone numbers in specific format (+254) for proper operation - Responses must be kept under 160 characters for SMS channels - The workflow needs efficient session management to avoid overload after every message - Summary generation should occur 15 minutes after call completion rather than real-time

  • dailySalesDataCollection: Records daily business performance data
  • updateUserDataTool: Manages youth entrepreneur profile updates
  • updateUserStatusTool: Handles onboarding status progression
  • getSummary: Generates business performance summaries for BAs

Setup Instructions

  1. Import Workflow: Import the JSON into your n8n instance
  2. Configure Credentials:
    • Set up OpenRouter API account with access to Google Gemini models
    • Configure PostgreSQL connection to Supabase database
  3. Database Setup: Ensure these tables exist:
    • youthEntrepreneursReal (user profiles)
    • dailyProfitTracking (business performance data)
    • chatLog (conversation history)
  4. External Workflows: Import and configure the four dependent workflows listed above
  5. Enable Nodes: Currently many nodes are disabled - enable them based on your deployment needs
  6. Webhook Configuration: Note the webhook ID for chat trigger integration
  7. Test Flow: Start with the chat trigger and verify database connections work properly
  8. Memory Setup: Configure PostgreSQL chat memory for session persistence

Note: This appears to be a development version with many disabled nodes. Review which components are needed for your specific deployment before enabling all functionality.