Skip to content

Call Center Mshauri BA Agent

This workflow provides an AI-powered business coaching assistant that helps Business Advisors (BAs) support youth entrepreneurs aged 18-30 in rural Kenya during live phone calls. The system analyzes youth business situations and provides clear micro-actions and scripts that BAs can relay directly to help increase business profits by at least 20% over time.

Purpose

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

This workflow serves as the core AI coaching engine for the Educate! Mshauri Digital Coaching System, specifically designed to assist Business Advisors during live phone consultations with young entrepreneurs in rural Kenya. The system addresses common business challenges faced by youth entrepreneurs, including poor profit visibility, excessive customer credit, high transport costs, and weak financial tracking. By providing BAs with instant, data-driven coaching advice and conversation scripts, the workflow helps ensure consistent, effective business guidance that drives measurable profit improvements.

How It Works

  1. Chat Initiation: A Business Advisor starts a conversation through the chat interface, typically during a live phone call with a youth entrepreneur
  2. Context Analysis: The AI agent analyzes the BA's message to detect if it contains youth identification information (phone number, name, business type)
  3. Data Retrieval: If a phone number is detected, the system automatically retrieves the youth's business performance summary and recent profit data
  4. Problem Assessment: The AI evaluates the youth's business situation, identifying core problems like poor profit visibility, high transport costs, or irregular sales patterns
  5. Micro-Action Generation: Based on the analysis, the system generates exactly 3 specific, actionable recommendations that require no money and can be completed in 1-3 days
  6. BA Response: The AI provides the BA with a structured response including the problem diagnosis, business context, micro-actions with conversation scripts, and follow-up questions
  7. Conversation Logging: All interactions are logged to the database for tracking and analysis

Workflow 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[Postgres Chat Memory - Disabled]
    I --> K[dailySalesDataCollection - Disabled]
    I --> L[updateUserDataTool - Disabled]
    I --> M[updateUserStatusTool - Disabled]
    I --> N[OpenRouter Chat Model1 - Disabled]
    I --> O[Insert rows in a table - Disabled]

    P[Sticky Note]

Trigger

Chat Trigger: The workflow is triggered when a chat message is received through the public chat interface. The trigger includes an initial greeting message: "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 coaching intelligence that analyzes situations and generates advice
OpenRouter Chat Model Provides AI language model capabilities using Google Gemini 3 Flash Preview
Simple Memory Maintains conversation context with a 20-message window
Postgres (getUserRecord) Retrieves youth entrepreneur profile data
Postgres (getProfitData) Fetches recent business performance data
Aggregate Combines business records for analysis
Tool Workflow (get_summary) Retrieves comprehensive business performance summaries
Sticky Note Contains development notes and TODOs

Note: Several nodes are disabled in the current configuration, including the secondary AI agent, chat memory, and data collection tools.

External Services & Credentials Required

OpenRouter API

  • Credential Name: call_center_mshauri_BA_agent
  • Purpose: Powers the main AI coaching agent using Google Gemini 3 Flash Preview model
  • Required For: Core AI functionality

PostgreSQL Database

  • Credential Name: Postgres account
  • Purpose: Stores youth entrepreneur profiles, business records, and chat logs
  • Required For: Data retrieval and conversation logging

Environment Variables

No specific environment variables are documented in this workflow. Configuration appears to be handled through n8n's credential system and node parameters.

Data Flow

Input

  • Chat messages from Business Advisors containing:
    • Youth phone numbers
    • Business challenges or questions
    • Context about current situations

Processing

  • Youth profile lookup by phone number
  • Recent business performance data retrieval (last 20 records)
  • AI analysis of business patterns and problems
  • Generation of targeted micro-actions and BA scripts

Output

  • Structured coaching responses including:
    • Problem diagnosis
    • Business context and insights
    • 3 specific micro-actions with BA conversation scripts
    • Follow-up questions for next contact
    • Escalation recommendations when needed

Error Handling

The workflow includes basic error handling: - OpenRouter Chat Model: Configured with retry on fail and continue on error - AI Agent: Set to continue on error output - getProfitData: Always outputs data even when no records found

The system is designed to gracefully handle missing data and provide appropriate responses even when youth records are incomplete.

Known Limitations

Based on the development notes in the workflow: - Performance concerns about processing overhead after every message - Need for more efficient summary generation - Edge cases with phone number format handling (+254 vs 07 formats) - Summary agent functionality needs implementation - Session conclusion detection for summary creation

  • dailySalesDataCollection (ID: aOQRTnNvRUCjjwRE): Handles daily business data recording
  • updateUserDataTool (ID: ON18WqpuHwpe5jc6): Manages youth profile updates
  • updateUserStatusTool (ID: Ht3MkckUHVE039d0): Updates user onboarding status
  • [Call Center] getSummary (ID: lSfgvJsk9DCCp8sn): Generates business performance summaries

Setup Instructions

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

  2. Configure Credentials:

    • Set up OpenRouter API credentials with access to Google Gemini models
    • Configure PostgreSQL database connection with access to required tables
  3. Database Setup: Ensure the following tables exist:

    • youthEntrepreneursReal: Youth profile data
    • dailyProfitTracking: Business performance records
    • chatLog: Conversation logging
  4. Enable Chat Interface: The workflow uses a public chat trigger - ensure your n8n instance supports public webhooks

  5. Test Configuration:

    • Send a test message through the chat interface
    • Verify database connections are working
    • Confirm AI responses are generated correctly
  6. Related Workflows: Import and configure the dependent workflows for full functionality

  7. Monitor Performance: Watch for the performance issues noted in the limitations and consider implementing the suggested optimizations