Système intelligent de réponse automatique et de classification pour Gmail
Ceci est unTicket Management, AI Summarizationworkflow d'automatisation du domainecontenant 18 nœuds.Utilise principalement des nœuds comme Gmail, GmailTrigger, GoogleSheets, OpenAi, LmChatOpenAi. Classification de courriel et réponse automatique Gmail, utilisant GPT-4o et Google Sheets
- •Compte Google et informations d'identification Gmail API
- •Informations d'identification Google Sheets API
- •Clé API OpenAI
Nœuds utilisés (18)
Catégorie
{
"id": "6MZqIrk7nB6lc4vB",
"meta": {
"instanceId": "15d6057a37b8367f33882dd60593ee5f6cc0c59310ff1dc66b626d726083b48d",
"templateCredsSetupCompleted": true
},
"name": "Gmail Auto Reply & Categorization with AI",
"tags": [],
"nodes": [
{
"id": "9f88a550-a517-4362-a71f-b7997b9c75fa",
"name": "Gmail Trigger",
"type": "n8n-nodes-base.gmailTrigger",
"position": [
-272,
0
],
"parameters": {
"simple": false,
"filters": {},
"options": {},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
}
},
"credentials": {
"gmailOAuth2": {
"id": "NdoEDipkhQPaRDuy",
"name": "Gmail account 6"
}
},
"typeVersion": 1.2
},
{
"id": "faf382e9-f898-447f-b5a1-d7a8c28d2309",
"name": "Classificateur de texte",
"type": "@n8n/n8n-nodes-langchain.textClassifier",
"position": [
-96,
-32
],
"parameters": {
"options": {},
"inputText": "={{ $json.text }}",
"categories": {
"categories": [
{
"category": "High Priority",
"description": "Description: Emails that require immediate attention and could have a serious impact if delayed. Typical examples include: system outages, security alerts, critical legal notices, or urgent requests from executives or key clients. Examples: '[URGENT] Service outage notice', '[IMPORTANT] Contract renewal deadline'"
},
{
"category": "Advertisement",
"description": "Description: Marketing or promotional emails that do not require an immediate response. Typical examples include: sales announcements, product launches, newsletters, and event invitations. Examples: '[LIMITED OFFER] 50% off campaign', 'New service release announcement'"
},
{
"category": "Inquiry",
"description": "Description: Customer or partner inquiries that require a reply or follow-up. Typical examples include: product or service questions, quote requests, reservations, troubleshooting, repair or refund requests. Examples: 'Inquiry about studio reservation', 'Request for quotation'"
},
{
"category": "Finance/Billing",
"description": "Description: Emails related to payments, invoices, or financial transactions. Typical examples include: invoices, receipts, payment confirmations, bank or accounting notifications, and tax-related documents. Examples: 'Invoice submission notice', '[Payment confirmed] Thank you for your payment'"
}
]
}
},
"typeVersion": 1.1
},
{
"id": "aaddb0e0-fd5f-49ab-8887-f3ecc5bd9d89",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
-96,
208
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini"
},
"options": {
"maxRetries": 1
}
},
"credentials": {
"openAiApi": {
"id": "WBKhlscRuBMQi56k",
"name": "OpenAi account 4"
}
},
"typeVersion": 1.2
},
{
"id": "52265538-92f0-45b9-a7e8-78ba934620cf",
"name": "Enregistrer le courrier prioritaire",
"type": "n8n-nodes-base.gmail",
"position": [
432,
-240
],
"webhookId": "18f19ef8-a4ec-4b1f-b3c6-4a9e7165eaff",
"parameters": {
"labelIds": [
"Label_6395372519299544115"
],
"messageId": "={{ $json.id }}",
"operation": "addLabels"
},
"credentials": {
"gmailOAuth2": {
"id": "NdoEDipkhQPaRDuy",
"name": "Gmail account 6"
}
},
"typeVersion": 2.1
},
{
"id": "a3ac1d27-05ca-4832-bee9-176899915b27",
"name": "Enregistrer le courrier publicitaire",
"type": "n8n-nodes-base.gmail",
"position": [
432,
-48
],
"webhookId": "18f19ef8-a4ec-4b1f-b3c6-4a9e7165eaff",
"parameters": {
"labelIds": [
"Label_2877175876700118240"
],
"messageId": "={{ $json.id }}",
"operation": "addLabels"
},
"credentials": {
"gmailOAuth2": {
"id": "NdoEDipkhQPaRDuy",
"name": "Gmail account 6"
}
},
"typeVersion": 2.1
},
{
"id": "696b4433-3093-436c-b98d-2f910858823e",
"name": "Enregistrer le courrier de demande",
"type": "n8n-nodes-base.gmail",
"position": [
432,
144
],
"webhookId": "18f19ef8-a4ec-4b1f-b3c6-4a9e7165eaff",
"parameters": {
"labelIds": [
"Label_8971387974199578288"
],
"messageId": "={{ $json.id }}",
"operation": "addLabels"
},
"credentials": {
"gmailOAuth2": {
"id": "NdoEDipkhQPaRDuy",
"name": "Gmail account 6"
}
},
"typeVersion": 2.1
},
{
"id": "68f89db1-59b8-4b15-8ac6-52354a28093a",
"name": "Enregistrer le courrier financier",
"type": "n8n-nodes-base.gmail",
"position": [
432,
336
],
"webhookId": "18f19ef8-a4ec-4b1f-b3c6-4a9e7165eaff",
"parameters": {
"labelIds": [
"Label_7818902445747119871"
],
"messageId": "={{ $json.id }}",
"operation": "addLabels"
},
"credentials": {
"gmailOAuth2": {
"id": "NdoEDipkhQPaRDuy",
"name": "Gmail account 6"
}
},
"typeVersion": 2.1
},
{
"id": "cdb0c68f-e041-47ef-b65e-14e2c476a760",
"name": "Générer un brouillon prioritaire",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
640,
-240
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o",
"cachedResultName": "GPT-4O"
},
"options": {},
"messages": {
"values": [
{
"content": "=You are an executive assistant. \nYour task is to reply accurately to high-priority incoming emails. \nHere is the email you need to respond to: {{ $('Gmail Trigger').item.json.text }} \n\nPlease output the following parameters:\n- Subject \n- Message\n"
}
]
},
"jsonOutput": true
},
"credentials": {
"openAiApi": {
"id": "lHkSeZk3nuftEHri",
"name": "デモ"
}
},
"executeOnce": false,
"typeVersion": 1.8,
"alwaysOutputData": false
},
{
"id": "a59b0fc2-b11e-4e9c-a5c6-b5aa33f85bac",
"name": "Générer un résumé publicitaire",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
640,
-48
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o",
"cachedResultName": "GPT-4O"
},
"options": {},
"messages": {
"values": [
{
"content": "=You are a marketing specialist. \nYour task is to summarize incoming promotional or marketing emails concisely in 1–2 lines for spreadsheet logging. \n\nHere is the received email: {{ $('Gmail Trigger').item.json.text }}\n\nPlease extract and summarize the following fields:\n- Sender \n- Subject \n- Summary \n- Recommendation\n"
}
]
},
"jsonOutput": true
},
"credentials": {
"openAiApi": {
"id": "WBKhlscRuBMQi56k",
"name": "OpenAi account 4"
}
},
"executeOnce": false,
"typeVersion": 1.8,
"alwaysOutputData": false
},
{
"id": "64f4df61-ee88-4ea0-857f-7d738c2f3c21",
"name": "Générer un résumé financier",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
640,
144
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o",
"cachedResultName": "GPT-4O"
},
"options": {},
"messages": {
"values": [
{
"content": "=You are a customer service representative. \nYour task is to reply accurately to customer inquiries. \nIf the question cannot be answered, instruct the sender to contact the following number: 000-0000-000. \n\nHere is the email you need to respond to: {{ $('Gmail Trigger').item.json.text }}\n\nPlease output the following parameters:\n- Subject \n- Message\n"
}
]
},
"jsonOutput": true
},
"credentials": {
"openAiApi": {
"id": "WBKhlscRuBMQi56k",
"name": "OpenAi account 4"
}
},
"executeOnce": false,
"typeVersion": 1.8,
"alwaysOutputData": false
},
{
"id": "a8df46ff-73f7-4129-94cb-0f452b328716",
"name": "Générer une réponse aux demandes",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
640,
336
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "gpt-4o",
"cachedResultName": "GPT-4O"
},
"options": {},
"messages": {
"values": [
{
"content": "=You are a finance and billing assistant. \nYour task is to summarize emails related to invoices, payments, and financial notifications in a concise manner. \n\nHere is the received email: {{ $('Gmail Trigger').item.json.text }}\n\nPlease output the following parameters:\n- Subject \n- Message\n"
}
]
},
"jsonOutput": true
},
"credentials": {
"openAiApi": {
"id": "WBKhlscRuBMQi56k",
"name": "OpenAi account 4"
}
},
"executeOnce": false,
"typeVersion": 1.8,
"alwaysOutputData": false
},
{
"id": "ef15e762-463f-4acd-9c38-cb84735c9feb",
"name": "Créer un brouillon",
"type": "n8n-nodes-base.gmail",
"position": [
992,
-240
],
"webhookId": "e203a0df-3a0f-48fc-9581-684beb49c073",
"parameters": {
"message": "={{ $json.message.content['message'] }}",
"options": {},
"subject": "={{ $json.message.content['send'] }}",
"resource": "draft"
},
"credentials": {
"gmailOAuth2": {
"id": "NdoEDipkhQPaRDuy",
"name": "Gmail account 6"
}
},
"typeVersion": 2.1
},
{
"id": "45aa5109-f0c2-43e7-a91a-db0fcc109cc7",
"name": "Ajouter une ligne à la feuille",
"type": "n8n-nodes-base.googleSheets",
"position": [
992,
-48
],
"parameters": {
"columns": {
"value": {
"Sender": "={{ $json.message.content['Sender'] }}",
"Subject": "={{ $json.message.content['Subject'] }}",
"Summary": "={{ $json.message.content['Summary'] }}",
"Recommendation": "={{ $json.message.content['Recommendation'] }}"
},
"schema": [
{
"id": "Sender",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Sender",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Subject",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Subject",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Summary",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Summary",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "Recommendation",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "Recommendation",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/13AmknC94wJ5n1FDl7E1yUFsCNYVDJklzPpTZmFQrMb4/edit#gid=0",
"cachedResultName": "01_Advertisement Mail Summary"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "13AmknC94wJ5n1FDl7E1yUFsCNYVDJklzPpTZmFQrMb4",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/13AmknC94wJ5n1FDl7E1yUFsCNYVDJklzPpTZmFQrMb4/edit?usp=drivesdk",
"cachedResultName": "[n8n] Advertisement Mail Summary"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "Ja0tGvoFNudNwqMM",
"name": "md83 H2"
}
},
"typeVersion": 4.6
},
{
"id": "6701a84f-2e2a-42f2-9c98-fb7ee3f394f1",
"name": "Envoyer le courrier financier",
"type": "n8n-nodes-base.gmail",
"position": [
992,
144
],
"webhookId": "0256a9d5-e87f-499e-98c4-ced9e9b6f204",
"parameters": {
"message": "={{ $json.message.content['message'] }}",
"options": {},
"resource": "thread",
"threadId": "={{ $('Save Inquiry Mail').item.json.threadId }}",
"messageId": "={{ $('Save Inquiry Mail').item.json.id }}",
"operation": "reply"
},
"credentials": {
"gmailOAuth2": {
"id": "NdoEDipkhQPaRDuy",
"name": "Gmail account 6"
}
},
"typeVersion": 2.1
},
{
"id": "89129a16-1f1a-48e4-82f1-0593c142909b",
"name": "Répondre à la demande",
"type": "n8n-nodes-base.gmail",
"position": [
992,
336
],
"webhookId": "01d72fbe-d12c-4992-9977-7aa4316e0af0",
"parameters": {
"sendTo": "{{YOUR_EMAIL_ADDRESS}}",
"message": "={{ $json.message.content['message'] }}",
"options": {},
"subject": "={{ $json.message.content['send'] }}"
},
"credentials": {
"gmailOAuth2": {
"id": "NdoEDipkhQPaRDuy",
"name": "Gmail account 6"
}
},
"typeVersion": 2.1
},
{
"id": "6f1a41f5-ad3e-4b4b-906d-44a20bbe0623",
"name": "Note adhésive",
"type": "n8n-nodes-base.stickyNote",
"position": [
1264,
-304
],
"parameters": {
"width": 416,
"height": 880,
"content": "## 📩Gmail Auto Reply & Categorization with AI (LangChain + OpenAI + Google Sheets)\n\n**Description:**\nThis workflow automatically categorizes incoming Gmail messages into four types — High Priority, Advertisement, Inquiry, and Finance/Billing — using the LangChain Text Classifier.\nEach category triggers a specific automated action powered by OpenAI GPT models:\n\n🟥 High Priority: Generates an AI-written draft reply in Gmail.\n\n🟨 Advertisement: Summarizes the content and logs it to Google Sheets.\n\n🟩 Inquiry: Creates an auto-reply email with fallback instructions.\n\n🟦 Finance/Billing: Generates a brief summary and forwards it to a designated address.\n\nThis setup combines Gmail + LangChain + OpenAI + Google Sheets for a complete AI-driven email management system that reduces manual sorting and response time.\n\n**Setup Instructions:**\n\nConnect your credentials for Gmail, Google Sheets, and OpenAI.\n\nReplace all placeholders such as {{YOUR_EMAIL_ADDRESS}}, {{YOUR_SPREADSHEET_ID}}, and label names with your actual values.\n\nMake sure you have Gmail labels created for “Advertisement,” “Inquiry,” etc.\n\n(Optional) Translate prompts back to your language if needed.\n"
},
"typeVersion": 1
},
{
"id": "49d044e4-0a1c-4fff-b205-77d43db01251",
"name": "Note adhésive1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-336,
-176
],
"parameters": {
"color": 2,
"width": 512,
"height": 496,
"content": "## ①Receive Gmail → AI understands the email content\nIncoming emails are analyzed by AI and automatically categorized into four sections: High Priority, Advertisement, Inquiry, and Finance/Billing."
},
"typeVersion": 1
},
{
"id": "904ff69b-74bc-4c26-aa3d-5af797548e7e",
"name": "Note adhésive2",
"type": "n8n-nodes-base.stickyNote",
"position": [
272,
-624
],
"parameters": {
"width": 960,
"height": 1200,
"content": "## ②Email Processing Section\n**Flow Overview:**\nThis workflow automatically classifies all incoming Gmail messages into four categories using the LangChain Text Classifier and performs specific actions for each:\n\n🟥 High Priority: Gmail adds a “High Priority” label → OpenAI generates a reply draft → saved as a Gmail draft.\n\n🟨 Advertisement: AI summarizes the email → summary is recorded into a Google Sheet for later review.\n\n🟩 Inquiry: AI generates an automatic customer reply → sends a polite response or fallback message.\n\n🟦 Finance/Billing: AI creates a short summary of financial or billing-related content → forwards it to a designated email address.\n\n**Purpose:**\nThe system ensures that each type of incoming email is handled automatically and intelligently: urgent messages are drafted quickly, promotional content is logged, customer inquiries are answered promptly, and financial communications are safely redirected — all through a single AI-powered workflow."
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "fa5d38ad-f0cb-4b9a-962d-295da7453ed7",
"connections": {
"9f88a550-a517-4362-a71f-b7997b9c75fa": {
"main": [
[
{
"node": "faf382e9-f898-447f-b5a1-d7a8c28d2309",
"type": "main",
"index": 0
}
]
]
},
"faf382e9-f898-447f-b5a1-d7a8c28d2309": {
"main": [
[
{
"node": "52265538-92f0-45b9-a7e8-78ba934620cf",
"type": "main",
"index": 0
}
],
[
{
"node": "a3ac1d27-05ca-4832-bee9-176899915b27",
"type": "main",
"index": 0
}
],
[
{
"node": "696b4433-3093-436c-b98d-2f910858823e",
"type": "main",
"index": 0
}
],
[
{
"node": "68f89db1-59b8-4b15-8ac6-52354a28093a",
"type": "main",
"index": 0
}
]
]
},
"aaddb0e0-fd5f-49ab-8887-f3ecc5bd9d89": {
"ai_languageModel": [
[
{
"node": "faf382e9-f898-447f-b5a1-d7a8c28d2309",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"68f89db1-59b8-4b15-8ac6-52354a28093a": {
"main": [
[
{
"node": "a8df46ff-73f7-4129-94cb-0f452b328716",
"type": "main",
"index": 0
}
]
]
},
"696b4433-3093-436c-b98d-2f910858823e": {
"main": [
[
{
"node": "64f4df61-ee88-4ea0-857f-7d738c2f3c21",
"type": "main",
"index": 0
}
]
]
},
"52265538-92f0-45b9-a7e8-78ba934620cf": {
"main": [
[
{
"node": "cdb0c68f-e041-47ef-b65e-14e2c476a760",
"type": "main",
"index": 0
}
]
]
},
"a59b0fc2-b11e-4e9c-a5c6-b5aa33f85bac": {
"main": [
[
{
"node": "45aa5109-f0c2-43e7-a91a-db0fcc109cc7",
"type": "main",
"index": 0
}
]
]
},
"a8df46ff-73f7-4129-94cb-0f452b328716": {
"main": [
[
{
"node": "89129a16-1f1a-48e4-82f1-0593c142909b",
"type": "main",
"index": 0
}
]
]
},
"cdb0c68f-e041-47ef-b65e-14e2c476a760": {
"main": [
[
{
"node": "ef15e762-463f-4acd-9c38-cb84735c9feb",
"type": "main",
"index": 0
}
]
]
},
"a3ac1d27-05ca-4832-bee9-176899915b27": {
"main": [
[
{
"node": "a59b0fc2-b11e-4e9c-a5c6-b5aa33f85bac",
"type": "main",
"index": 0
}
]
]
},
"64f4df61-ee88-4ea0-857f-7d738c2f3c21": {
"main": [
[
{
"node": "6701a84f-2e2a-42f2-9c98-fb7ee3f394f1",
"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é - Gestion des tickets, Résumé IA
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
Partager ce workflow