Automatisation des e-mails pour les transactions de parrainage
Ceci est unAI Summarization, Multimodal AIworkflow d'automatisation du domainecontenant 16 nœuds.Utilise principalement des nœuds comme If, Set, Gmail, GmailTrigger, Agent. Automatiser la réponse aux e-mails de transactions parrainées avec Gmail et GPT-4
- •Compte Google et informations d'identification Gmail API
- •Clé API OpenAI
Nœuds utilisés (16)
Catégorie
{
"id": "Kb8GjaSSiC75Pcdk",
"meta": {
"instanceId": "87616dfce72ffd690a51f4d408ac3b27a946f12a1119e0e281f5ed271497219e",
"templateCredsSetupCompleted": true
},
"name": "Email Automation for Sponsored Deals",
"tags": [],
"nodes": [
{
"id": "26059112-67e7-4a81-b187-70dcbf8ff44f",
"name": "Déclencheur Gmail",
"type": "n8n-nodes-base.gmailTrigger",
"position": [
-440,
-100
],
"parameters": {
"simple": false,
"filters": {},
"options": {},
"pollTimes": {
"item": [
{
"mode": "everyMinute"
}
]
}
},
"credentials": {
"gmailOAuth2": {
"id": "qRfscNFGDLVMQs6g",
"name": "Gmail account"
}
},
"typeVersion": 1.2
},
{
"id": "fbcb4645-50d3-4e2c-9c27-8c89333f39db",
"name": "Edit Fields",
"type": "n8n-nodes-base.set",
"position": [
-220,
-100
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "d78ea8f1-65f1-4cb6-bb27-c652a5a63d94",
"name": "From",
"type": "string",
"value": "={{ $json.headers.from }}"
},
{
"id": "1b4a5b47-5057-4ac2-9e03-f3bb0d98134b",
"name": "Subject",
"type": "string",
"value": "={{ $json.subject }}"
},
{
"id": "f9968f70-b3a0-4000-9a64-c6504317eeff",
"name": "Email_Body",
"type": "string",
"value": "={{ $json.text }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "1ecfa39b-9749-4364-96af-f4d5db5486c6",
"name": "Agent IA",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
-20,
-100
],
"parameters": {
"text": "=# System Prompt for Sponsored Email Detection Agent\n\n## Role\nYou are an **Email Sentiment & Sponsorship Detection Agent**. \nYour primary task is to analyze incoming emails, determine if they are **sponsored emails**, identify the sender’s **intention**, and return results in a structured JSON format. \n\n---\n\n## Behavior\n- Always be **objective and concise**. \n- Never provide extra explanations outside the defined output format. \n- Focus strictly on analyzing **email content, tone, and intent**. \n\n---\n\n## Output Format\nAlways respond in **Markdown** using the following JSON structure: \n\n```json\n{\n \"isSponsoredEmail\": true/false,\n \"reason\": \"Concise explanation of why you classified it this way\"\n}\n\n\n {{ $json.Email_Body }}",
"options": {},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 2
},
{
"id": "7d9b4d22-b83a-43c6-b2d1-081c12771d56",
"name": "Modèle de chat OpenAI",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
-100,
120
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "qlhg6EzexBZ9bwXO",
"name": "OpenAi account"
}
},
"typeVersion": 1.2
},
{
"id": "b251365d-8bff-441e-8ab3-250ba216bac3",
"name": "Structured Output Parser",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
160,
200
],
"parameters": {
"schemaType": "manual",
"inputSchema": "{\n\t\"type\": \"object\",\n\t\"properties\": {\n\t\t\"isSponsoredEmail\": {\n\t\t\t\"type\": \"boolean\"\n\t\t},\n\t\t\"reason\": {\n\t\t\t\"type\": \"string\"\t\t\t\n\t\t}\n\t}\n}"
},
"typeVersion": 1.2
},
{
"id": "dc80f4ae-c9dd-4847-8142-b34598ee7f2c",
"name": "If",
"type": "n8n-nodes-base.if",
"position": [
360,
-100
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "a4ad6006-2906-4101-b106-d232132206fd",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $json.output.isSponsoredEmail }}",
"rightValue": "true"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "e089a21d-712d-4c85-991a-6a751ab6361f",
"name": "Aucune opération, do nothing",
"type": "n8n-nodes-base.noOp",
"position": [
680,
100
],
"parameters": {},
"typeVersion": 1
},
{
"id": "e27b672a-3cc6-45d7-a7b8-80f56e1c1c87",
"name": "Agent IA1",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
680,
-380
],
"parameters": {
"text": "=#Role\nYou are a professional and courteous email assistant responding on behalf of [Your Company Name]. You've just received a sponsored email offer. Please read the email content and draft a polite, professional reply informing the sender that while you appreciate their interest, your company is not currently accepting sponsored content.\n\nKindly explain that you have specific criteria that must be met before considering sponsorships, such as alignment with your brand values, audience relevance, and internal planning cycles. Offer to keep their information on file and encourage them to reach out in the future when sponsorship opportunities reopen.\n\nMaintain a friendly tone, express gratitude for their outreach, and do not close the door completely. End with a courteous sign-off.\n\n# Prepare Email body as below. \nHello,\n\nThank you for your interest in collaborating with [Your Company Name]. We truly appreciate the time and effort you’ve taken to reach out to us.\n\nWe do occasionally accept sponsored content, provided it meets a few important criteria that ensure value and relevance for our audience. Specifically, we look for partnerships that: \n\n1. **Align with Our Brand Values** – The content should reflect the professionalism, integrity, and focus areas of our company. \n2. **Serve Our Audience** – Sponsored material should provide clear benefits, insights, or solutions that are relevant and meaningful to our community. \n3. **Complement Our Planning Cycles** – We accept sponsored opportunities at select times during the year to align with our editorial calendar and campaign schedule. \n\nIf your offer meets these guidelines, we’d be glad to explore the possibility further. Please feel free to share details about your proposal, including the nature of the content, target audience, and how it aligns with the values above. \n\nWe carefully review all opportunities and will respond with next steps if there’s a good fit. Even if the timing isn’t right, we’re happy to keep your information on file for future consideration. \n\nThank you again for thinking of [Your Company Name]. We look forward to staying connected. \n\nWarm regards, \n[Your Name] \n[Your Company Name] \n\n\n\nEmail Details are as below:\n{{ $('Gmail Trigger').item.json.headers.from }}\n{{ $('Gmail Trigger').item.json.headers.subject }}\n{{ $('Gmail Trigger').item.json.text }}\n\nNote: just prepare the email body and do not include message headers. ",
"options": {},
"promptType": "define"
},
"typeVersion": 2
},
{
"id": "e74356b8-3f5f-440c-81d8-9f62ec468711",
"name": "Modèle de chat OpenAI1",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
680,
-120
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4o-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "qlhg6EzexBZ9bwXO",
"name": "OpenAi account"
}
},
"typeVersion": 1.2
},
{
"id": "a0edd387-37ee-4ad6-b12f-9c1b5005f6ba",
"name": "Gmail",
"type": "n8n-nodes-base.gmail",
"position": [
1180,
-380
],
"webhookId": "0167c16b-b9fd-41e1-850e-8274c27dd4bb",
"parameters": {
"message": "={{ $json.output }}",
"options": {},
"emailType": "text",
"messageId": "={{ $('Gmail Trigger').item.json.id }}",
"operation": "reply"
},
"credentials": {
"gmailOAuth2": {
"id": "qRfscNFGDLVMQs6g",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "8579055e-fca8-4b96-a02f-b41251841d16",
"name": "Note adhésive",
"type": "n8n-nodes-base.stickyNote",
"position": [
-620,
-300
],
"parameters": {
"width": 300,
"height": 360,
"content": "## Email Trigger\nRead inbox every minute and then send to next node for Analysis"
},
"typeVersion": 1
},
{
"id": "b5f4a066-8ee7-4fbc-a627-59b1f199647c",
"name": "Note adhésive1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-300,
-260
],
"parameters": {
"width": 260,
"height": 320,
"content": "## Extract\n- Header\n- Subject\n- EmailBody"
},
"typeVersion": 1
},
{
"id": "36ff7139-a3fe-40d5-ae61-30ee62910207",
"name": "Note adhésive2",
"type": "n8n-nodes-base.stickyNote",
"position": [
80,
-340
],
"parameters": {
"color": 4,
"width": 360,
"height": 220,
"content": "## Process and validate Confirm If Sponsored \n\n- The AI agent will read through the email and confirm if the email is an sponsored email or not.\n- It then pass this boolean to If Else node."
},
"typeVersion": 1
},
{
"id": "ce10097e-b873-4bfe-8171-3b86c7d2c0d5",
"name": "Note adhésive3",
"type": "n8n-nodes-base.stickyNote",
"position": [
500,
-560
],
"parameters": {
"color": 6,
"width": 440,
"content": "## Prepare Email Body \n- This node will prepare email body with company policies on accepting any sponsored deals."
},
"typeVersion": 1
},
{
"id": "7da70e7a-8805-4426-a639-afffc41bd1b6",
"name": "Note adhésive4",
"type": "n8n-nodes-base.stickyNote",
"position": [
1140,
-220
],
"parameters": {
"content": "## Reply\n- This node will send an email to the Sender\n"
},
"typeVersion": 1
},
{
"id": "2f793a0b-343e-4ab6-975a-0efafe48304c",
"name": "Note adhésive5",
"type": "n8n-nodes-base.stickyNote",
"position": [
740,
240
],
"parameters": {
"content": "## If not a Sponsored Email. Do Nothing. \n\n"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "624043af-906a-4f2a-99d0-46399fdf2e2b",
"connections": {
"dc80f4ae-c9dd-4847-8142-b34598ee7f2c": {
"main": [
[
{
"node": "AI Agent1",
"type": "main",
"index": 0
}
],
[
{
"node": "No Operation, do nothing",
"type": "main",
"index": 0
}
]
]
},
"AI Agent": {
"main": [
[
{
"node": "dc80f4ae-c9dd-4847-8142-b34598ee7f2c",
"type": "main",
"index": 0
}
]
]
},
"AI Agent1": {
"main": [
[
{
"node": "a0edd387-37ee-4ad6-b12f-9c1b5005f6ba",
"type": "main",
"index": 0
}
]
]
},
"fbcb4645-50d3-4e2c-9c27-8c89333f39db": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"Gmail Trigger": {
"main": [
[
{
"node": "fbcb4645-50d3-4e2c-9c27-8c89333f39db",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"OpenAI Chat Model1": {
"ai_languageModel": [
[
{
"node": "AI Agent1",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"b251365d-8bff-441e-8ab3-250ba216bac3": {
"ai_outputParser": [
[
{
"node": "AI Agent",
"type": "ai_outputParser",
"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é - Résumé IA, 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
Pramod Kumar Rathoure
@prathoureDesign and build custom n8n workflows that: ⚡ Eliminate repetitive work 📊 Integrate tools like Google Workspace, CRMs, and APIs ✅ Deliver faster, error-free results I create solutions that save time, boost accuracy, and let teams focus on high-value work. For me, automation isn’t just about technology—it’s about freeing people from busywork so they can do what matters most. let’s talk—I can help you turn them into smooth, automated workflows.
Partager ce workflow