Gmail-Slack
Ceci est uncontenant 18 nœuds.Utilise principalement des nœuds comme If, Gmail, Slack, Switch, Supabase. Système de routage de support par e-mail piloté par l'IA, intégrant Gmail, ChatGPT-4o et Slack
- •Compte Google et informations d'identification Gmail API
- •Token Bot Slack ou URL Webhook
- •URL et Clé API Supabase
- •Clé API OpenAI
Nœuds utilisés (18)
Catégorie
{
"id": "kKdyG8BnQcQ6re5y",
"meta": {
"instanceId": "2732eded2765378f6cf2f5b52f62e7fb00b915b94127de230672cb5f48ab5607"
},
"name": "Gmail-Slack",
"tags": [],
"nodes": [
{
"id": "254da1f8-b8e6-44fb-b526-fa8f4181e3fd",
"name": "Gmail Trigger",
"type": "n8n-nodes-base.gmailTrigger",
"position": [
-1248,
144
],
"parameters": {
"filters": {
"readStatus": "unread"
},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
}
},
"typeVersion": 1.3
},
{
"id": "a6929e80-8db0-4c8a-83b1-345f68b5d2bc",
"name": "Envoyer un message",
"type": "n8n-nodes-base.slack",
"position": [
0,
0
],
"webhookId": "9c5a999f-5d5a-4b88-8ded-b65178719a3f",
"parameters": {
"text": "=New support request received from {{ $('Gmail Trigger').item.json.From }}\nSubject: {{ $('Gmail Trigger').item.json.Subject }}\nContent: {{ $('Gmail Trigger').item.json.snippet }}\n",
"select": "channel",
"channelId": {
"__rl": true,
"mode": "list",
"value": "C09EVCZR4P6",
"cachedResultName": "support"
},
"otherOptions": {},
"authentication": "oAuth2"
},
"typeVersion": 2.3
},
{
"id": "5e546936-0738-4260-9d7a-cabdf09869bf",
"name": "Message a model",
"type": "@n8n/n8n-nodes-langchain.openAi",
"position": [
-560,
160
],
"parameters": {
"modelId": {
"__rl": true,
"mode": "list",
"value": "chatgpt-4o-latest",
"cachedResultName": "CHATGPT-4O-LATEST"
},
"options": {},
"messages": {
"values": [
{
"role": "system",
"content": "=You are an email triage classifier. Return ONLY a JSON object:\n{\"category\":\"support|new-request|enquiry|general|spam|other\"}"
},
{
"content": "=Subject: {{ $('Gmail Trigger').item.json.Subject }}\nContent: {{ $('Gmail Trigger').item.json.snippet }}"
}
]
},
"jsonOutput": true
},
"typeVersion": 1.8
},
{
"id": "bcbca08b-7d32-4f62-b543-bfb4c15e260c",
"name": "Créer une ligne",
"type": "n8n-nodes-base.supabase",
"position": [
256,
160
],
"parameters": {
"tableId": "threads",
"fieldsUi": {
"fieldValues": [
{
"fieldId": "thread_id",
"fieldValue": "={{ $('Gmail Trigger').item.json.threadId }}"
},
{
"fieldId": "first_message_id",
"fieldValue": "={{ $('Gmail Trigger').item.json.id }}"
},
{
"fieldId": "from_addr",
"fieldValue": "={{ $('Gmail Trigger').item.json.From }}"
},
{
"fieldId": "subject",
"fieldValue": "={{ $('Gmail Trigger').item.json.Subject }}"
}
]
}
},
"typeVersion": 1
},
{
"id": "a3a48ec5-5578-43f7-ae99-3c6785f090f7",
"name": "Obtenir une ligne",
"type": "n8n-nodes-base.supabase",
"position": [
-1040,
144
],
"parameters": {
"filters": {
"conditions": [
{
"keyName": "thread_id",
"keyValue": "={{ $json.threadId }}"
}
]
},
"tableId": "threads",
"operation": "get"
},
"typeVersion": 1,
"alwaysOutputData": true
},
{
"id": "fcae3538-c417-4f84-ac3b-f95bcc7fb4e5",
"name": "If",
"type": "n8n-nodes-base.if",
"position": [
-832,
144
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "7ff63d14-3ae6-4fa1-bfc4-dfa9df41b74f",
"operator": {
"type": "string",
"operation": "notEmpty",
"singleValue": true
},
"leftValue": "={{ $json.thread_id }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "6c8fbfa6-e0e1-461f-8c53-c2741e36090b",
"name": "Switch",
"type": "n8n-nodes-base.switch",
"position": [
-208,
160
],
"parameters": {
"rules": {
"values": [
{
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "7f361c76-9d64-4100-92f2-3176a77539ed",
"operator": {
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.message.content.category }}",
"rightValue": "support"
}
]
}
},
{
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "0996814e-5fd0-480f-92e1-9bb8b52d6649",
"operator": {
"name": "filter.operator.equals",
"type": "string",
"operation": "equals"
},
"leftValue": "={{ $json.message.content.category }}",
"rightValue": "new-request"
}
]
}
}
]
},
"options": {}
},
"typeVersion": 3.2
},
{
"id": "34441930-fdd6-49dd-8b04-f43f9f6831c9",
"name": "Marquer un message comme lu",
"type": "n8n-nodes-base.gmail",
"position": [
464,
160
],
"webhookId": "1d2a44fd-2cb2-4df6-a13b-2de752c6728b",
"parameters": {
"messageId": "={{ $('Gmail Trigger').item.json.id }}",
"operation": "markAsRead"
},
"typeVersion": 2.1
},
{
"id": "92d379d7-81e2-41d5-a927-1a8d3ad314ab",
"name": "Note adhésive",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1328,
-80
],
"parameters": {
"color": 4,
"width": 224,
"height": 192,
"content": "## 1. Gmail Trigger\n📬 Triggers whenever a new unread email arrives in the connected Gmail inbox.\n\n➡️ Sends email data (From, Subject, Snippet, Thread ID, etc.) to the next node."
},
"typeVersion": 1
},
{
"id": "14d334bf-cc9d-414a-a026-833ad0e00bd1",
"name": "Note adhésive1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1088,
-48
],
"parameters": {
"content": "## 2. Get a row (Supabase) \n🔍 Checks Supabase table “threads” to see if this email thread already exists."
},
"typeVersion": 1
},
{
"id": "d941485f-c582-450d-a55e-364dbeda6127",
"name": "Note adhésive2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-832,
-48
],
"parameters": {
"color": 2,
"content": "## 3. IF Node\n❓Decision point:\n\t•\tIf thread exists, stop (no duplicate processing).\n\t•\tIf thread does not exist, continue workflow."
},
"typeVersion": 1
},
{
"id": "ad5020dc-fe2a-46b1-b179-4f5dd0f20668",
"name": "Note adhésive3",
"type": "n8n-nodes-base.stickyNote",
"position": [
-576,
-80
],
"parameters": {
"color": 4,
"width": 256,
"height": 192,
"content": "## 4. Message a Model (OpenAI)\n🧠 Sends the email subject and snippet to ChatGPT (4o) to classify the email into a category:\nsupport | new-request | enquiry | general | spam | other"
},
"typeVersion": 1
},
{
"id": "4cf815f4-70ca-4bd9-a2ee-af021df944a6",
"name": "Note adhésive4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-304,
-80
],
"parameters": {
"color": 6,
"height": 192,
"content": "## 5. Switch\n🔀 Routes the email based on the category returned by ChatGPT:\n\t•\tIf “support” → send to #support channel.\n\t•\tIf “new-request” → send to #new-requests channel.\n"
},
"typeVersion": 1
},
{
"id": "b8f9c6ea-61a9-4be2-a4a0-29d90caa8cf6",
"name": "Envoyer un message 2",
"type": "n8n-nodes-base.slack",
"position": [
0,
256
],
"webhookId": "10c32a83-bd30-4296-82af-1b001bdeac92",
"parameters": {
"text": "=New request received from {{ $('Gmail Trigger').item.json.From }} Subject: {{ $('Gmail Trigger').item.json.Subject }} Content: {{ $('Gmail Trigger').item.json.snippet }}",
"select": "channel",
"channelId": {
"__rl": true,
"mode": "list",
"value": "C09EQ9Q1Z3R",
"cachedResultName": "new-requests"
},
"otherOptions": {},
"authentication": "oAuth2"
},
"typeVersion": 2.3
},
{
"id": "3fe1a77a-3feb-49a6-8941-1ab666bf6cc5",
"name": "Note adhésive5",
"type": "n8n-nodes-base.stickyNote",
"position": [
-48,
-240
],
"parameters": {
"color": 4,
"height": 208,
"content": "## 6. Send a Message (Slack)\n💬 Posts formatted message in the #support Slack channel:\n\n“New support request received from [email]. Subject: […]. Content: […]”"
},
"typeVersion": 1
},
{
"id": "3f4a8b97-9b38-4de8-8a51-e023b43a493f",
"name": "Note adhésive6",
"type": "n8n-nodes-base.stickyNote",
"position": [
-32,
416
],
"parameters": {
"color": 4,
"width": 256,
"height": 208,
"content": "## 7. Send a Message 2 (Slack)\n💬 Posts formatted message in the #new-requests Slack channel:\n\n“New request received from [email]. Subject: […]. Content: […]”"
},
"typeVersion": 1
},
{
"id": "5a3324e6-ab62-465d-8854-54c2cf59098d",
"name": "Note adhésive7",
"type": "n8n-nodes-base.stickyNote",
"position": [
208,
-64
],
"parameters": {
"color": 5,
"height": 192,
"content": "## 8. Create a Row (Supabase)\n🗃️ Adds a new record in the “threads” table:\nStores thread_id, first_message_id, from_addr, subject for future deduplication."
},
"typeVersion": 1
},
{
"id": "665325de-a9fb-4440-95b0-a1c197d79053",
"name": "Note adhésive8",
"type": "n8n-nodes-base.stickyNote",
"position": [
464,
-32
],
"parameters": {
"color": 7,
"content": "## 9. Mark a Message as Read (Gmail)\n✅ Marks the email as read in Gmail once it’s processed and saved."
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "04bdb1d8-234b-4623-a56c-f4c3593910c6",
"connections": {
"fcae3538-c417-4f84-ac3b-f95bcc7fb4e5": {
"main": [
[],
[
{
"node": "5e546936-0738-4260-9d7a-cabdf09869bf",
"type": "main",
"index": 0
}
]
]
},
"6c8fbfa6-e0e1-461f-8c53-c2741e36090b": {
"main": [
[
{
"node": "a6929e80-8db0-4c8a-83b1-345f68b5d2bc",
"type": "main",
"index": 0
}
],
[
{
"node": "b8f9c6ea-61a9-4be2-a4a0-29d90caa8cf6",
"type": "main",
"index": 0
}
]
]
},
"a3a48ec5-5578-43f7-ae99-3c6785f090f7": {
"main": [
[
{
"node": "fcae3538-c417-4f84-ac3b-f95bcc7fb4e5",
"type": "main",
"index": 0
}
]
]
},
"bcbca08b-7d32-4f62-b543-bfb4c15e260c": {
"main": [
[
{
"node": "34441930-fdd6-49dd-8b04-f43f9f6831c9",
"type": "main",
"index": 0
}
]
]
},
"254da1f8-b8e6-44fb-b526-fa8f4181e3fd": {
"main": [
[
{
"node": "a3a48ec5-5578-43f7-ae99-3c6785f090f7",
"type": "main",
"index": 0
}
]
]
},
"a6929e80-8db0-4c8a-83b1-345f68b5d2bc": {
"main": [
[
{
"node": "bcbca08b-7d32-4f62-b543-bfb4c15e260c",
"type": "main",
"index": 0
}
]
]
},
"5e546936-0738-4260-9d7a-cabdf09869bf": {
"main": [
[
{
"node": "6c8fbfa6-e0e1-461f-8c53-c2741e36090b",
"type": "main",
"index": 0
}
]
]
},
"b8f9c6ea-61a9-4be2-a4a0-29d90caa8cf6": {
"main": [
[
{
"node": "bcbca08b-7d32-4f62-b543-bfb4c15e260c",
"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é
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
Bohdan Saranchuk
@bosarAutomation consultant and founder of Bosar Agency. I help businesses integrate AI and automation into their workflows using tools like n8n, OpenAI, and custom-built solutions.
Partager ce workflow