My Workflow 4¶
A multilingual AI assistant workflow that processes both text and voice messages through WhatsApp, providing intelligent responses with translation capabilities between English, Luganda, and Swahili.
Purpose¶
No business context provided yet — add a context.md to enrich this documentation.
This workflow appears to be designed for multilingual communication support, enabling users to interact with an AI assistant through WhatsApp in multiple languages. The system can handle both text messages and voice notes, automatically transcribing audio and providing translation services between English and local African languages (Luganda and Swahili).
How It Works¶
The workflow operates through two main pathways:
Chat Interface Path: 1. Receives chat messages through a chat trigger 2. Simultaneously translates the input to Luganda and processes it through an AI agent 3. The AI agent uses OpenAI's GPT-4 model with translation tools and memory to provide contextual responses
WhatsApp Integration Path (Currently Disabled): 1. Receives WhatsApp messages via webhook 2. Checks if the message contains audio content 3. For voice messages: downloads the audio file, transcribes it using OpenAI's Whisper, then processes the text 4. For text messages: directly processes the message content 5. Translates the final message to Luganda and sends it to the AI agent for response generation
Both paths utilize conversation memory to maintain context across interactions and can 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:#ffcccc
style E fill:#ffcccc
style F fill:#ffcccc
style G fill:#ffcccc
style H fill:#ffcccc
style I fill:#ffcccc
style J fill:#ffcccc
style K fill:#ffcccc
style L fill:#ffcccc
style P fill:#ffcccc
style Q fill:#ffcccc
style R fill:#ffcccc
Trigger¶
- Primary Trigger: Chat Trigger - Responds to incoming chat messages
- Secondary Trigger: WhatsApp Webhook (currently disabled) - Receives WhatsApp messages via HTTP POST to
/coaching-startendpoint
Nodes Used¶
| Node Type | Purpose |
|---|---|
| Chat Trigger | Receives and processes incoming chat messages |
| WhatsApp Webhook | Handles incoming WhatsApp messages (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 language model for generating responses |
| Simple Memory | Maintains conversation context and history |
| OpenAI Transcribe | Converts voice messages to text using Whisper |
| HTTP Request | Downloads voice files from WhatsApp |
| If Node | Conditional logic to handle voice vs text messages |
| Set Node | Data transformation and message formatting |
External Services & Credentials Required¶
Required Credentials:¶
- Google Service Account: For Google Translate API access
- OpenAI API: For GPT-4 chat model and Whisper transcription
External Services:¶
- Google Translate API: Text translation between languages
- OpenAI API: Language model and speech-to-text services
- WhatsApp Business API (via Twilio): Message receiving and sending
- Twilio Webhook: For WhatsApp integration
Environment Variables¶
No specific environment variables are defined in this workflow. All configuration is handled through n8n credentials and node parameters.
Data Flow¶
Input:¶
- Chat messages: Text input through chat interface
- WhatsApp messages: Text or voice messages via webhook
- Voice files: Audio files from WhatsApp media URLs
Processing:¶
- Text translation to/from Luganda and Swahili
- Voice transcription to text
- AI-powered response generation with conversation memory
- Language detection and appropriate translation
Output:¶
- AI responses: Contextual replies in appropriate language
- Translated text: Messages converted between supported languages
- Transcribed text: Voice messages converted to text format
Error Handling¶
The workflow includes basic error handling through:
- Conditional logic for message type detection (voice vs text)
- alwaysOutputData setting on AI agents to ensure execution continues
- Separate processing paths to isolate failures
No explicit error handling nodes or try-catch mechanisms are implemented.
Known Limitations¶
- WhatsApp integration pathway is currently disabled
- Limited to three languages: English, Luganda, and Swahili
- No explicit error handling for API failures
- Voice file processing depends on WhatsApp media URL accessibility
- Memory is session-based and may not persist across workflow restarts
Related Workflows¶
No related workflows specified in the current context.
Setup Instructions¶
1. Import Workflow¶
- Copy the workflow JSON
- In n8n, go to Workflows → Import from JSON
- Paste the JSON and import
2. Configure Credentials¶
-
Google Service Account:
- Create a Google Cloud project
- Enable Google Translate API
- Create a service account and download JSON key
- Add credential in n8n with the service account details
-
OpenAI API:
- Obtain OpenAI API key
- Add credential in n8n with your API key
- Ensure access to GPT-4 and Whisper models
3. Configure Webhooks (Optional)¶
- For WhatsApp integration:
- Set up Twilio WhatsApp Business account
- Configure webhook URL:
https://your-n8n-instance.com/webhook/coaching-start - Enable the disabled WhatsApp webhook node
4. Test the Workflow¶
- Activate the workflow
- Test the chat trigger with sample messages
- Verify translation functionality
- Test voice transcription if WhatsApp integration is enabled
5. Customize System Prompts¶
- Modify the AI Agent system messages to match your specific use case
- Adjust translation target languages as needed
- Configure memory settings based on conversation length requirements