Skip to content

Call Center

A dual-purpose AI-powered chat system that provides business coaching support through both a public chat interface and an integrated call center workflow for youth entrepreneurs in rural Kenya.

Purpose

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

How It Works

This workflow operates as a sophisticated AI chat system with two main pathways:

  1. Public Chat Interface: Users can interact directly through a web-based chat trigger that provides immediate AI responses
  2. Call Center Integration: Business Advisors (BAs) can use the system during live phone calls to get real-time coaching advice and scripts

The system uses advanced AI agents powered by Google's Gemini model to analyze business situations and provide practical micro-actions. It maintains conversation memory and can retrieve business performance summaries to give contextual advice.

Key features include: - Real-time business coaching during calls - Youth business performance analysis - Micro-action generation with BA scripts - Escalation detection for serious issues - Multi-language support (primarily Swahili and English)

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

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

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

    I --> O[Insert rows in a table]

    P[setOutputField] --> Q[Output]

Trigger

Chat Trigger: A public webhook-based chat interface that accepts messages and provides an initial greeting: "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 users
AI Agent Primary business coaching agent with Mshauri system prompt
OpenRouter Chat Model Google Gemini 3 Flash Preview language model
Simple Memory Buffer window memory for conversation context
Postgres Database User record retrieval and profit data storage
Workflow Tools Integration with external workflows for data operations
Aggregate Combines business records for analysis

External Services & Credentials Required

  • OpenRouter API: Access to Google Gemini models
    • Credential: "OpenRouter KDP"
  • PostgreSQL Database: User data and business records storage
    • Credential: "PostgresOnSupabase" / "kdpTables"

Environment Variables

No specific environment variables are documented in the workflow configuration.

Data Flow

Input: - Chat messages from users - Phone numbers for user identification - Business performance queries

Processing: - User record lookup from PostgreSQL - Business performance data retrieval - AI analysis and coaching advice generation - Memory management for conversation context

Output: - Coaching advice and micro-actions - BA scripts for call center use - Business insights and recommendations - Chat log entries for tracking

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 - Safety concerns

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

Known Limitations

Based on the system prompts and configuration: - Designed specifically for youth entrepreneurs aged 18-30 in rural Kenya - Requires phone number identification for full functionality - Some nodes are currently disabled, indicating the workflow may be in development - Limited to business coaching scope - redirects off-topic queries

The system integrates with several external workflows: - dailySalesDataCollection (ID: JCO3nAXlEn5vU9Bn) - updateUserDataTool (ID: 7P8o5PMHB3BlpXSB) - updateUserStatusTool (ID: 0KvFdX0T49lalwIw) - getSummary (ID: CP3EYANkFJM9Jzas)

Setup Instructions

  1. Import the workflow into your n8n instance
  2. Configure credentials:
    • Set up OpenRouter API access with Google Gemini model access
    • Configure PostgreSQL connection to your database
  3. Database setup:
    • Ensure tables exist: youthEntrepreneursReal, dailyProfitTracking, chatLog
    • Set up proper schema for user records and business data
  4. Enable the workflow and activate the chat trigger
  5. Test the integration with a sample phone number and business query
  6. Configure related workflows for full functionality
  7. Set up monitoring for escalation scenarios and system performance

Note: Several nodes are currently disabled in this workflow, suggesting it may require additional configuration or be in a development state.