This workflow corresponds to n8n.io template #8031 — we link there as the canonical source.
This workflow follows the Gmail → Gmail Trigger recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"nodes": [
{
"id": "20d9e7a4-52a6-42d4-8e30-640cf2bcb6dd",
"name": "Setup Instructions",
"type": "n8n-nodes-base.stickyNote",
"position": [
-48,
16
],
"parameters": {
"width": 280,
"height": 520,
"content": "\ud83c\udf0d **SETUP REQUIRED:**\n\n1. **Gmail Label:**\n - Create label: 'Translated Emails'\n - Or customize in final Gmail node\n\n2. **OpenAI API Key:**\n - Get from platform.openai.com\n - Add to n8n credentials\n - Uses GPT-3.5-turbo (cost-effective)\n\n3. **Gmail OAuth:**\n - Connect Gmail account\n - Needs read/modify permissions\n\n\ud83c\udfaf Auto-detects language & translates non-English emails!"
},
"typeVersion": 1
},
{
"id": "c2eff161-87e1-42b4-bb00-364a5b448c9f",
"name": "Gmail New Email Trigger",
"type": "n8n-nodes-base.gmailTrigger",
"position": [
-48,
240
],
"parameters": {
"simple": false,
"filters": {
"readStatus": "unread",
"includeSpamTrash": false
},
"options": {},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
}
},
"typeVersion": 1
},
{
"id": "9c6427cc-261a-43af-a4aa-97ceba914d42",
"name": "Normalize Email Data",
"type": "n8n-nodes-base.code",
"position": [
160,
240
],
"parameters": {
"jsCode": "// Normalize email data and prepare for language detection\nconst email = $input.first().json;\n\n// Extract email content - handle both plain text and HTML\nlet emailBody = email.snippet || email.textPlain || email.textHtml || '';\n\n// Remove HTML tags if present\nif (emailBody.includes('<')) {\n emailBody = emailBody.replace(/<[^>]*>/g, ' ').replace(/\\s+/g, ' ').trim();\n}\n\n// Skip if email is too short to translate meaningfully\nif (emailBody.length < 10) {\n console.log('Email too short, skipping translation');\n return null;\n}\n\nconst normalizedData = {\n message_id: email.id,\n thread_id: email.threadId,\n subject: email.subject || 'No Subject',\n from: email.from,\n to: email.to,\n body_text: emailBody,\n received_date: email.date,\n labels: email.labelIds || [],\n has_attachments: (email.attachments && email.attachments.length > 0)\n};\n\nconsole.log('Email prepared for language detection:', {\n subject: normalizedData.subject,\n from: normalizedData.from,\n body_preview: normalizedData.body_text.substring(0, 100) + '...'\n});\n\nreturn {\n json: normalizedData\n};"
},
"typeVersion": 2
},
{
"id": "e153e8ca-38ab-48cb-be2f-cdba1cca6faf",
"name": "Detect Language (OpenAI)",
"type": "n8n-nodes-base.openAi",
"position": [
352,
240
],
"parameters": {
"resource": "chat",
"operation": "create",
"requestOptions": {}
},
"typeVersion": 1
},
{
"id": "ebc6660f-0a30-4c23-be79-1d2f8cbfddbd",
"name": "Need Translation?",
"type": "n8n-nodes-base.if",
"position": [
560,
240
],
"parameters": {
"options": {},
"conditions": {
"options": {
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "condition-1",
"operator": {
"type": "string",
"operation": "notEquals"
},
"leftValue": "={{ $json.choices[0].message.content.trim().toLowerCase() }}",
"rightValue": "en"
}
]
}
},
"typeVersion": 2
},
{
"id": "18108511-b253-4bba-9efb-c3cfe4f71090",
"name": "Translate to English",
"type": "n8n-nodes-base.openAi",
"position": [
752,
144
],
"parameters": {
"resource": "chat",
"operation": "create",
"requestOptions": {}
},
"typeVersion": 1
},
{
"id": "ce532d8a-6cbc-4320-8cb1-a82a28126a14",
"name": "Prepare Translated Email",
"type": "n8n-nodes-base.code",
"position": [
960,
144
],
"parameters": {
"jsCode": "// Prepare translated email for forwarding\nconst originalEmail = $('Normalize Email Data').item.json;\nconst translationResponse = $input.first().json;\nconst detectedLanguage = $('Detect Language (OpenAI)').item.json.choices[0].message.content.trim();\n\nconst translatedContent = translationResponse.choices[0].message.content;\n\n// Create forwarded email content\nconst forwardedEmail = {\n to: originalEmail.to, // Forward to same recipient or change as needed\n subject: `[TRANSLATED] ${originalEmail.subject}`,\n body: `\ud83c\udf0d AUTO-TRANSLATED EMAIL (Original Language: ${detectedLanguage.toUpperCase()})\n\n` +\n `\ud83d\udce7 Original From: ${originalEmail.from}\n` +\n `\ud83d\udcc5 Received: ${originalEmail.received_date}\n` +\n `\ud83d\udd17 Message ID: ${originalEmail.message_id}\n\n` +\n `\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n` +\n `TRANSLATED CONTENT:\n\n${translatedContent}\n` +\n `\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n\n` +\n `\u2728 This email was automatically translated by n8n workflow.`,\n original_message_id: originalEmail.message_id,\n detected_language: detectedLanguage\n};\n\nconsole.log('Prepared translated email:', {\n subject: forwardedEmail.subject,\n detected_language: detectedLanguage\n});\n\nreturn {\n json: forwardedEmail\n};"
},
"typeVersion": 2
},
{
"id": "b2b30041-80a7-4b55-b594-0d717f365b09",
"name": "Send Translated Email",
"type": "n8n-nodes-base.gmail",
"position": [
1152,
144
],
"parameters": {
"message": "={{ $json.body }}",
"options": {
"ccList": "",
"bccList": "",
"replyTo": ""
},
"subject": "={{ $json.subject }}"
},
"typeVersion": 2.1
},
{
"id": "7e9513fa-ce63-4815-b0a5-a05b622581d7",
"name": "Add 'Translated' Label",
"type": "n8n-nodes-base.gmail",
"position": [
1152,
256
],
"parameters": {
"labelIds": [
"INBOX",
"Translated Emails"
],
"messageId": "={{ $('Normalize Email Data').item.json.message_id }}",
"operation": "addLabels"
},
"typeVersion": 2.1
}
],
"connections": {
"Need Translation?": {
"main": [
[
{
"node": "Translate to English",
"type": "main",
"index": 0
}
]
]
},
"Normalize Email Data": {
"main": [
[
{
"node": "Detect Language (OpenAI)",
"type": "main",
"index": 0
}
]
]
},
"Translate to English": {
"main": [
[
{
"node": "Prepare Translated Email",
"type": "main",
"index": 0
}
]
]
},
"Gmail New Email Trigger": {
"main": [
[
{
"node": "Normalize Email Data",
"type": "main",
"index": 0
}
]
]
},
"Detect Language (OpenAI)": {
"main": [
[
{
"node": "Need Translation?",
"type": "main",
"index": 0
}
]
]
},
"Prepare Translated Email": {
"main": [
[
{
"node": "Send Translated Email",
"type": "main",
"index": 0
},
{
"node": "Add 'Translated' Label",
"type": "main",
"index": 0
}
]
]
}
}
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This workflow automatically detects the language of every new Gmail email and translates non-English messages into English. The translated email is forwarded to your inbox with a clear "[TRANSLATED]" subject tag, and a label is added for easy filtering. Gmail New Email Trigger…
Source: https://n8n.io/workflows/8031/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
Complete AI-powered sales system Automates lead capture, qualification, and follow-up from multiple channels. AI INTELLIGENCE:
An automated quote generation system that monitors your inbox, classifies quote requests using AI, calculates intelligent pricing based on historical data, and provides a professional dashboard for re
This n8n workflow — HRMate — streamlines your entire recruitment process by automatically parsing incoming job applications, evaluating candidate fit using AI, and sending personalized acceptance or r
Overview
Turn email overload into audio insights — automatically.