Réponse automatique aux brouillons Gmail multilingue
Ceci est unSupport, AIworkflow d'automatisation du domainecontenant 16 nœuds.Utilise principalement des nœuds comme If, Gmail, Switch, GmailTrigger, ChainLlm, combinant la technologie d'intelligence artificielle pour une automatisation intelligente. Génération automatisée de réponses Gmail bilingues avec OpenAI GPT-4o
- •Compte Google et informations d'identification Gmail API
- •Clé API OpenAI
Catégorie
{
"id": "OskjNtIb2AnxHXP2",
"meta": {
"instanceId": "1af8a0dc0d2f537b7c08209af728c271b5a03806bdf309bedf99d668f2608ee6",
"templateCredsSetupCompleted": true
},
"name": "Automated Multilingual Gmail Draft Reply with OpenAI GPT-4o in n8n",
"tags": [
{
"id": "UXY9NrpVC8pjYHmK",
"name": "n8n Template",
"createdAt": "2025-06-05T07:41:37.020Z",
"updatedAt": "2025-06-05T07:41:37.020Z"
}
],
"nodes": [
{
"id": "579d54f2-8c04-4624-890a-c432d96f3911",
"name": "If Needs Reply",
"type": "n8n-nodes-base.if",
"position": [
1500,
220
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "53849246-ad32-4845-9976-9f9688f5a6f2",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $json.needsReply }}",
"rightValue": "true"
}
]
}
},
"typeVersion": 2
},
{
"id": "526ab96e-bf2a-44f5-9e1b-3b1a10b5f55b",
"name": "Note adhésive",
"type": "n8n-nodes-base.stickyNote",
"position": [
580,
0
],
"parameters": {
"width": 444,
"height": 434,
"content": "### Gmail Trigger\n\nGet new incoming messages from Gmail with a specific label.\n\nIn this example, the \"Inquiry\" label is used. Feel free to set it up using other Gmail filters.\n\n⚠️ Adjust the time (polling) interval according to your needs.\n"
},
"typeVersion": 1
},
{
"id": "7289a14b-225e-4399-aa6c-cb56158f450d",
"name": "Note adhésive1",
"type": "n8n-nodes-base.stickyNote",
"position": [
1100,
0
],
"parameters": {
"width": 576,
"height": 577,
"content": "### Assess the email contents that need a reply\n\nThis assessment uses OpenAI GPT-4o and a JSON parser to determine whether a response is necessary and to identify the message’s language."
},
"typeVersion": 1
},
{
"id": "d10724dd-406c-4143-9c22-2c3ecd45e6be",
"name": "Gmail - Créer un brouillon",
"type": "n8n-nodes-base.gmail",
"position": [
2760,
160
],
"webhookId": "a39b80e1-12c5-4569-aa46-63a2c2bd2d13",
"parameters": {
"message": "={{ $json.text.replace(/\\n/g, \"<br />\\n\") }}",
"options": {
"sendTo": "={{ $('Gmail trigger').item.json.headers.from }}",
"threadId": "={{ $('Gmail trigger').item.json.threadId }}"
},
"subject": "=Re: {{ $('Gmail trigger').item.json.headers.subject }}",
"resource": "draft",
"emailType": "html"
},
"credentials": {
"gmailOAuth2": {
"id": "2pW13S2GyP5GCdoP",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "b805dfdb-a68e-458f-9af9-8a9e773a951d",
"name": "Note adhésive4",
"type": "n8n-nodes-base.stickyNote",
"position": [
2660,
0
],
"parameters": {
"width": 326,
"height": 395,
"content": "### Create a Draft in the conversation\n\nDraft Integration: after converting the text to html, it places the draft into the Gmail thread as a reply to the first message"
},
"typeVersion": 1
},
{
"id": "cbb5c6a6-a445-474b-890f-54d1a546c28a",
"name": "Commutation basée sur la langue de l'email",
"type": "n8n-nodes-base.switch",
"position": [
1840,
200
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "Japanese version",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "b9788587-ad2a-4d44-bf01-f31c9412a48d",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.message_language }}",
"rightValue": "Japanese"
}
]
},
"renameOutput": true
},
{
"outputKey": "English version",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "429c0f4a-b5f8-4730-9609-40fe20acd496",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.message_language }}",
"rightValue": "English"
}
]
},
"renameOutput": true
}
]
},
"options": {
"fallbackOutput": 1
}
},
"typeVersion": 3.2
},
{
"id": "a720280e-7c5f-4f83-ad2e-b13572cba762",
"name": "Note adhésive3",
"type": "n8n-nodes-base.stickyNote",
"position": [
1760,
0
],
"parameters": {
"width": 813,
"height": 740,
"content": "### Generate a Reply\n\nDefine the output from the Switch node. Then, generate a draft reply using OpenAI GPT-4 Turbo based on the message’s detected language. Establish the rules and conventions for each supported language, including appropriate greetings, closings, tone, and any other cultural considerations."
},
"typeVersion": 1
},
{
"id": "a107790b-f883-469e-8763-61ec92bf1d8e",
"name": "Générer un email pour un client japonais",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"position": [
2080,
160
],
"parameters": {
"text": "=Subject: {{ $('Gmail trigger').item.json.subject }}\nMessage: {{ $('Gmail trigger').item.json.textAsHtml }}",
"messages": {
"messageValues": [
{
"message": "You're a helpful personal assistant and your task is to draft replies on my behalf to my incoming emails. Whenever I provide some text from an email, return an appropriate draft reply for it and nothing else.\nEnsure that the reply is suitable for a professional email setting and addresses the topic in a clear, structured, and detailed manner.\nDo not make things up.\n\nDetailed instructions:\n- Be concise and maintain a business tone (desu-masu).\n- Follow the following content \n[INSERT CLIENT NAME] 様\nお世話になっております。\n株式会社 [INSERT YOUR COMPANY NAME] の[INSERT YOUR NAME]です。\n\nBODY (main content)\n\n引き続き、何卒どうぞ宜しくお願いいたします。\n\n- When replying to yes-no questions, draft 2 responses: one affirmative and one negative separated by \" - - - - - - - OR - - - - - - - \"\n- If you don't know an answer, you can leave placeholders like \"[YOUR_ANSWER_HERE]\".\n- Don't use any special formatting, only plain text.\n- Make sure each request is separated with a new line break\n- Reply in the same language as the inbound email."
}
]
},
"promptType": "define"
},
"typeVersion": 1.4
},
{
"id": "a548fcdd-1f5e-4a75-b136-07ecf4e96d3d",
"name": "Générer une réponse email pour un client anglais",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"position": [
2080,
440
],
"parameters": {
"text": "=Subject: {{ $('Gmail trigger').item.json.subject }}\nMessage: {{ $('Gmail trigger').item.json.textAsHtml }}",
"messages": {
"messageValues": [
{
"message": "You're a helpful personal assistant and your task is to draft replies on my behalf to my incoming emails. Whenever I provide some text from an email, return an appropriate draft reply for it and nothing else.\nEnsure that the reply is suitable for a professional email setting and addresses the topic in a clear, structured, and detailed manner.\nDo not make things up.\n\nDetailed instructions:\n- Be concise and maintain a business casual tone.\n- Start with \"Dear,\", and end with \"Best regards,\"\n- When replying to yes-no questions, draft 2 responses: one affirmative and one negative separated by \" - - - - - - - OR - - - - - - - \"\n- If you don't know an answer, you can leave placeholders like \"[YOUR_ANSWER_HERE]\".\n- Don't use any special formatting, only plain text.\n- Reply in the same language as the inbound email."
}
]
},
"promptType": "define"
},
"typeVersion": 1.4
},
{
"id": "dcdf44aa-b313-4a22-ae45-0774e5a85add",
"name": "Note adhésive5",
"type": "n8n-nodes-base.stickyNote",
"position": [
-40,
0
],
"parameters": {
"color": 4,
"width": 560,
"height": 941,
"content": "## Automated Multilingual Gmail Draft Reply with OpenAI GPT-4o in n8n\n\n### Who is this for?\nThis workflow is ideal for anyone who receives a high volume of Gmail inquiries, especially those providing multilingual customer support or handling diverse client \ncommunications.\n\n### What problem is this workflow solving? \nManaging frequent emails in multiple languages can be overwhelming. This workflow reduces manual drafting by automatically generating context-aware replies using OpenAI GPT-4o, letting users focus on personalization and quality assurance.\n\n### What this workflow does\n- Monitors your Gmail inbox for new emails with a specific label (e.g., \"Inquiry\").\n- Uses OpenAI GPT-4o for message assessment and language detection.\n- Parses information using a JSON parser.\n- Generates an AI-powered draft reply in the detected language via OpenAI GPT-4o.\n- Converts the reply to HTML and saves it as a draft in the original Gmail thread for your review.\n\n### Setup\n- Connect your Gmail account and set up relevant labels in both Gmail and the workflow.\n- Integrate your OpenAI credentials in n8n.\n- Configure the workflow trigger for your desired labels.\n\n## How to customize this workflow to your needs\n- Adjust label names in both Gmail and the workflow for different email categories.\n- Define custom starting and ending phrases for draft replies per supported language.\n- Expand supported languages or modify AI prompt instructions to suit your brand’s tone."
},
"typeVersion": 1
},
{
"id": "323eb990-e7c4-4495-811a-a3c5b26c27f0",
"name": "Déclencheur Gmail",
"type": "n8n-nodes-base.gmailTrigger",
"position": [
740,
220
],
"parameters": {
"simple": false,
"filters": {
"q": ""
},
"options": {},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
}
},
"credentials": {
"gmailOAuth2": {
"id": "2pW13S2GyP5GCdoP",
"name": "Gmail account"
}
},
"typeVersion": 1
},
{
"id": "1659ef58-d317-4260-99a8-f1de50d50839",
"name": "OpenAI GPT-4o",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
1140,
420
],
"parameters": {
"model": "gpt-4o",
"options": {
"temperature": 0,
"responseFormat": "json_object"
}
},
"credentials": {
"openAiApi": {
"id": "8cWUJS0NExv35YHi",
"name": "OpenAi account"
}
},
"typeVersion": 1
},
{
"id": "aeb51aac-0706-4a0e-8a21-cc09147a6e87",
"name": "Évaluer si un message nécessite une réponse et identifier la langue",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"position": [
1140,
220
],
"parameters": {
"prompt": "=Subject: {{ $json.subject }}\nMessage:\n{{ $json.textAsHtml }} ",
"messages": {
"messageValues": [
{
"message": "Your task is to :\n- identify the language of the message and set the value to field \"message_language\" : \"English\", \"Japanese\" or \"Other\"\n- assess if the message requires a response and set the value to field \"needsReply\" : true if it does, false otherwise.\nReturn in JSON format.\nMarketing emails don't require a response."
}
]
}
},
"typeVersion": 1.3
},
{
"id": "7e8a17a4-fc57-4f8f-9755-3984547bfcce",
"name": "Résultat de l'analyseur",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
1300,
420
],
"parameters": {
"jsonSchema": "={\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"needsReply\": {\n \"type\": \"boolean\"\n },\n \"message_language\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\"needsReply\", \"message_language\"]\n }\n}"
},
"typeVersion": 1
},
{
"id": "79600a11-8038-48d7-a7a5-5c0ffdb6d412",
"name": "OpenAI GPT 4o - Pour l'anglais",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
2100,
580
],
"parameters": {
"model": "gpt-4o",
"options": {}
},
"credentials": {
"openAiApi": {
"id": "8cWUJS0NExv35YHi",
"name": "OpenAi account"
}
},
"typeVersion": 1
},
{
"id": "e0e0ef36-5a52-4d77-ba51-270693ce893f",
"name": "OpenAI GPT-4o - pour le japonais",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
2060,
300
],
"parameters": {
"model": "gpt-4o",
"options": {}
},
"credentials": {
"openAiApi": {
"id": "8cWUJS0NExv35YHi",
"name": "OpenAi account"
}
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "d9b8e365-5baa-47e6-bafb-8b138266a6f7",
"connections": {
"323eb990-e7c4-4495-811a-a3c5b26c27f0": {
"main": [
[
{
"node": "aeb51aac-0706-4a0e-8a21-cc09147a6e87",
"type": "main",
"index": 0
}
]
]
},
"1659ef58-d317-4260-99a8-f1de50d50839": {
"ai_languageModel": [
[
{
"node": "aeb51aac-0706-4a0e-8a21-cc09147a6e87",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"7e8a17a4-fc57-4f8f-9755-3984547bfcce": {
"ai_outputParser": [
[
{
"node": "aeb51aac-0706-4a0e-8a21-cc09147a6e87",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"579d54f2-8c04-4624-890a-c432d96f3911": {
"main": [
[
{
"node": "cbb5c6a6-a445-474b-890f-54d1a546c28a",
"type": "main",
"index": 0
}
]
]
},
"79600a11-8038-48d7-a7a5-5c0ffdb6d412": {
"ai_languageModel": [
[
{
"node": "a548fcdd-1f5e-4a75-b136-07ecf4e96d3d",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"e0e0ef36-5a52-4d77-ba51-270693ce893f": {
"ai_languageModel": [
[
{
"node": "a107790b-f883-469e-8763-61ec92bf1d8e",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"cbb5c6a6-a445-474b-890f-54d1a546c28a": {
"main": [
[
{
"node": "a107790b-f883-469e-8763-61ec92bf1d8e",
"type": "main",
"index": 0
}
],
[
{
"node": "a548fcdd-1f5e-4a75-b136-07ecf4e96d3d",
"type": "main",
"index": 0
}
]
]
},
"a107790b-f883-469e-8763-61ec92bf1d8e": {
"main": [
[
{
"node": "d10724dd-406c-4143-9c22-2c3ecd45e6be",
"type": "main",
"index": 0
}
]
]
},
"a548fcdd-1f5e-4a75-b136-07ecf4e96d3d": {
"main": [
[
{
"node": "d10724dd-406c-4143-9c22-2c3ecd45e6be",
"type": "main",
"index": 0
}
]
]
},
"aeb51aac-0706-4a0e-8a21-cc09147a6e87": {
"main": [
[
{
"node": "579d54f2-8c04-4624-890a-c432d96f3911",
"type": "main",
"index": 0
}
]
]
}
}
}Comment utiliser ce workflow ?
Copiez le code de configuration JSON ci-dessus, créez un nouveau workflow dans votre instance n8n et sélectionnez "Importer depuis le JSON", collez la configuration et modifiez les paramètres d'authentification selon vos besoins.
Dans quelles scénarios ce workflow est-il adapté ?
Avancé - Support, Intelligence Artificielle
Est-ce payant ?
Ce workflow est entièrement gratuit et peut être utilisé directement. Veuillez noter que les services tiers utilisés dans le workflow (comme l'API OpenAI) peuvent nécessiter un paiement de votre part.
Workflows recommandés
Henry
@henryPartager ce workflow