Generar documentos largos
Este es unContent Creation, Multimodal AIflujo de automatización del dominio deautomatización que contiene 14 nodos.Utiliza principalmente nodos como Set, Form, SplitOut, GoogleDocs, FormTrigger. Crear documentos largos a partir de títulos sencillos utilizando GPT-5 y Google Docs
- •Clave de API de OpenAI
Nodos utilizados (14)
Categoría
{
"id": "TkSOqdrMsNs3WpDK",
"meta": {
"instanceId": "a0e41110bf9f611e96e18e0663d80d746aeedc58368940bfe471a8d577a5069b",
"templateCredsSetupCompleted": true
},
"name": "Generate Long Document",
"tags": [],
"nodes": [
{
"id": "60f4490d-4cb9-4cc6-bf22-cd106c3ffef2",
"name": "Structured Output Parser",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
496,
48
],
"parameters": {
"jsonSchemaExample": "{\n \"blogTitle\": \"How to Build an AI Automation Workflow with n8n\",\n \"sections\": [\n {\n \"sectionId\": 1,\n \"sectionTitle\": \"Introduction: Why AI Automation Matters\",\n \"sectionSummary\": \"Explain the rise of AI automation and why it's valuable for productivity.\"\n },\n {\n \"sectionId\": 2,\n \"sectionTitle\": \"Tools You Need to Get Started\",\n \"sectionSummary\": \"List and briefly describe essential tools like n8n, OpenAI API, and Supabase.\"\n },\n {\n \"sectionId\": 3,\n \"sectionTitle\": \"Step-by-Step Workflow Setup\",\n \"sectionSummary\": \"Break down how to connect nodes, triggers, and APIs to build the automation.\"\n },\n {\n \"sectionId\": 4,\n \"sectionTitle\": \"Testing and Optimization\",\n \"sectionSummary\": \"Show how to test, debug, and improve the automation workflow.\"\n },\n {\n \"sectionId\": 5,\n \"sectionTitle\": \"Conclusion and Next Steps\",\n \"sectionSummary\": \"Wrap up the article and encourage readers to experiment with AI workflows.\"\n }\n ]\n}"
},
"typeVersion": 1.3
},
{
"id": "0aa103cc-e536-4041-a546-bf2ad16cd58d",
"name": "Split Out",
"type": "n8n-nodes-base.splitOut",
"position": [
928,
-192
],
"parameters": {
"include": "allOtherFields",
"options": {},
"fieldToSplitOut": "sections"
},
"typeVersion": 1
},
{
"id": "84a0b969-dcf6-484a-ac18-5ca1663926d0",
"name": "Recorrer elementos",
"type": "n8n-nodes-base.splitInBatches",
"position": [
1152,
-192
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "ad643365-42ef-4e62-9c3d-7da17915bb09",
"name": "Simple Memoria",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
1520,
-80
],
"parameters": {
"sessionKey": "={{ $('GetSections').item.json.documentId }}",
"sessionIdType": "customKey",
"contextWindowLength": 30
},
"typeVersion": 1.3
},
{
"id": "69495066-646b-4cd5-8bb2-01abb95c67c7",
"name": "GetSections",
"type": "n8n-nodes-base.set",
"position": [
704,
-192
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "5b79fc5b-55ae-42ed-a138-9150a7b86c70",
"name": "sections",
"type": "array",
"value": "={{ $json.output.sections }}"
},
{
"id": "73ed193b-9d56-4229-a1da-89037a241a3e",
"name": "documentId",
"type": "string",
"value": "={{ Math.random().toString(36).substring(2, 10).toUpperCase() }}"
}
]
}
},
"notesInFlow": true,
"typeVersion": 3.4
},
{
"id": "d45e18a1-274b-42f8-a516-cdd7fa472703",
"name": "CreateDocument",
"type": "n8n-nodes-base.googleDocs",
"position": [
128,
-336
],
"parameters": {
"title": "={{ $('On form submission').item.json.Title }}",
"folderId": "default"
},
"credentials": {
"googleDocsOAuth2Api": {
"id": "ue3sXJAM99TJeGwG",
"name": "Google Docs account"
}
},
"typeVersion": 2
},
{
"id": "3da122af-c430-4dc0-a237-2fd6008f5e0c",
"name": "UpdateDocument",
"type": "n8n-nodes-base.googleDocs",
"position": [
1728,
-192
],
"parameters": {
"actionsUi": {
"actionFields": [
{
"text": "={{$json.output + \"\\n\\n\"}}\n",
"action": "insert"
}
]
},
"operation": "update",
"documentURL": "={{ $('CreateDocument').item.json.id }}"
},
"credentials": {
"googleDocsOAuth2Api": {
"id": "ue3sXJAM99TJeGwG",
"name": "Google Docs account"
}
},
"typeVersion": 2
},
{
"id": "988ad51b-7a09-4712-907e-d852a4d228ef",
"name": "gpt-5-mini",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
368,
48
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-5-mini",
"cachedResultName": "gpt-5-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "2TBvwobWbbHlIjKT",
"name": "OpenAi account"
}
},
"typeVersion": 1.2
},
{
"id": "033dd289-00c8-4753-b0b1-0f78cdfd9e63",
"name": "gpt-5",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
1392,
-80
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-5",
"cachedResultName": "gpt-5"
},
"options": {
"timeout": 600000
}
},
"credentials": {
"openAiApi": {
"id": "2TBvwobWbbHlIjKT",
"name": "OpenAi account"
}
},
"typeVersion": 1.2
},
{
"id": "17a2ab80-75e7-4f72-92cb-c4d06b2fbf3c",
"name": "ContentWriter",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
1376,
-304
],
"parameters": {
"text": "=Help write section: {{ $json.sections.sectionId }}. {{ $json.sections.sectionTitle }}",
"options": {
"systemMessage": "=You are a professional content generator and technical writer. \nYour task is to generate complete Markdown sections based on a provided JSON structure.\n\n#JSON structure:\n{{ $('ContentPlanner').item.json.output.toJsonString() }}\n\n# 🧠 Instructions\nGenerate a complete, well-structured Markdown document.\nInclude all sections in order using their **sectionId**.\nEach section should include:\n- Heading in the format: `# {sectionId}. {sectionTitle}` \n- Section must not exceed {{Math.floor($('On form submission').item.json['Word Count'] / $('GetSections').item.json.sections.length)}} words\n\n",
"passthroughBinaryImages": false
},
"promptType": "define"
},
"typeVersion": 2.2
},
{
"id": "338f10a7-01f3-454e-bd82-4b59b2be54f3",
"name": "ContentPlanner",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
352,
-192
],
"parameters": {
"text": "={{ $('On form submission').item.json.Title }}",
"options": {
"systemMessage": "# ✍️ Prompt: Blog Outline Generator Agent\n\n## **Role**\nYou are a **professional content planner and blog strategist**.\n\n## **Goal**\nAnalyze the user’s topic or idea, then **generate a complete blog post outline** with clear structure, logical flow, and engaging section titles.\n\n## **Instructions**\n1. Read the user’s description or topic carefully. \n2. Identify the **main goal** of the article (inform, persuade, educate, or inspire). \n3. Create a **structured outline** with key sections and short explanations for each. \n4. Include **subheadings** (H2, H3) and **logical progression** from introduction to conclusion. \n5. Focus on **clarity, SEO-friendly phrasing, and reader engagement**. \n6. Do **not** write the full article — only the **outline and section summaries**."
},
"promptType": "define",
"hasOutputParser": true
},
"typeVersion": 2.2
},
{
"id": "67ecec8d-12d3-4923-bbde-ca710d2465d4",
"name": "On form submission",
"type": "n8n-nodes-base.formTrigger",
"position": [
-96,
-336
],
"webhookId": "9525bb2f-3046-43ee-872a-9f5ee8c32248",
"parameters": {
"options": {},
"formTitle": "Generate Long Content",
"formFields": {
"values": [
{
"fieldLabel": "Title",
"placeholder": "title or short description",
"requiredField": true
},
{
"fieldType": "number",
"fieldLabel": "Word Count",
"requiredField": true
}
]
},
"formDescription": "Help generate long document from a title"
},
"typeVersion": 2.3
},
{
"id": "6e4ebbe6-c39d-4b9a-832a-69824b207f06",
"name": "Form",
"type": "n8n-nodes-base.form",
"position": [
416,
-480
],
"webhookId": "bc18f06b-e004-4e39-b7f0-eed867ec524a",
"parameters": {
"options": {
"customCss": ":root {\n\t--font-family: 'Open Sans', sans-serif;\n\t--font-weight-normal: 400;\n\t--font-weight-bold: 600;\n\n\t/* Typography — larger & more readable */\n\t--font-size-body: 16px;\n\t--font-size-label: 15px;\n\t--font-size-test-notice: 13px;\n\t--font-size-input: 15px;\n\t--font-size-header: 24px;\n\t--font-size-paragraph: 16px;\n\t--font-size-link: 14px;\n\t--font-size-error: 13px;\n\t--font-size-html-h1: 34px;\n\t--font-size-html-h2: 26px;\n\t--font-size-html-h3: 20px;\n\t--font-size-html-h4: 18px;\n\t--font-size-html-h5: 16px;\n\t--font-size-html-h6: 14px;\n\t--font-size-subheader: 16px;\n\n\t/* Colors — higher contrast & friendlier accents */\n\t--color-background: #f7f8fc;\n\t--color-test-notice-text: #b45309; /* deeper amber for contrast */\n\t--color-test-notice-bg: #fff7ed;\n\t--color-test-notice-border: #fed7aa;\n\n\t--color-card-bg: #ffffff;\n\t--color-card-border: #e5e7eb;\n\t--color-card-shadow: rgba(31, 41, 55, 0.06);\n\n\t--color-link: #2563eb; /* accessible blue for standard links */\n\t--color-header: #1f2937; /* slate-800 */\n\t--color-label: #374151; /* slate-700 */\n\t--color-input-border: #cbd5e1; /* slate-300 */\n\t--color-input-text: #111827; /* slate-900 */\n\t--color-focus-border: #7c3aed; /* vivid violet focus ring */\n\t--color-submit-btn-bg: #ff6d5a; /* brand coral kept */\n\t--color-submit-btn-text: #ffffff;\n\t--color-error: #dc2626; /* red-600 */\n\t--color-required: #ef4444; /* red-500 */\n\t--color-clear-button-bg: #6b7280; /* slate-500 */\n\t--color-html-text: #374151; /* slate-700 */\n\t--color-html-link: #ff6d5a; /* brand accent for content links */\n\t--color-header-subtext: #6b7280; /* slate-500 */\n\n\t/* Border Radii — slightly softer */\n\t--border-radius-card: 10px;\n\t--border-radius-input: 8px;\n\t--border-radius-clear-btn: 50%;\n\t--card-border-radius: 10px;\n\n\t/* Spacing — room to breathe */\n\t--padding-container-top: 32px;\n\t--padding-card: 28px;\n\t--padding-test-notice-vertical: 12px;\n\t--padding-test-notice-horizontal: 24px;\n\t--margin-bottom-card: 20px;\n\t--padding-form-input: 14px;\n\t--card-padding: 28px;\n\t--card-margin-bottom: 20px;\n\n\t/* Dimensions — wider layout */\n\t--container-width: 720px;\n\t--submit-btn-height: 52px;\n\t--checkbox-size: 20px;\n\n\t/* Others — subtle shadow & clearer placeholders */\n\t--box-shadow-card: 0px 6px 20px 0px var(--color-card-shadow);\n\t--opacity-placeholder: 0.6;\n}\n"
},
"operation": "completion",
"completionTitle": "Generating your document… Please wait a few minutes, then access the link below",
"completionMessage": "=https://docs.google.com/document/d/{{ $('CreateDocument').item.json.id }}"
},
"typeVersion": 2.3
},
{
"id": "f3db576d-70cb-46ce-a6ec-f291c486807e",
"name": "Nota adhesiva4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-992,
-592
],
"parameters": {
"width": 848,
"height": 992,
"content": "# 🧭 Overview\nThis workflow takes a title and automatically creates a detailed Google Document.\nIt first builds an outline, then writes each section based on the word limit, and finally saves everything into the Google Doc.\n\n---\n\n## ⚙️ Setup\n1. Connect **Google Docs OAuth** for the `CreateDocument` and `UpdateDocument` nodes. \n2. Add your **OpenAI API Key** for `gpt-5-mini` (outline planner) and `gpt-5` (content writer). \n3. Open the public **Form URL**, submit your Title and Word Count. \n4. The generated Google Document link will appear after submission.\n\n---\n\n## 📝 How to Use\n1. Open the submission form.\n2. Enter your title and word count.\n3. Click Submit to generate your Google Document link.\n4. Wait a few minutes — the completed document will be ready at that link.\n\n---\n\n## 🎨 Customize\n- Change models in **“gpt-5-mini”** and **“gpt-5”** nodes. \n- Edit outline generation rules in the **ContentPlanner** system prompt. \n- Modify section format and word-cap logic in the **ContentWriter** system prompt. \n- Adjust document title or folder source (Form → Title or Folder ID). \n- Update CSS in the **Form node → Completion → customCss** to match your brand.\n\n---\n\n## 💰 Costs & Limits\n- **OpenAI token usage** scales with *Word Count × Number of Sections*. \n- **Execution time limit:** The `gpt-5` node has a 10-minute timeout (increase if needed). \n- For long documents, consider reducing word count per section or batching. \n- **Google Docs API** has write-rate limits — this workflow handles appends one section at a time to stay within safe limits.\n"
},
"typeVersion": 1
}
],
"active": true,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "aac61755-8db8-4852-b401-a5cb8e5c21ef",
"connections": {
"033dd289-00c8-4753-b0b1-0f78cdfd9e63": {
"ai_languageModel": [
[
{
"node": "17a2ab80-75e7-4f72-92cb-c4d06b2fbf3c",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"0aa103cc-e536-4041-a546-bf2ad16cd58d": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"988ad51b-7a09-4712-907e-d852a4d228ef": {
"ai_languageModel": [
[
{
"node": "338f10a7-01f3-454e-bd82-4b59b2be54f3",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"69495066-646b-4cd5-8bb2-01abb95c67c7": {
"main": [
[
{
"node": "0aa103cc-e536-4041-a546-bf2ad16cd58d",
"type": "main",
"index": 0
}
]
]
},
"17a2ab80-75e7-4f72-92cb-c4d06b2fbf3c": {
"main": [
[
{
"node": "3da122af-c430-4dc0-a237-2fd6008f5e0c",
"type": "main",
"index": 0
}
]
]
},
"Simple Memory": {
"ai_memory": [
[
{
"node": "17a2ab80-75e7-4f72-92cb-c4d06b2fbf3c",
"type": "ai_memory",
"index": 0
}
]
]
},
"338f10a7-01f3-454e-bd82-4b59b2be54f3": {
"main": [
[
{
"node": "69495066-646b-4cd5-8bb2-01abb95c67c7",
"type": "main",
"index": 0
}
]
]
},
"d45e18a1-274b-42f8-a516-cdd7fa472703": {
"main": [
[
{
"node": "6e4ebbe6-c39d-4b9a-832a-69824b207f06",
"type": "main",
"index": 0
},
{
"node": "338f10a7-01f3-454e-bd82-4b59b2be54f3",
"type": "main",
"index": 0
}
]
]
},
"3da122af-c430-4dc0-a237-2fd6008f5e0c": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Items": {
"main": [
[],
[
{
"node": "17a2ab80-75e7-4f72-92cb-c4d06b2fbf3c",
"type": "main",
"index": 0
}
]
]
},
"67ecec8d-12d3-4923-bbde-ca710d2465d4": {
"main": [
[
{
"node": "d45e18a1-274b-42f8-a516-cdd7fa472703",
"type": "main",
"index": 0
}
]
]
},
"60f4490d-4cb9-4cc6-bf22-cd106c3ffef2": {
"ai_outputParser": [
[
{
"node": "338f10a7-01f3-454e-bd82-4b59b2be54f3",
"type": "ai_outputParser",
"index": 0
}
]
]
}
}
}¿Cómo usar este flujo de trabajo?
Copie el código de configuración JSON de arriba, cree un nuevo flujo de trabajo en su instancia de n8n y seleccione "Importar desde JSON", pegue la configuración y luego modifique la configuración de credenciales según sea necesario.
¿En qué escenarios es adecuado este flujo de trabajo?
Intermedio - Creación de contenido, IA Multimodal
¿Es de pago?
Este flujo de trabajo es completamente gratuito, puede importarlo y usarlo directamente. Sin embargo, tenga en cuenta que los servicios de terceros utilizados en el flujo de trabajo (como la API de OpenAI) pueden requerir un pago por su cuenta.
Flujos de trabajo relacionados recomendados
Nghia Nguyen
@nghiaaidevI am Nguyen Trung Nghia, a Software Engineer passionate about AI Automation. I build intelligent automation systems that help businesses reduce costs, increase productivity, and scale faster with the power of AI technology.
Compartir este flujo de trabajo