预订自动化模板
高级
这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 27 个节点。主要使用 If, Code, Gmail, Merge, Filter 等节点。 使用GPT-5和Gmail上下文分析生成个性化音乐推广邮件
前置要求
- •Google 账号和 Gmail API 凭证
- •Google Sheets API 凭证
- •OpenAI API Key
使用的节点 (27)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "Oz2pLpSGmTn1PqQf",
"meta": {
"instanceId": "b1699e1d8ef82aaaaf2eed0ed67f215d7574a625e2d012a1bcd013054b0defdf",
"templateCredsSetupCompleted": true
},
"name": "BookingAutomatization_Template",
"tags": [],
"nodes": [
{
"id": "c04097b9-35c6-4f01-b682-32980a0c5cb9",
"name": "When clicking ‘Execute workflow’",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-1312,
-48
],
"parameters": {},
"typeVersion": 1
},
{
"id": "7a5432e1-664a-4e5e-9c2d-2aaa6a5385a8",
"name": "Extract from File",
"type": "n8n-nodes-base.extractFromFile",
"position": [
-848,
0
],
"parameters": {
"options": {
"headerRow": true,
"includeEmptyCells": true
},
"operation": "xlsx"
},
"typeVersion": 1
},
{
"id": "e6651a73-b581-4931-93a8-a593ddcb3112",
"name": "Loop Over Items",
"type": "n8n-nodes-base.splitInBatches",
"position": [
-112,
-48
],
"parameters": {
"options": {
"reset": false
},
"batchSize": "=1"
},
"typeVersion": 3
},
{
"id": "da89fd67-8610-4417-ab06-8fd0a0a3c39d",
"name": "Filter",
"type": "n8n-nodes-base.filter",
"position": [
-352,
-48
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "98cca18d-7a57-4423-a401-942cfe7f3042",
"operator": {
"type": "string",
"operation": "contains"
},
"leftValue": "={{ $json.CATEGORY }}",
"rightValue": "={{ $json.category }}"
},
{
"id": "e0280c55-fe2a-4e74-b856-972391642fa7",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $json['ative'] }}",
"rightValue": "={{ $json['Aktivní/neaktivní'] }}"
},
{
"id": "25daadd9-be2a-4bb8-a72e-0af4fc251be3",
"operator": {
"type": "string",
"operation": "notEmpty",
"singleValue": true
},
"leftValue": "={{ $json['email_1'] }}",
"rightValue": ""
},
{
"id": "3eb30cac-d2df-4417-9a5c-f1e5ec6527a8",
"operator": {
"type": "string",
"operation": "notEmpty",
"singleValue": true
},
"leftValue": "={{ $json.PROMPT }}",
"rightValue": ""
}
]
}
},
"typeVersion": 2.2
},
{
"id": "b2eae486-85dd-42c7-a128-6d62a0a67540",
"name": "ConvertToText",
"type": "n8n-nodes-base.code",
"position": [
512,
-16
],
"parameters": {
"jsCode": "const emails = $input.all();\n \nfunction stripSignatureFromHtml(html) {\n if (!html) return \"\";\n\n const sigMatch = html.match(/<div[^>]*class=\"gmail_signature\"[^>]*>/i);\n if (sigMatch) {\n html = html.substring(0, sigMatch.index);\n }\n\n return html.replace(/<\\/?[^>]+(>|$)/g, \"\").trim();\n}\n\nreturn emails.map(item => {\n const data = item.json;\n const body = stripSignatureFromHtml(data.html || \"\");\n\n return {\n json: {\n subject: data.subject || \"\",\n body\n }\n };\n});"
},
"typeVersion": 2
},
{
"id": "077eff45-b5fd-4b5c-8834-6b9523f16646",
"name": "Basic LLM Chain",
"type": "@n8n/n8n-nodes-langchain.chainLlm",
"position": [
912,
48
],
"parameters": {
"text": "={{ $json.UserPrompt }}",
"batching": {},
"messages": {
"messageValues": [
{
"message": "={{ $json.systemPrompt }}"
}
]
},
"promptType": "define",
"hasOutputParser": true
},
"retryOnFail": true,
"typeVersion": 1.7
},
{
"id": "814cee2e-26df-446a-9e28-b706898e9112",
"name": "SystemPrompt",
"type": "n8n-nodes-base.code",
"position": [
704,
48
],
"parameters": {
"jsCode": "const sheetData = $('Loop Over Items').first().json;\nconst emails = $input.all();\nconst examples = emails.map((item, idx) => {\n const e = item.json;\n return `--- EMAIL ${idx + 1} ---\nSubject: ${e.subject}\nBody:\n${e.body}\n`;\n}).join(\"\\n\\n\");\n\nconst links = `\n- LATEST SINGLE: ${sheetData['LATEST SINGLE']}\n- LATEST VIDEO: ${sheetData['LATEST VIDEO']}\n- EPK: ${sheetData['EPK']}\n- OnePager: ${sheetData['ONEPAGER']}\n`;\n\nconst systemPrompt = `\nYou are a professional email copywriter specialized in the music industry. \nYour task: create effective, personalized emails in **HTML format** based on user input, previous communication, and contact category. \n\n### Rules for analyzing previous communication\n- ALWAYS analyze the relationship first\n- Match tone (formal/informal, personal/business). \n- Keep same greeting style (name, ty/vy). \n- Respect relationship level (first contact, long-term, colleague, friend). \n- Copy style (sentence length, emojis, formatting). \n- Continue context (topics, deals, projects). \n\n### Rules for email generation\n- **Format**: Always return \n\n SUBJECT:\n [max 50 chars]\n\n CONTENT:\n [HTML body]\n- **HTML body**: \n - Use <p>, <br>, <b>, <a href=\"\">, <ul><li>. \n - Headlines/links must have bold labels, e.g. <b>LATEST SINGLE:</b> <a href=\"...\">link</a>. \n- **Professional but friendly** tone. \n- Clear and concise, no filler. \n- each email must reflect actual relationship\n- Be BRIEF\n- Be CONSIST with the previous name, but match it with user prompt requires\n- NEVER USE VARIABLES in Email (except Links)\n- Call-to-action must be explicit. \n- No placeholders ([Your name], [Event name], etc.). \n\n---\n### Contact category handling\n- **Festival** → focus on live show / booking. \n- **Club** → club performance relevance. \n- **Media** → press release, coverage, review, airplay. \n- **Playlisting** → pitching for playlists, streaming focus. \n\n---\n\n### Subject line\n- If provided in UserPrompt → use it. \n- If empty but clear from context → generate relevant one. \n- Otherwise → create a generic professional subject. \n---\n### Language\n- Match language from UserPrompt. \n\n---\n### Signature\n- End email with: \n - **\"ENDING IN YOUR LANGUAGE, \"** (if <> EN), \n - **\"for YOUR BAND, \"** (if EN). \n- DO NOT USE ANYTHING ELSE\n---\nNow wait for the UserPrompt with context (previous communication, contact category, language, subject, links). `;\n\nconst UserPrompt = `\n#User prompt:# ${sheetData['PROMPT']}\n##Links :## ${links}\n##Examples:## ${examples}\n##Category of contact: ## ${sheetData['category']}\n##Language:## ${sheetData['LANGUAGE']}\n##Subject:## ${sheetData['SUBJECT']}\n##Name of company:## ${sheetData['venue_name']}\n`;\n\nreturn {\n json: {\n systemPrompt,\n UserPrompt\n }\n};"
},
"typeVersion": 2
},
{
"id": "f2d8a1be-dd1c-4db8-8dd1-16a54d29a26f",
"name": "Create a draft",
"type": "n8n-nodes-base.gmail",
"position": [
1488,
208
],
"webhookId": "1da2fadf-1ac5-4fce-a7c4-85fc82631211",
"parameters": {
"message": "={{ $json.body }}{{ $json.signature }}",
"options": {
"ccList": "={{ $json.email2 }}",
"sendTo": "={{ $json.email1 }}"
},
"subject": "={{ $json.subject }}",
"resource": "draft",
"emailType": "html"
},
"credentials": {
"gmailOAuth2": {
"id": "UvhyTD0WB1lCZDX1",
"name": "TEMPLATE"
}
},
"typeVersion": 2.1
},
{
"id": "d5dfff03-723f-4146-bfdd-7f65c6a49804",
"name": "PreviousMessagesByContact",
"type": "n8n-nodes-base.gmail",
"position": [
128,
48
],
"webhookId": "83522b38-9a28-4cc8-9faa-6fc11244336c",
"parameters": {
"limit": 5,
"simple": false,
"filters": {
"q": "=to: {{ $json['email_1'] }}",
"sender": "youremail@gmail.com"
},
"options": {},
"operation": "getAll"
},
"credentials": {
"gmailOAuth2": {
"id": "UvhyTD0WB1lCZDX1",
"name": "TEMPLATE"
}
},
"typeVersion": 2.1,
"alwaysOutputData": true
},
{
"id": "deec3535-343a-436d-9b09-f164f48fc5c7",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
864,
224
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-5-nano",
"cachedResultName": "gpt-5-nano"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "SejrVHsogrtvT4yC",
"name": "TEMPLATE"
}
},
"typeVersion": 1.2
},
{
"id": "c36e34af-c835-43d2-97a8-9fc0df87df32",
"name": "Structured Output Parser",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
976,
256
],
"parameters": {
"autoFix": true,
"schemaType": "manual",
"inputSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"subject\": {\n \"type\": \"string\",\n \"maxLength\": 50,\n \"description\": \"Email subject line, maximum 50 characters.\"\n },\n \"content\": {\n \"type\": \"string\",\n \"description\": \"HTML body of the email including <p>, <br>, <b>, <a>, <ul><li>.\"\n }\n },\n \"required\": [\"subject\", \"content\"],\n \"additionalProperties\": false\n}"
},
"typeVersion": 1.3
},
{
"id": "21335279-7761-42d5-bb74-0289258ab0ee",
"name": "AutomatizationHelper",
"type": "n8n-nodes-base.googleSheets",
"position": [
-848,
-176
],
"parameters": {
"options": {},
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1C4x3f8Ja0lgGzAx2itkSlvusXjmR6zNm9Ct7QdtFqNE/edit#gid=0",
"cachedResultName": "Config"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "1C4x3f8Ja0lgGzAx2itkSlvusXjmR6zNm9Ct7QdtFqNE",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1C4x3f8Ja0lgGzAx2itkSlvusXjmR6zNm9Ct7QdtFqNE/edit?usp=drivesdk",
"cachedResultName": "AutomatizationHelper"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "h298dUyh0K1tO9s9",
"name": "TEMPLATE"
}
},
"typeVersion": 4.6
},
{
"id": "0084e9e7-f87b-4b14-8c04-efd91c61ddcf",
"name": "Contacts",
"type": "n8n-nodes-base.readWriteFile",
"position": [
-1056,
0
],
"parameters": {
"options": {},
"fileSelector": "/yourdirectory/yourfile"
},
"typeVersion": 1
},
{
"id": "9ce4bf96-a601-4149-8df0-3abbfef16d50",
"name": "MatchingByLanguage",
"type": "n8n-nodes-base.merge",
"position": [
-560,
-48
],
"parameters": {
"mode": "combine",
"options": {},
"fieldsToMatchString": "LANGUAGE"
},
"typeVersion": 3.2
},
{
"id": "75cec581-56aa-4139-9b15-b6f281df0e72",
"name": "ProcessingOutput",
"type": "n8n-nodes-base.code",
"position": [
1248,
48
],
"parameters": {
"jsCode": "const contact = $('Loop Over Items').first().json;\nconst email1 = contact['email_1'];\nconst email2 = contact['email_2'];\nconst nazev = contact['venue_name'];\nconst input = $json[\"output\"];\nconst subject = input['subject'];\nconst body = input['content'];\n\nconst signature = contact['SIGNATURE'];\n\nreturn {\n json: {\n email1,\n email2,\n nazev,\n subject,\n body,\n signature\n }\n};"
},
"typeVersion": 2
},
{
"id": "d35579fe-5ea8-4360-a061-592619851fdf",
"name": "No Operation, do nothing",
"type": "n8n-nodes-base.noOp",
"position": [
192,
-336
],
"parameters": {},
"typeVersion": 1
},
{
"id": "5bbb0a3b-d48a-4b91-9d68-5e302e83270c",
"name": "If",
"type": "n8n-nodes-base.if",
"position": [
320,
48
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "a7476973-7ace-4e7d-8a69-799e8d9eb2cb",
"operator": {
"type": "number",
"operation": "gt"
},
"leftValue": "={{ Object.keys($items(\"PreviousMessagesByContact\")[0].json).length }}",
"rightValue": 0
}
]
}
},
"typeVersion": 2.2
},
{
"id": "051869cd-54da-4cba-b933-94c993c264ce",
"name": "Default",
"type": "n8n-nodes-base.code",
"position": [
512,
144
],
"parameters": {
"jsCode": "const subject = `YOUR DEFAULT TEMPLATE - SUBJECT`;\nconst body =`\nYOUR DEFAULT TEMPLATE - CONTENT\n`;\n\n\nreturn {\n json: {\n subject,\n body\n }\n };"
},
"typeVersion": 2
},
{
"id": "da2a6b0d-52dd-4eea-8c35-3ebd0128a7eb",
"name": "OpenAI Chat Model1",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
976,
448
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-5-nano-2025-08-07",
"cachedResultName": "gpt-5-nano-2025-08-07"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "SejrVHsogrtvT4yC",
"name": "TEMPLATE"
}
},
"typeVersion": 1.2
},
{
"id": "ef9bce2d-4c1e-41ba-9bc0-0bbcd1ecae0f",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1232,
160
],
"parameters": {
"color": 5,
"width": 544,
"height": 224,
"content": "## CONTACTS\nLoading contact database from file:\n- Reads CSV/Excel with contact information (emails, names, categories)\n- Contains booking contacts: venues, festivals, clubs, media, playlists\n- Each contact has category (booker/festival/playlisting/club/media)\n- Must include active status and email address\n\nFile should contain: email, name, category, status, language preference"
},
"typeVersion": 1
},
{
"id": "03133ca0-0739-4eb7-b516-9a3b74f324f8",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-688,
-400
],
"parameters": {
"color": 5,
"width": 544,
"height": 336,
"content": "## Configuration & Contact Filtering \nConfiguration setup and contact preparation:\n\n1. Google Sheets (AutomatizationHelper): Loads campaign settings:\n - EPK/Press kit links, latest video, singles\n - AI prompts for different contact categories \n - Language-specific templates and subjects\n - HTML email signature (Gmail API doesn't add signature automatically)\n\n2. Language matching & filtering:\n - Matches contacts by language preference\n - Filters out inactive contacts and missing emails\n - Prepares clean contact list for processing"
},
"typeVersion": 1
},
{
"id": "b81e9233-b24c-4ab1-993b-f6c8f6ef1e69",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
112,
-160
],
"parameters": {
"color": 5,
"width": 496,
"height": 128,
"content": "##1. GMAIL RETRIEVAL:\n - Fetches previous email conversation history with contact\n - Extracts clean text + subject (API returns messy HTML)\n - If no history exists: uses default context text"
},
"typeVersion": 1
},
{
"id": "ddfb6067-d714-4b09-b2c1-f9ab17bacb3f",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
640,
-208
],
"parameters": {
"color": 5,
"width": 272,
"height": 192,
"content": "## PROMPT ASSEMBLY:\n - Builds system prompt with campaign info (EPK, videos, etc.)\n - Creates user prompt with contact context and conversation history\n - Customizes for contact category (booker/festival/media/etc.)"
},
"typeVersion": 1
},
{
"id": "a7c74c78-c4c7-4128-9ea9-068ec4a524a9",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
928,
-208
],
"parameters": {
"color": 5,
"width": 288,
"height": 192,
"content": "## AI GENERATION:\n - LLM generates personalized subject line\n - Creates email body matching conversation tone and category\n - Incorporates relevant links and band information"
},
"typeVersion": 1
},
{
"id": "702a3118-95da-4bdc-8471-ff1a110718e2",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
1456,
-32
],
"parameters": {
"color": 5,
"width": 256,
"height": 208,
"content": "## GMAIL DRAFT:\n - Creates email draft in Gmail with generated content\n - Adds HTML signature from AutomatizationHelper\n - Ready for manual review and sending"
},
"typeVersion": 1
},
{
"id": "7e4a3245-490d-4690-8cc8-e2900a6e6aa2",
"name": "Sticky Note6",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1424,
-560
],
"parameters": {
"color": 5,
"width": 352,
"height": 496,
"content": "## Short Description:\nAdvanced AI-powered email campaign system for musicians. Processes contact database, analyzes Gmail conversation history, and generates personalized booking/promotion emails with category-specific content and proper signatures.\n\n## Key Features:\n\n- Multi-category email generation (bookers, festivals, media, playlists)\n- Conversation history analysis and context maintenance\n- Multi-language support with localized prompts\n- Automatic signature insertion\n- Draft creation for manual review before sending\n- Bulk processing with individual personalization"
},
"typeVersion": 1
},
{
"id": "c665efbf-e074-4838-bfc4-c5e4c021bbed",
"name": "Sticky Note7",
"type": "n8n-nodes-base.stickyNote",
"position": [
272,
-432
],
"parameters": {
"color": 5,
"width": 256,
"height": 96,
"content": "## Done Branch\n** Drafts have been already generated"
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "93ed6ca5-cff2-40b9-b93a-7e079eafbe4d",
"connections": {
"If": {
"main": [
[
{
"node": "ConvertToText",
"type": "main",
"index": 0
}
],
[
{
"node": "Default",
"type": "main",
"index": 0
}
]
]
},
"Filter": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Default": {
"main": [
[
{
"node": "SystemPrompt",
"type": "main",
"index": 0
}
]
]
},
"Contacts": {
"main": [
[
{
"node": "Extract from File",
"type": "main",
"index": 0
}
]
]
},
"SystemPrompt": {
"main": [
[
{
"node": "Basic LLM Chain",
"type": "main",
"index": 0
}
]
]
},
"ConvertToText": {
"main": [
[
{
"node": "SystemPrompt",
"type": "main",
"index": 0
}
]
]
},
"Create a draft": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Basic LLM Chain": {
"main": [
[
{
"node": "ProcessingOutput",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Items": {
"main": [
[
{
"node": "No Operation, do nothing",
"type": "main",
"index": 0
}
],
[
{
"node": "PreviousMessagesByContact",
"type": "main",
"index": 0
}
]
]
},
"ProcessingOutput": {
"main": [
[
{
"node": "Create a draft",
"type": "main",
"index": 0
}
]
]
},
"Extract from File": {
"main": [
[
{
"node": "MatchingByLanguage",
"type": "main",
"index": 1
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "Basic LLM Chain",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"MatchingByLanguage": {
"main": [
[
{
"node": "Filter",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Model1": {
"ai_languageModel": [
[
{
"node": "Structured Output Parser",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"AutomatizationHelper": {
"main": [
[
{
"node": "MatchingByLanguage",
"type": "main",
"index": 0
}
]
]
},
"Structured Output Parser": {
"ai_outputParser": [
[
{
"node": "Basic LLM Chain",
"type": "ai_outputParser",
"index": 0
}
]
]
},
"PreviousMessagesByContact": {
"main": [
[
{
"node": "If",
"type": "main",
"index": 0
}
]
]
},
"When clicking ‘Execute workflow’": {
"main": [
[
{
"node": "Contacts",
"type": "main",
"index": 0
},
{
"node": "AutomatizationHelper",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 内容创作, 多模态 AI
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
在可视化参考库中探索n8n节点
在可视化参考库中探索n8n节点
If
Ftp
Set
+93
113 节点I versus AI
其他
使用OpenAI、RunwayML和ElevenLabs自动化无脸短视频
使用OpenAI、RunwayML和ElevenLabs自动化无脸短视频:从脚本到社交媒体
Set
Code
Wait
+18
56 节点LeeWei
内容创作
Apollo 数据抓取与触达流程 1 ✅
使用 Apollo、AI 解析和定时邮件跟进自动生成潜在客户
If
Code
Wait
+13
39 节点Deniz
内容创作
WordPress博客自动化专业版(深度研究)v2.1市场
使用GPT-4o、Perplexity AI和多语言支持自动化SEO优化的博客创建
If
Set
Xml
+27
125 节点Daniel Ng
内容创作
完整的 B2B 销售流程:Apollo 潜在客户生成、Mailgun 外展和 AI 回复管理
完整的 B2B 销售流程:Apollo 潜在客户生成、Mailgun 外展和 AI 回复管理
If
Set
Code
+26
116 节点Paul
内容创作
使用Perplexity和GPT为WordPress创建SEO优化博客,包含关键词和媒体
使用Perplexity和GPT为WordPress创建SEO优化博客,包含关键词和媒体
Set
Code
Limit
+22
124 节点Paul
内容创作