{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "956e5296-2dbb-4a32-8ce4-46b4d575d680",
      "name": "Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        224,
        400
      ],
      "parameters": {
        "color": 4,
        "width": 460,
        "height": 1028,
        "content": "## YouTube Video Content Package Generator \u2014 GPT-4o-mini + Gmail\n\nFor YouTube creators, video marketers, and SEO agencies who want a complete ready-to-publish video package from just a topic. Submit the form with your video topic, audience, length, and tone. Two sequential GPT-4o-mini agents run in order \u2014 the first writes a structured full-length video script with hook, three content sections, conclusion, and CTA; the second generates the complete SEO metadata package: an optimized title, three alternative titles at different angles, a full YouTube description with hashtags, 15 tags, and timestamped chapters. Everything arrives in one Gmail email, ready to record and upload. No video generation, no Fal.run, no Upload-Post \u2014 just OpenAI and Gmail.\n\n## How it works\n- **1. Form \u2014 YouTube Content Request** collects video topic, target audience, video length, tone of voice, and your name\n- **2. Set \u2014 Config Values** stores your recipient email, sender name, and channel niche \u2014 plus all form values\n- **3. AI Agent \u2014 Write Video Script** uses GPT-4o-mini at temperature 0.7 to write the full script: Hook, Introduction, three named sections with examples and tips, Conclusion, and Call to Action\n- **5. Set \u2014 Save Script and Config** saves the script output and re-carries all config values to the next agent\n- **6. AI Agent \u2014 Generate SEO Package** uses GPT-4o-mini at temperature 0.3 to generate: main title, 3 alternative titles, full description, 15 tags, and chapters with timestamps\n- **9. Code \u2014 Build Email** reads the SEO output and script, formats them into one structured plain text email with labeled sections\n- **10. Gmail \u2014 Send Content Package** delivers the complete package to your inbox\n\n## Set up steps\n1. In **2. Set \u2014 Config Values** \u2014 replace PASTE_YOUR_EMAIL_HERE, PASTE_YOUR_NAME_HERE, and PASTE_YOUR_CHANNEL_NICHE_HERE\n2. In **4. OpenAI \u2014 Script Model GPT-4o-mini** \u2014 connect your OpenAI credential\n3. In **7. OpenAI \u2014 SEO Model GPT-4o-mini** \u2014 connect your OpenAI credential\n4. In **10. Gmail \u2014 Send Content Package** \u2014 connect your Gmail OAuth2 credential\n5. Activate and open the Form URL to generate your first video package"
      },
      "typeVersion": 1
    },
    {
      "id": "aec5334a-ff99-4020-b02d-2960791a8227",
      "name": "Section \u2014 Form Input and Config",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        736,
        576
      ],
      "parameters": {
        "color": 5,
        "width": 436,
        "height": 372,
        "content": "## Form Input and Config\nUser submits video topic, target audience, video length, tone of voice (optional, defaults to educational), and name. Config stores your email, name, and channel niche \u2014 GPT uses the niche to personalize both the script and the SEO metadata."
      },
      "typeVersion": 1
    },
    {
      "id": "86ec0d09-e94f-469c-9281-4ec2de194d47",
      "name": "Section \u2014 Video Script Writing",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1184,
        432
      ],
      "parameters": {
        "color": 6,
        "width": 292,
        "height": 884,
        "content": "## Video Script Writing\nGPT-4o-mini writes the complete spoken video script at temperature 0.7 for creative output. Structure: Hook (30 sec) \u2192 Introduction \u2192 Section 1 with example \u2192 Section 2 with tip \u2192 Section 3 with common mistake \u2192 Conclusion \u2192 CTA. Plain English, no markdown."
      },
      "typeVersion": 1
    },
    {
      "id": "59e18cbd-3591-499c-ab5a-1e2e8b0157fe",
      "name": "Section \u2014 Script Bridge",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1504,
        544
      ],
      "parameters": {
        "color": 5,
        "width": 308,
        "height": 420,
        "content": "## Script Bridge\nSaves the script from $json.output and re-carries all config values forward so the SEO agent has full context. This Set node is the bridge between the two AI agents."
      },
      "typeVersion": 1
    },
    {
      "id": "9eb89dec-29bf-4a5d-ba95-e66bdb0d9bc0",
      "name": "Section \u2014 SEO Package Generation",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1856,
        448
      ],
      "parameters": {
        "color": 6,
        "width": 356,
        "height": 884,
        "content": "## SEO Package Generation\nGPT-4o-mini generates the complete metadata at temperature 0.3 for precise output. Returns 5 structured fields: main title under 60 chars, 3 alternative titles (curiosity, number, question angles), full description with hashtags, 15 mixed tags, and chapters with timestamps starting at 0:00."
      },
      "typeVersion": 1
    },
    {
      "id": "2f94fd3b-807c-438f-8097-ee6fe1bcc5b5",
      "name": "Section \u2014 Email Assembly and Delivery",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2256,
        560
      ],
      "parameters": {
        "color": 4,
        "width": 484,
        "height": 452,
        "content": "## Email Assembly and Delivery\nBuilds one plain text email with all sections: topic summary, main title and 3 alternatives, 15 tags, chapters, full description, and complete video script. Sends to your inbox in one clean message."
      },
      "typeVersion": 1
    },
    {
      "id": "2a78f64f-7eea-4d5f-9378-6b442190cee2",
      "name": "1. Form \u2014 YouTube Content Request",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        784,
        736
      ],
      "parameters": {
        "options": {},
        "formTitle": "YouTube Video Content Generator",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Video Topic",
              "placeholder": "Example: 5 SEO mistakes law firms make that lose them clients",
              "requiredField": true
            },
            {
              "fieldLabel": "Target Audience",
              "placeholder": "Example: small business owners, personal injury lawyers, SaaS founders",
              "requiredField": true
            },
            {
              "fieldLabel": "Video Length",
              "placeholder": "Example: 8 minutes, 5 minutes, 10 minutes",
              "requiredField": true
            },
            {
              "fieldLabel": "Tone of Voice",
              "placeholder": "Example: educational, motivational, conversational, direct"
            },
            {
              "fieldLabel": "Your Name",
              "placeholder": "Example: Rahul Dutt"
            }
          ]
        },
        "formDescription": "Get a complete YouTube video package \u2014 full script, SEO title, description, tags, and chapters. Ready to record and publish."
      },
      "typeVersion": 2.2
    },
    {
      "id": "d70755c1-cfe1-4e47-91d2-3eab3b508fd4",
      "name": "2. Set \u2014 Config Values",
      "type": "n8n-nodes-base.set",
      "position": [
        1008,
        736
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "cfg-001",
              "name": "recipientEmail",
              "type": "string",
              "value": "PASTE_YOUR_EMAIL_HERE"
            },
            {
              "id": "cfg-002",
              "name": "senderName",
              "type": "string",
              "value": "PASTE_YOUR_NAME_HERE"
            },
            {
              "id": "cfg-003",
              "name": "channelNiche",
              "type": "string",
              "value": "PASTE_YOUR_CHANNEL_NICHE_HERE"
            },
            {
              "id": "cfg-004",
              "name": "videoTopic",
              "type": "string",
              "value": "={{ $json['Video Topic'] }}"
            },
            {
              "id": "cfg-005",
              "name": "targetAudience",
              "type": "string",
              "value": "={{ $json['Target Audience'] }}"
            },
            {
              "id": "cfg-006",
              "name": "videoLength",
              "type": "string",
              "value": "={{ $json['Video Length'] }}"
            },
            {
              "id": "cfg-007",
              "name": "toneOfVoice",
              "type": "string",
              "value": "={{ $json['Tone of Voice'] || 'educational and engaging' }}"
            },
            {
              "id": "cfg-008",
              "name": "submittedBy",
              "type": "string",
              "value": "={{ $json['Your Name'] || 'Unknown' }}"
            },
            {
              "id": "cfg-009",
              "name": "today",
              "type": "string",
              "value": "={{ $now.toFormat('dd MMM yyyy') }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "6914ba84-07ee-4b40-8cde-d96e4cb252a8",
      "name": "3. AI Agent \u2014 Write Video Script",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1232,
        736
      ],
      "parameters": {
        "text": "=You are a professional YouTube scriptwriter for faceless educational videos.\n\nWrite a complete video script for the following:\n\nTopic: {{ $json.videoTopic }}\nTarget audience: {{ $json.targetAudience }}\nVideo length: {{ $json.videoLength }}\nTone: {{ $json.toneOfVoice }}\nChannel niche: {{ $json.channelNiche }}\n\nUse this exact structure. Write in plain spoken English. No bullet points. No markdown. No asterisks.\n\nHOOK\nFirst 30 seconds. 3 to 4 short punchy sentences. Start with a problem or surprising fact. End with a reason to keep watching.\n\nINTRODUCTION\nOne short paragraph. Tell viewers who this video is for and what they will learn.\n\nSECTION 1 \u2014 [write a clear section title here]\n2 to 3 paragraphs. Cover the first main point. Include a specific example.\n\nSECTION 2 \u2014 [write a clear section title here]\n2 to 3 paragraphs. Cover the second main point. Include one practical tip.\n\nSECTION 3 \u2014 [write a clear section title here]\n2 to 3 paragraphs. Cover the third main point. Include a common mistake to avoid.\n\nCONCLUSION\nOne paragraph summarizing the 3 key takeaways.\n\nCALL TO ACTION\n2 sentences. Ask viewers to like, subscribe, and leave a comment with a specific question.",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 1.7
    },
    {
      "id": "669e1e0d-77a7-4fac-ab43-60e9607a46ef",
      "name": "4. OpenAI \u2014 Script Model GPT-4o-mini",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1232,
        1040
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {
          "maxTokens": 2000,
          "temperature": 0.7
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "f0aa8ae5-04c6-4a4b-a090-9d50608908f7",
      "name": "5. Set \u2014 Save Script and Config",
      "type": "n8n-nodes-base.set",
      "position": [
        1616,
        736
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "save-001",
              "name": "videoScript",
              "type": "string",
              "value": "={{ $json.output }}"
            },
            {
              "id": "save-002",
              "name": "videoTopic",
              "type": "string",
              "value": "={{ $('2. Set \u2014 Config Values').item.json.videoTopic }}"
            },
            {
              "id": "save-003",
              "name": "targetAudience",
              "type": "string",
              "value": "={{ $('2. Set \u2014 Config Values').item.json.targetAudience }}"
            },
            {
              "id": "save-004",
              "name": "videoLength",
              "type": "string",
              "value": "={{ $('2. Set \u2014 Config Values').item.json.videoLength }}"
            },
            {
              "id": "save-005",
              "name": "channelNiche",
              "type": "string",
              "value": "={{ $('2. Set \u2014 Config Values').item.json.channelNiche }}"
            },
            {
              "id": "save-006",
              "name": "recipientEmail",
              "type": "string",
              "value": "={{ $('2. Set \u2014 Config Values').item.json.recipientEmail }}"
            },
            {
              "id": "save-007",
              "name": "senderName",
              "type": "string",
              "value": "={{ $('2. Set \u2014 Config Values').item.json.senderName }}"
            },
            {
              "id": "save-008",
              "name": "submittedBy",
              "type": "string",
              "value": "={{ $('2. Set \u2014 Config Values').item.json.submittedBy }}"
            },
            {
              "id": "save-009",
              "name": "today",
              "type": "string",
              "value": "={{ $('2. Set \u2014 Config Values').item.json.today }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "208b2cad-e206-45fb-b0a5-15b6bb03b6e8",
      "name": "6. AI Agent \u2014 Generate SEO Package",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1920,
        736
      ],
      "parameters": {
        "text": "=You are a YouTube SEO expert. Create a complete metadata package for this video.\n\nTopic: {{ $json.videoTopic }}\nAudience: {{ $json.targetAudience }}\nNiche: {{ $json.channelNiche }}\nLength: {{ $json.videoLength }}\n\nReturn ONLY a valid JSON object. No extra text. No markdown. No backticks.\n\nRequired fields:\n\ntitle\nOne YouTube title. Under 60 characters. Include the main keyword. Make it compelling.\n\nalternativeTitles\nArray of 3 alternative titles. Each under 60 characters. One curiosity angle, one number angle, one question angle.\n\ndescription\nFull YouTube description. Under 250 words. Plain text only.\nFirst 2 sentences: hook with the main keyword.\nMiddle: 3 to 4 sentences on what viewers will learn.\nEnd: call to action to subscribe and comment.\nLast line: 3 to 5 hashtags.\n\ntags\nArray of 15 strings. Mix short and long tail keywords. All relevant to the topic and niche.\n\nchapters\nArray of chapter objects. Each object has two fields: timestamp as MM:SS string, and title under 40 characters. First chapter always starts at 0:00. Space them evenly across the video length.",
        "options": {},
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.7
    },
    {
      "id": "c587f315-b783-465c-b76f-1f1ad2de07b8",
      "name": "7. OpenAI \u2014 SEO Model GPT-4o-mini",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1920,
        928
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {
          "maxTokens": 1000,
          "temperature": 0.3
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "b336f777-c7c5-4e64-82fe-c3a2f8985651",
      "name": "8. Parser \u2014 Structured SEO Output",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        2064,
        1136
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"title\": { \"type\": \"string\" },\n    \"alternativeTitles\": { \"type\": \"array\", \"items\": { \"type\": \"string\" } },\n    \"description\": { \"type\": \"string\" },\n    \"tags\": { \"type\": \"array\", \"items\": { \"type\": \"string\" } },\n    \"chapters\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"object\",\n        \"properties\": {\n          \"timestamp\": { \"type\": \"string\" },\n          \"title\": { \"type\": \"string\" }\n        },\n        \"required\": [\"timestamp\", \"title\"]\n      }\n    }\n  },\n  \"required\": [\"title\", \"alternativeTitles\", \"description\", \"tags\", \"chapters\"]\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "a925cdcc-6377-4c67-88c3-ddaa099aa72b",
      "name": "9. Code \u2014 Build Email",
      "type": "n8n-nodes-base.code",
      "position": [
        2336,
        736
      ],
      "parameters": {
        "jsCode": "const seoOutput = $input.first().json.output;\nconst scriptData = $('5. Set \u2014 Save Script and Config').item.json;\n\nif (!seoOutput) {\n  throw new Error('GPT did not return SEO data. Check your OpenAI credential.');\n}\n\nconst title = seoOutput.title || 'Untitled';\nconst altTitles = (seoOutput.alternativeTitles || []).map((t, i) => (i + 1) + '. ' + t).join('\\n');\nconst description = seoOutput.description || 'No description generated.';\nconst tags = (seoOutput.tags || []).join(', ');\nconst chapters = (seoOutput.chapters || []).map(c => c.timestamp + ' ' + c.title).join('\\n');\n\nconst emailBody =\n  'Hello ' + scriptData.senderName + ',\\n\\n' +\n  'Your YouTube content package is ready.\\n\\n' +\n  'Topic: ' + scriptData.videoTopic + '\\n' +\n  'Audience: ' + scriptData.targetAudience + '\\n' +\n  'Length: ' + scriptData.videoLength + '\\n' +\n  'Date: ' + scriptData.today + '\\n\\n' +\n  '============================================================\\n' +\n  'TITLES\\n' +\n  '============================================================\\n\\n' +\n  'Main title:\\n' + title + '\\n\\n' +\n  'Alternative titles to test:\\n' + altTitles + '\\n\\n' +\n  '============================================================\\n' +\n  'TAGS\\n' +\n  '============================================================\\n\\n' +\n  tags + '\\n\\n' +\n  '============================================================\\n' +\n  'CHAPTERS\\n' +\n  '============================================================\\n\\n' +\n  chapters + '\\n\\n' +\n  '============================================================\\n' +\n  'DESCRIPTION\\n' +\n  '============================================================\\n\\n' +\n  description + '\\n\\n' +\n  '============================================================\\n' +\n  'VIDEO SCRIPT\\n' +\n  '============================================================\\n\\n' +\n  scriptData.videoScript + '\\n\\n' +\n  'Best regards,\\n' + scriptData.senderName;\n\nreturn [{\n  json: {\n    emailSubject: 'YouTube Content Package \u2014 ' + title + ' \u2014 ' + scriptData.today,\n    emailBody,\n    recipientEmail: scriptData.recipientEmail\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "bd0d001d-c61f-4114-aab4-87a564922f60",
      "name": "10. Gmail \u2014 Send Content Package",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2560,
        736
      ],
      "parameters": {
        "sendTo": "={{ $json.recipientEmail }}",
        "message": "={{ $json.emailBody }}",
        "options": {
          "appendAttribution": false
        },
        "subject": "={{ $json.emailSubject }}"
      },
      "typeVersion": 2.1
    }
  ],
  "connections": {
    "9. Code \u2014 Build Email": {
      "main": [
        [
          {
            "node": "10. Gmail \u2014 Send Content Package",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2. Set \u2014 Config Values": {
      "main": [
        [
          {
            "node": "3. AI Agent \u2014 Write Video Script",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "5. Set \u2014 Save Script and Config": {
      "main": [
        [
          {
            "node": "6. AI Agent \u2014 Generate SEO Package",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3. AI Agent \u2014 Write Video Script": {
      "main": [
        [
          {
            "node": "5. Set \u2014 Save Script and Config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "1. Form \u2014 YouTube Content Request": {
      "main": [
        [
          {
            "node": "2. Set \u2014 Config Values",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "7. OpenAI \u2014 SEO Model GPT-4o-mini": {
      "ai_languageModel": [
        [
          {
            "node": "6. AI Agent \u2014 Generate SEO Package",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "8. Parser \u2014 Structured SEO Output": {
      "ai_outputParser": [
        [
          {
            "node": "6. AI Agent \u2014 Generate SEO Package",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "6. AI Agent \u2014 Generate SEO Package": {
      "main": [
        [
          {
            "node": "9. Code \u2014 Build Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "4. OpenAI \u2014 Script Model GPT-4o-mini": {
      "ai_languageModel": [
        [
          {
            "node": "3. AI Agent \u2014 Write Video Script",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  }
}