Deuxième brouillon et envoi Gmail

Avancé

Ceci est unTicket Management, Multimodal AIworkflow d'automatisation du domainecontenant 18 nœuds.Utilise principalement des nœuds comme Gmail, Switch, GmailTrigger, Agent, LmChatGoogleGemini. Automatisation de la gestion des réponses e-mail intelligentes via Gemini AI et Gmail

Prérequis
  • Compte Google et informations d'identification Gmail API
  • Clé API Google Gemini
Aperçu du workflow
Visualisation des connexions entre les nœuds, avec support du zoom et du déplacement
Exporter le workflow
Copiez la configuration JSON suivante dans n8n pour importer et utiliser ce workflow
{
  "id": "yAmWWzUXTwmC6hPO",
  "meta": {
    "instanceId": "679a5e6996c7b87733ea9da67669642511fe2f1215d268a884919abfbd13ffdb",
    "templateCredsSetupCompleted": true
  },
  "name": "2nd gmail draft and send",
  "tags": [],
  "nodes": [
    {
      "id": "04005997-5f22-40f8-b1c5-8791b106d277",
      "name": "Signalement pour révision humaine",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -48,
        480
      ],
      "webhookId": "f391c634-6d29-44eb-b122-e40c93df2cd0",
      "parameters": {
        "message": "={{ $json.output }}",
        "options": {
          "sendTo": "={{ $('Get a message').item.json.from.value[0].address }}",
          "threadId": "={{ $('Get a message').item.json.threadId }}"
        },
        "subject": "={{ $('Get a message').item.json.subject }}",
        "resource": "draft"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "PuAE61pOClI4CRxE",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "57d5d8fd-3391-4af0-9305-2249d4885f5f",
      "name": "Déclencheur Gmail",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        -1648,
        240
      ],
      "parameters": {
        "simple": false,
        "filters": {},
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "PuAE61pOClI4CRxE",
          "name": "Gmail account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "55ee3c91-fa91-44eb-ad28-87c2a614f2a1",
      "name": "Modèle de chat Google Gemini",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -1168,
        416
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.5-flash-preview-05-20"
      },
      "credentials": {
        "googlePalmApi": {
          "id": "7X1ZyvDFg4ocTHrj",
          "name": "Google Gemini(PaLM) Api account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "af2b05c9-5229-4027-a514-0d210ea26fe7",
      "name": "Catégoriseur IA",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -1168,
        240
      ],
      "parameters": {
        "text": "=You are an AI assistant that drafts helpful email replies. For each incoming email, you will draft a reply and classify whether the email is 'simple' (can be auto-replied) or 'complex' (requires human review) or needs nothing to do.\n\nRules for classification:\n\n\nIf the email contains any sensitive topic (e.g: personal data such as biometric data, health records, racial or ethnic origin, religious or philosophical beliefs, political opinions, and sexual orientation, financial data (account numbers, credit card information), government identifiers (Social Security Numbers), and company-specific data such as trade secrets and strategic plans, etc.). classify it as \"draft\".\n\nAnd if the email does not contain any of the sensitive information and is a normal email and needs a reply, classify it as \"Reply\".\n\nAnd if an email does not contain any of the topic or information that does need reply (e.g, marketing or spam, automated notifications like \"do not reply\" emails or pickup alerts, transactional messages such as purchase receipts or account verification, and emails with no clear call to action that could bury important messages for recipients. In general, if a message is purely informational, doesn't ask for action, or is from an unknown source.) Classify it as \"Nothing\".\n\nProvide the Category Only: Respond with the category name and nothing else. Do not add any extra text, explanations, or commentary. Your response should be a single word. and you have 3 categories: \n\n1. Draft\n2. Reply\n3. Nothing\n\nHere is the Email:\n\n{{ $json.text }}",
        "options": {
          "batching": {
            "batchSize": 1,
            "delayBetweenBatches": 0
          },
          "passthroughBinaryImages": true,
          "returnIntermediateSteps": false
        },
        "promptType": "define"
      },
      "typeVersion": 2
    },
    {
      "id": "9a53a9bf-9665-4f5c-a0b9-74f5421509f5",
      "name": "Brouillon de chat Gemini",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -384,
        640
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.5-flash-preview-05-20"
      },
      "credentials": {
        "googlePalmApi": {
          "id": "7X1ZyvDFg4ocTHrj",
          "name": "Google Gemini(PaLM) Api account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "75bda556-8de8-462d-8ca6-a3fc30ca3436",
      "name": "Réponse de chat Gemini",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -384,
        192
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.5-flash-preview-05-20"
      },
      "credentials": {
        "googlePalmApi": {
          "id": "7X1ZyvDFg4ocTHrj",
          "name": "Google Gemini(PaLM) Api account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "5396f107-619c-426d-b759-ebece261871f",
      "name": "Aucune opération, ne rien faire",
      "type": "n8n-nodes-base.noOp",
      "position": [
        -688,
        560
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "dd50a20e-869e-4e9e-9c07-820be5fa9f95",
      "name": "Note adhésive",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1712,
        48
      ],
      "parameters": {
        "width": 448,
        "height": 400,
        "content": "## Gmail Trigger + Get a message\n\nPurpose: Watches Gmail for new incoming messages, then fetches the full details (ID, subject, text, threadId, sender).\n\nThis provides the input data that downstream AI nodes will analyze and act on."
      },
      "typeVersion": 1
    },
    {
      "id": "1c0fdd25-c89d-4ee8-a83e-7f0b455921e8",
      "name": "Obtenir un message",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -1424,
        240
      ],
      "webhookId": "b6b6ae33-af63-423a-b24d-70f9c8ccb73c",
      "parameters": {
        "simple": false,
        "options": {},
        "messageId": "={{ $json.id }}",
        "operation": "get"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "PuAE61pOClI4CRxE",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "09f432ed-6285-4147-92d5-2b645912098d",
      "name": "Note adhésive1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1232,
        -112
      ],
      "parameters": {
        "width": 400,
        "height": 704,
        "content": "## Google Gemini Chat Model + AI Categorizer\n\nPurpose: Uses Gemini to classify each email into one of three categories:\n\n⦿ Reply: normal emails needing an auto-response\n\n⦿ Draft: sensitive or complex emails that need human review\n\n⦿ Nothing: spam, automated notices, or irrelevant messages\nOnly the single word category is returned."
      },
      "typeVersion": 1
    },
    {
      "id": "53e0e46b-f29f-45d0-a417-df2fdf1f56bb",
      "name": "Note adhésive2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -800,
        -144
      ],
      "parameters": {
        "width": 320,
        "height": 608,
        "content": "## Reply, Draft, or Nothing (Switch)\n\nPurpose: Routes emails based on AI categorization:\n\n⦿ Reply → Generate Reply Email → Reply (auto-response sent immediately)\n\n⦿ Draft → Generate Draft Email → Flag for Human Review (reply is drafted but stored for human validation before sending)\n\n⦿ Nothing → No Operation (message ignored, nothing happens)"
      },
      "typeVersion": 1
    },
    {
      "id": "c4d14987-f859-4983-9adc-7e326554262c",
      "name": "Note adhésive3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -448,
        -240
      ],
      "parameters": {
        "width": 672,
        "height": 576,
        "content": "## Generate Email Reply + Gemini Chat Reply + Reply\n\nPurpose:\n\n⦿ Gemini writes a warm, professional final reply using the subject + body of the incoming message.\n\n⦿ Reply node sends this AI-written response directly back to the sender, keeping the thread intact."
      },
      "typeVersion": 1
    },
    {
      "id": "2664562a-abe4-4857-ab53-82b8726a57ce",
      "name": "Note adhésive4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -800,
        496
      ],
      "parameters": {
        "width": 320,
        "height": 400,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n## No Operation, do nothing\n\nPurpose: Handles the “Nothing” category gracefully. The workflow ends here without any email action."
      },
      "typeVersion": 1
    },
    {
      "id": "447df387-dbca-40eb-990e-2d22906a0447",
      "name": "Note adhésive5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -448,
        432
      ],
      "parameters": {
        "width": 672,
        "height": 592,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n## Generate Draft Email + Gemini Chat Draft + Flag for Human Review\n\nPurpose:\n\n⦿ Gemini drafts a professional reply in the same style, but does not send it.\n\n⦿ Draft is created in Gmail (with the sender and subject filled in).\n\n⦿ A human can then review/edit before sending. "
      },
      "typeVersion": 1
    },
    {
      "id": "6ec6fb16-1f87-408d-8bd2-9211384cea2b",
      "name": "Répondre, brouillon ou rien",
      "type": "n8n-nodes-base.switch",
      "position": [
        -736,
        224
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "68b68c40-f028-4431-9940-66543b04578a",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.output }}",
                    "rightValue": "Reply"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "7df0c8a2-3616-4e84-9af3-14a2e637cb7c",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.output }}",
                    "rightValue": "Draft"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "799f30a4-15c6-45cb-8617-d9e2fe148536",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.output }}",
                    "rightValue": "Nothing"
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "a4e6e81d-de73-4562-b37e-dfab96ba5fc4",
      "name": "Générer un brouillon d'e-mail",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -384,
        480
      ],
      "parameters": {
        "text": "=Reply to the email I give you in a warm, polite, and professional tone. Write like a thoughtful human—use natural phrasing, gentle transitions, and avoid robotic or overly formal wording. Address all points clearly, keep it concise, and maintain a friendly, respectful feel. Reply must be easy to read. and don't output subject line, only output the reply. My name is hashir. must keep an eye on one thing, don't add in the reply anything like this \"[Your Company Name]\" etc. its a final reply so don't add anything that that needs any manual addition or editing. Output the final reply.\n\nHere is the Subject line: {{ $('Get a message').item.json.headers.subject }}\n\nHere is the Email:\n\n{{ $('Get a message').item.json.text }}",
        "options": {
          "batching": {
            "batchSize": 1,
            "delayBetweenBatches": 0
          },
          "passthroughBinaryImages": true,
          "returnIntermediateSteps": false
        },
        "promptType": "define"
      },
      "typeVersion": 2
    },
    {
      "id": "65df0884-ef4d-483b-a8d4-a9ba0e252f94",
      "name": "Générer une réponse par e-mail",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -384,
        32
      ],
      "parameters": {
        "text": "=Reply to the email I give you in a warm, polite, and professional tone. Write like a thoughtful human—use natural phrasing, gentle transitions, and avoid robotic or overly formal wording. Address all points clearly, keep it concise, and maintain a friendly, respectful feel. Reply must be easy to read. and don't output subject line, only output the reply. My name is hashir. must keep an eye on one thing, don't add in the reply anything like this \"[Your Company Name]\" etc. its a final reply so don't add anything that needs any manual addition or editing. Output the final reply.\n\nHere is the Subject line: {{ $('Get a message').item.json.headers.subject }}\n\nHere is the Email:\n\n{{ $('Get a message').item.json.text }}",
        "options": {
          "passthroughBinaryImages": true,
          "returnIntermediateSteps": false
        },
        "promptType": "define"
      },
      "typeVersion": 2
    },
    {
      "id": "f45ae81c-8201-46cd-ba7f-955b69070108",
      "name": "Répondre à l'e-mail",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -96,
        32
      ],
      "webhookId": "4729862b-1009-44e9-a631-9b6651d34d0f",
      "parameters": {
        "message": "={{ $json.output }}",
        "options": {
          "appendAttribution": true,
          "replyToSenderOnly": false
        },
        "emailType": "text",
        "messageId": "={{ $('Get a message').item.json.id }}",
        "operation": "reply"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "PuAE61pOClI4CRxE",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    }
  ],
  "active": true,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "82f0e737-89c4-45cd-b18c-2d01f85218da",
  "connections": {
    "1c0fdd25-c89d-4ee8-a83e-7f0b455921e8": {
      "main": [
        [
          {
            "node": "af2b05c9-5229-4027-a514-0d210ea26fe7",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "57d5d8fd-3391-4af0-9305-2249d4885f5f": {
      "main": [
        [
          {
            "node": "1c0fdd25-c89d-4ee8-a83e-7f0b455921e8",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "af2b05c9-5229-4027-a514-0d210ea26fe7": {
      "main": [
        [
          {
            "node": "6ec6fb16-1f87-408d-8bd2-9211384cea2b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "9a53a9bf-9665-4f5c-a0b9-74f5421509f5": {
      "ai_languageModel": [
        [
          {
            "node": "a4e6e81d-de73-4562-b37e-dfab96ba5fc4",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "75bda556-8de8-462d-8ca6-a3fc30ca3436": {
      "ai_languageModel": [
        [
          {
            "node": "65df0884-ef4d-483b-a8d4-a9ba0e252f94",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "a4e6e81d-de73-4562-b37e-dfab96ba5fc4": {
      "main": [
        [
          {
            "node": "04005997-5f22-40f8-b1c5-8791b106d277",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "65df0884-ef4d-483b-a8d4-a9ba0e252f94": {
      "main": [
        [
          {
            "node": "f45ae81c-8201-46cd-ba7f-955b69070108",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "55ee3c91-fa91-44eb-ad28-87c2a614f2a1": {
      "ai_languageModel": [
        [
          {
            "node": "af2b05c9-5229-4027-a514-0d210ea26fe7",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "6ec6fb16-1f87-408d-8bd2-9211384cea2b": {
      "main": [
        [
          {
            "node": "65df0884-ef4d-483b-a8d4-a9ba0e252f94",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "a4e6e81d-de73-4562-b37e-dfab96ba5fc4",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "5396f107-619c-426d-b759-ebece261871f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Foire aux questions

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, IA Multimodale

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

Surveiller la classification des e-mails et envoyer des réponses en utilisant GPT-4o et gotoHuman
Surveiller le classement des e-mails, envoyer des réponses en utilisant GPT-4o et gotoHuman
Set
Gmail
Switch
+
Set
Gmail
Switch
24 NœudsgotoHuman
Gestion des tickets
Assistant Gmail avec classification Google Gemini et notifications Telegram
Assistant Gmail avec classification par Google Gemini et notifications Telegram
If
Gmail
Switch
+
If
Gmail
Switch
25 NœudsRoshan Ramani
Chatbot IA
Répondre automatiquement aux e-mails Gmail et créer des tickets Linear en utilisant GPT-5, gotoHuman et une vérification humaine
Répondre automatiquement aux e-mails de Gmail et créer des tickets Linear en utilisant GPT-5, gotoHuman et une révision humaine
Set
Code
Gmail
+
Set
Code
Gmail
37 NœudsgotoHuman
Gestion des tickets
🛃 Gestionnaire de boîte de réception
Système automatisé de gestion des e-mails avec GPT-5, multi-agents IA et base de données Pinecone
If
Gmail
Switch
+
If
Gmail
Switch
41 NœudsZawanah
Gestion des tickets
Processus de vente B2B complet : Génération de prospects Apollo, externalisation avec Mailgun et gestion des réponses IA
Processus de vente B2B complet : Génération de prospects Apollo, prospection Mailgun et gestion des réponses AI
If
Set
Code
+
If
Set
Code
116 NœudsPaul
Création de contenu
Génération et publication de contenu LinkedIn via des agents IA et l'API Chat Gemini
Machine à contenu LinkedIn : génération de publications approuvées par e-mail via Gemini AI
Set
Code
Gmail
+
Set
Code
Gmail
43 NœudsParag Javale
IA Multimodale
Informations sur le workflow
Niveau de difficulté
Avancé
Nombre de nœuds18
Catégorie2
Types de nœuds7
Description de la difficulté

Adapté aux utilisateurs avancés, avec des workflows complexes contenant 16+ nœuds

Liens externes
Voir sur n8n.io

Partager ce workflow

Catégories

Catégories: 34