Skip to content

My workflow 4

A multilingual AI assistant workflow that processes text and voice messages through WhatsApp, providing translation services between English, Luganda, and Swahili using OpenAI's language models and Google Translate.

Purpose

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

How It Works

This workflow operates in two main modes:

Chat Interface Mode: 1. Receives chat messages through a chat trigger 2. Simultaneously translates the input to Luganda using Google Translate 3. Processes the message through an AI agent with translation capabilities 4. Uses OpenAI's GPT-4.1-mini model with memory to maintain conversation context

WhatsApp Integration Mode (Currently Disabled): 1. Receives WhatsApp messages via webhook 2. Detects if the message contains audio or text 3. For voice messages: downloads the audio file and transcribes it using OpenAI's Whisper 4. For text messages: extracts the message body directly 5. Processes the unified message through translation and AI agent 6. Maintains conversation memory across interactions

Both modes include Google Translate integration as a tool that the AI agent can use to translate between English, Luganda, and Swahili as needed.

Workflow Diagram

graph TD
    A[When chat message received] --> B[Translate a language]
    A --> C[AI Agent]

    D[WhatsApp Webhook] --> E[If Voicenote1]
    E -->|Audio| F[Download Voice File1]
    E -->|Text| G[Text In]
    F --> H[Transcribe a recording1]
    H --> I[Voice Out]
    I --> J[User Message]
    G --> J
    J --> K[Translate a language1]
    J --> L[AI Agent1]

    M[Simple Memory] -.->|Memory| C
    N[Translate a language in Google Translate] -.->|Tool| C
    O[OpenAI Chat Model] -.->|LLM| C

    P[Simple Memory1] -.->|Memory| L
    Q[Translate a language in Google Translate1] -.->|Tool| L
    R[OpenAI Chat Model1] -.->|LLM| L

    style D fill:#f9f,stroke:#333,stroke-width:2px,stroke-dasharray: 5 5
    style A fill:#9f9,stroke:#333,stroke-width:2px

Trigger

  • Primary: Chat Trigger - Activates when a chat message is received
  • Secondary: WhatsApp Webhook (disabled) - Would activate on POST requests to /coaching-start endpoint

Nodes Used

Node Type Purpose
Chat Trigger Receives chat messages to start the workflow
WhatsApp Webhook Receives WhatsApp messages via HTTP webhook (disabled)
Google Translate Translates text to Luganda language
Google Translate Tool Provides translation capabilities as an AI tool
AI Agent Processes messages using OpenAI with translation system prompt
OpenAI Chat Model GPT-4.1-mini language model for AI responses
Simple Memory Maintains conversation context using buffer window
OpenAI Transcribe Converts voice messages to text using Whisper
HTTP Request Downloads voice files from WhatsApp
If Condition Routes workflow based on message type (audio vs text)
Set Formats and structures data between nodes

External Services & Credentials Required

Google Services

  • Google API Service Account: Required for Google Translate functionality
  • Credential ID: u8Zeb0lNtDZj5UG8

OpenAI Services

  • OpenAI API: Required for chat model and transcription
  • Credential ID: 1jajeqGzQj9Eb2iW
  • Models Used: GPT-4.1-mini, Whisper (for transcription)

WhatsApp/Twilio (for webhook mode)

  • Twilio WhatsApp API: Required for receiving WhatsApp messages
  • Webhook URL: /coaching-start

Environment Variables

No specific environment variables are configured in this workflow. All external service authentication is handled through n8n credential management.

Data Flow

Input

  • Chat Mode: Text messages via chat interface
  • WhatsApp Mode: Text messages or voice notes via WhatsApp

Processing

  • Text extraction and formatting
  • Language detection and translation to Luganda
  • AI processing with translation context
  • Memory storage for conversation continuity

Output

  • AI-generated responses in appropriate language
  • Translation results
  • Conversation memory updates

Error Handling

The workflow includes basic error handling through: - Conditional routing for different message types - alwaysOutputData setting on AI agents to ensure execution continues - Fallback paths for both voice and text message processing

No explicit error handling nodes are configured for service failures.

Known Limitations

  • WhatsApp integration is currently disabled
  • Limited to translation between English, Luganda, and Swahili
  • No explicit error handling for API failures
  • Voice transcription limited to formats supported by OpenAI Whisper
  • Memory is session-based and may not persist across workflow restarts

No related workflows specified in the current context.

Setup Instructions

  1. Import the Workflow

    • Import the JSON into your n8n instance
    • The workflow will be created in inactive state
  2. Configure Credentials

    • Set up Google API Service Account for translation services
    • Configure OpenAI API credentials for chat model and transcription
    • If using WhatsApp: Set up Twilio credentials and webhook configuration
  3. Enable Components

    • Activate the chat trigger for immediate use
    • Enable the WhatsApp webhook if WhatsApp integration is needed
    • Configure webhook URL in your Twilio WhatsApp settings
  4. Test the Workflow

    • Send a test message through the chat interface
    • Verify translation functionality
    • Test voice transcription if using WhatsApp mode
  5. Customize Settings

    • Adjust system prompts in AI agents as needed
    • Modify translation target languages
    • Configure memory window size if needed
  6. Activate

    • Set workflow to active state
    • Monitor execution logs for any issues