Skip to content

Call Center - Francis

A business advisory chatbot system that provides real-time coaching support to Business Advisors (BAs) during phone calls with youth entrepreneurs in rural Kenya. The system uses AI to analyze business situations and provide practical micro-actions that BAs can relay directly to youth clients.

Purpose

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

Based on the workflow configuration, this appears to be part of the Educate! Kenya Digital Product supporting out-of-school youth entrepreneurs aged 18-30 in rural counties like Makueni. The system helps Business Advisors provide immediate, data-driven coaching during live calls by:

  • Analyzing youth business performance data
  • Generating specific micro-actions for profit improvement
  • Providing BA scripts in local languages (Swahili/English)
  • Supporting the program goal of 20% profit uplift for youth businesses

How It Works

  1. Chat Initiation: A Business Advisor starts a conversation through the chat interface, typically during or preparing for a call with a youth entrepreneur
  2. AI Processing: The system uses Google's Gemini 3 Flash model via OpenRouter to analyze the BA's input and determine what coaching support is needed
  3. Data Retrieval: If a phone number is mentioned, the system automatically retrieves the youth's business performance summary and recent sales data
  4. Response Generation: The AI provides structured advice including problem identification, business context, exactly 3 micro-actions with BA scripts, and follow-up questions
  5. Memory Management: The conversation is stored using a simple buffer window memory to maintain context across the session

The system is designed to work in real-time during calls, providing BAs with immediate, actionable advice they can relay to youth entrepreneurs.

Mermaid Diagram

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

    B --> F[Output]

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

    K[Postgres Chat Memory] --> J
    L[OpenRouter Chat Model1] --> J
    M[dailySalesDataCollection] --> J
    N[updateUserDataTool] --> J
    O[updateUserStatusTool] --> J

    J --> P[Insert rows in a table]

    Q[setOutputField] -.-> R[Disabled Path]

Trigger

Chat Trigger: The workflow starts when a chat message is received through the public chat interface. The trigger is configured with: - Public access enabled - Initial greeting: "Hi there! 👋I am your Business Adviser. How can I assist you today?" - Webhook ID: 341f76d9-ac26-472c-a9a5-a8ea368f66ff

Nodes Used

Node Type Purpose
Chat Trigger Receives incoming chat messages from Business Advisors
AI Agent Main coaching logic using extensive system prompt for BA support
OpenRouter Chat Model Google Gemini 3 Flash model for AI processing
Simple Memory Maintains conversation context with 20-message window
Tool Workflow (get_summary) Retrieves youth business performance summaries
Postgres (getUserRecord) Fetches youth entrepreneur profile data
Postgres (getProfitData) Retrieves recent business performance records
Aggregate Combines business records for AI analysis

Note: Several nodes are disabled, including a secondary AI agent path and database logging functionality.

External Services & Credentials Required

OpenRouter API

  • Purpose: Access to Google Gemini 3 Flash model for AI processing
  • Credential Name: "OpenRouter account"
  • Required For: AI response generation and business coaching logic

PostgreSQL Database

  • Purpose: Youth entrepreneur data storage and retrieval
  • Credential Name: "PostgresOnSupabase"
  • Required For: User profiles, business records, and chat logging
  • Tables Used:
    • youthEntrepreneursReal (youth profiles)
    • dailyProfitTracking (business performance data)
    • chatLog (conversation logging - disabled)

Environment Variables

No explicit environment variables are configured in this workflow. All external connections use stored credentials.

Data Flow

Input

  • Chat messages from Business Advisors containing:
    • Youth phone numbers
    • Business questions or situations
    • Requests for coaching advice

Processing

  • Retrieves youth profile and recent business performance data
  • Analyzes patterns in sales, costs, and profit trends
  • Generates contextual coaching advice using AI

Output

  • Structured coaching responses including:
    • Problem identification
    • Business context and insights
    • Exactly 3 specific micro-actions
    • BA scripts in appropriate language
    • Follow-up questions for next call

Error Handling

The workflow includes basic error handling through: - alwaysOutputData: true on the getProfitData node to handle cases with no business records - Disabled fallback paths for alternative processing - Tool workflows that can handle missing or invalid data

No explicit error nodes or try-catch mechanisms are implemented in the active path.

Known Limitations

Based on the system prompt and configuration: - Designed specifically for rural Kenya context and may not translate to other regions - Requires phone numbers in specific format (+254) for proper data retrieval - Limited to 3 micro-actions per conversation to avoid overwhelming BAs - Depends on consistent data collection from youth entrepreneurs - May have performance issues with frequent summary generation (noted in sticky note)

The system references several connected workflows: - dailySalesDataCollection (ID: fBc6cSMp9Wz1brlZ) - Records daily business data - updateUserDataTool (ID: xVkMVJOCq5ptCOHj) - Updates youth profile information
- updateUserStatusTool (ID: nfVcA8ei8x9dE06Z) - Manages onboarding status - getSummary (ID: F9KfqTfc89UT8Vv2) - Generates business performance summaries

Setup Instructions

  1. Import Workflow: Import the JSON into your n8n instance
  2. Configure Credentials:
    • Set up OpenRouter API credential with valid API key
    • Configure PostgreSQL connection to Supabase database
  3. Database Setup: Ensure required tables exist:
    • youthEntrepreneursReal with youth profile fields
    • dailyProfitTracking with business performance fields
  4. Deploy Connected Workflows: Import and configure the related tool workflows
  5. Test Chat Interface: Access the public chat URL to verify functionality
  6. Enable Disabled Nodes: If needed, enable the secondary AI agent path and logging functionality
  7. Monitor Performance: Watch for efficiency issues noted in the development comments

The workflow is currently inactive ("active": false) and will need to be activated after setup and testing.