{
  "id": "a4d6P2zOHAlAPWYH",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Lead Magnet Creation - Santhej Kallada",
  "tags": [
    {
      "id": "o5lUbXtRS653224b",
      "name": "tutorials",
      "createdAt": "2025-10-29T07:23:26.446Z",
      "updatedAt": "2025-10-29T07:23:26.446Z"
    }
  ],
  "nodes": [
    {
      "id": "4e09788c-dcb5-4c9b-88e3-ee87c2117c61",
      "name": "On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -1184,
        272
      ],
      "parameters": {
        "options": {},
        "formTitle": "Lead Magnet Generator",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Lead Magnet Topic",
              "requiredField": true
            },
            {
              "fieldLabel": "Target Audience(Please mention country, age, interests. More details will give you better output)",
              "requiredField": true
            },
            {
              "fieldLabel": "Call To Action",
              "requiredField": true
            },
            {
              "fieldLabel": "Email ID(To Get Lead Magnet Delivered)",
              "requiredField": true
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "2f3d9487-3494-481b-a144-d758b351cc8f",
      "name": "Title And Outline Generator",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -976,
        272
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-5",
          "cachedResultName": "GPT-5"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "=You are a world-renowned Lead Magnet Creation Strategist with expertise in high-converting digital marketing assets.\n\nYour mission is to create a compelling lead magnet that serves as a strategic bridge between free value and paid offerings, designed to generate qualified leads and drive conversions.\n\n**INPUT VARIABLES:**\n- Lead Magnet Topic: {{ $json['Lead Magnet Topic'] }}\n- Target Audience: {{ $json['Target Audience(Please mention country, age, interests. More details will give you better output)'] }}\n- Call To Action: {{ $json['Call To Action'] }}\n\n\n**REQUIREMENTS:**\n1. Create a magnetic title that promises specific, valuable outcomes\n2. Develop a detailed outline with 5-7 actionable sections\n3. Ensure content directly addresses target audience pain points\n4. Include strategic positioning for the call-to-action\n5. Suggest optimal format (PDF guide, checklist, template, video series, etc.)\n\n**OUTPUT FORMAT:**\nProvide response in JSON format with the following structure:\n\n```json\n{\n  \"title\": \"Compelling lead magnet title with benefit-driven language\",\n  \"subtitle\": \"Supporting subtitle that clarifies the value proposition\",\n  \"recommended_format\": \"PDF Guide/Checklist/Template/Video Series/etc.\",\n  \"target_outcome\": \"Specific result the audience will achieve\",\n  \"outline\": [\n    {\n      \"section\": \"Section 1 Title\",\n      \"description\": \"What this section covers and why it matters\",\n      \"key_points\": [\"Point 1\", \"Point 2\", \"Point 3\"]\n    },\n    {\n      \"section\": \"Section 2 Title\", \n      \"description\": \"Content description\",\n      \"key_points\": [\"Point 1\", \"Point 2\", \"Point 3\"]\n    }\n  ],\n  \"cta_integration\": {\n    \"placement\": \"Where to place the CTA within the lead magnet\",\n    \"messaging\": \"Specific CTA copy that connects to the paid offer\",\n    \"transition_strategy\": \"How to naturally bridge from free to paid content\"\n  },\n  \"bonus_elements\": [\"Additional value-adds to increase perceived worth\"],\n  \"estimated_page_count\": \"Number of pages for the lead magnet\",\n  \"urgency_elements\": [\"Time-sensitive components to encourage immediate action\"]\n}"
            }
          ]
        },
        "jsonOutput": true
      },
      "typeVersion": 1.8
    },
    {
      "id": "cdf45c98-1560-4619-85f0-bb818f3b95b8",
      "name": "Split Out",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        -624,
        272
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "message.content.outline"
      },
      "typeVersion": 1
    },
    {
      "id": "41e3cb0f-9f5d-47db-8c8e-330ea893fe8d",
      "name": "Aggregate",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        -64,
        272
      ],
      "parameters": {
        "options": {},
        "fieldsToAggregate": {
          "fieldToAggregate": [
            {
              "fieldToAggregate": "message.content"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "f1e60f6c-9ee4-4df1-9e58-8c3a0cc0cd43",
      "name": "Create a document",
      "type": "n8n-nodes-base.googleDocs",
      "disabled": true,
      "position": [
        -352,
        -224
      ],
      "parameters": {
        "title": "= {{ $('Title And Outline Generator').item.json.message.content.title }}",
        "folderId": "=1v9r7xQcDo2AtghGsx069QAOjL1Ki90R2"
      },
      "typeVersion": 2
    },
    {
      "id": "57516bd2-ece4-47c3-a9a3-eeb5f081081e",
      "name": "Markdown",
      "type": "n8n-nodes-base.markdown",
      "position": [
        496,
        272
      ],
      "parameters": {
        "mode": "markdownToHtml",
        "options": {},
        "markdown": "={{ $json.message.content }}"
      },
      "typeVersion": 1
    },
    {
      "id": "0782a0bf-e6e9-49fa-8035-93a58e346923",
      "name": "CreateGoogleDoc1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1200,
        272
      ],
      "parameters": {
        "url": "https://www.googleapis.com/upload/drive/v3/files",
        "body": "={{ $json.rawData }}",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "sendQuery": true,
        "contentType": "raw",
        "authentication": "predefinedCredentialType",
        "rawContentType": "multipart/related; boundary=divider",
        "queryParameters": {
          "parameters": [
            {
              "name": "uploadType",
              "value": "multipart"
            },
            {
              "name": "supportsAllDrives",
              "value": "true"
            }
          ]
        },
        "nodeCredentialType": "googleDriveOAuth2Api"
      },
      "notesInFlow": true,
      "typeVersion": 4.2
    },
    {
      "id": "1b3f3f00-4dd8-4961-ac54-9fe797038b9f",
      "name": "set_fields",
      "type": "n8n-nodes-base.set",
      "position": [
        720,
        272
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "e7ee03ac-13e3-4fca-a7bc-57c8fc56dc42",
              "name": "document_name",
              "type": "string",
              "value": "={{ $('Title And Outline Generator').item.json.message.content.title }}"
            },
            {
              "id": "48a07ef2-ae46-4bfc-aa7e-d92a74ef46d6",
              "name": "html_content",
              "type": "string",
              "value": "={{ $('Markdown').item.json.data }}"
            },
            {
              "id": "22b02fba-ba72-423a-b92f-1191a183a554",
              "name": "drive_folder_id",
              "type": "string",
              "value": "=1v9r7xQcDo2AtghGsx069QAOjL1Ki90R2"
            }
          ]
        }
      },
      "notesInFlow": true,
      "typeVersion": 3.4
    },
    {
      "id": "1176e431-334e-4979-99c5-8edda5014ac4",
      "name": "Prepare_Request",
      "type": "n8n-nodes-base.code",
      "position": [
        944,
        272
      ],
      "parameters": {
        "jsCode": "const boundary = 'divider';\nconst docName = $input.first().json.document_name;\nconst folderId = $input.first().json.drive_folder_id;\nconst htmlContent = $input.first().json.html_content;\n\nconst metadata = JSON.stringify({\n  name: docName,\n  mimeType: \"application/vnd.google-apps.document\",\n  parents: [folderId]\n});\n\nconst htmlWithStyles = `\n<!DOCTYPE html>\n<html>\n<head>\n  <meta charset=\"UTF-8\">\n  <style>\n    /* Add bottom margin to block elements for spacing */\n    p,\n    ul,\n    ol,\n    table,\n    h1,\n    h2,\n    h3,\n    h4,\n    h5,\n    h6 {\n      margin-bottom: 10pt;\n    }\n\n    h2 {\n      margin-top: 20pt;\n    }\n\n    /* Prevent margin collapse issues or excessive space inside lists */\n    li {\n       margin-bottom: 2pt; /* Optional: small space between list items */\n    }\n\n    /* Remove margin from the last child within common containers if needed */\n    /* This might be overly aggressive, test without it first */\n    /*\n    body > *:last-child,\n    li > *:last-child {\n       margin-bottom: 0;\n    }\n    */\n  </style>\n</head>\n<body>\n  ${htmlContent}\n</body>\n</html>\n`;\n\n// Construct the body with literal \\r\\n ONLY\nlet body = `--${boundary}\\r\\n`;\nbody += `Content-Type: application/json; charset=UTF-8\\r\\n`;\nbody += `\\r\\n`; // Blank line\nbody += `${metadata}\\r\\n`;\nbody += `--${boundary}\\r\\n`;\nbody += `Content-Type: text/html\\r\\n`;\nbody += `\\r\\n`; // Blank line\nbody += `${htmlWithStyles}\\r\\n`; // Add the HTML content\nbody += `--${boundary}--\\r\\n`; // Final boundary\n\nreturn {\n  rawData: body \n};"
      },
      "typeVersion": 2
    },
    {
      "id": "d1b32756-c1c0-4bc1-9a72-221be9b5fde6",
      "name": "Create Sections",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -416,
        272
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "id",
          "value": "anthropic/claude-sonnet-4"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=You are an expert Lead Magnet Creator. Your duty is to write content for difference sections in a lead magnet.\n\nLead Magnet Details:\nTitle: : {{ $('Title And Outline Generator').item.json.message.content.title }}\nSubtitle : {{ $('Title And Outline Generator').item.json.message.content.subtitle }}\nTarget Outcome : {{ $('Title And Outline Generator').item.json.message.content.target_outcome }}\n\nFor now write the contents for this section:\nSection Title: {{ $json.section }}\nSection Description: {{ $json.description }}\n\nKey Points To Be Discussed:\n{{ $json.key_points[0] }}\n{{ $json.key_points[1] }}\n{{ $json.key_points[2] }}\n{{ $json.key_points[3] }}\n{{ $json.key_points[4] }}"
            }
          ]
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "7cd2599c-6928-4e24-b795-a76cac4f9ac1",
      "name": "Markdown Generator",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        144,
        272
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-5-mini-2025-08-07",
          "cachedResultName": "GPT-5-MINI-2025-08-07"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "content": "=You are an expert lead magnet creator. Here are the contents for the lead magnet.\n\nYour duty is create a the lead magnet in markdown format using the contents below. \n\nTitle: {{ $('Title And Outline Generator').item.json.message.content.title }}\n\nContent: {{ $json.content }}"
            }
          ]
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "13d67bd4-9c32-4d72-9a75-f067fa24c03a",
      "name": "Send a message",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1408,
        272
      ],
      "parameters": {
        "sendTo": "={{ $('On form submission').item.json[\"Email ID(To Get Lead Magnet Delivered)\"] }}",
        "message": "=Lead Magnet Link: https://docs.google.com/document/d/{{ $json.id }}",
        "options": {},
        "subject": "Your Lead Magnet Is Here",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "3a7f83a9-6018-4285-879f-1603d7577d26",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        672,
        -464
      ],
      "parameters": {
        "color": 3,
        "width": 856,
        "height": 532,
        "content": "# Template Customization Services\n\nFor professional template customization and consultation, please connect with me on LinkedIn:\n\n## **[Connect on LinkedIn](https://www.linkedin.com/in/santhej/)**\n\n# Exclusive Automation Resources\n\nAccess our comprehensive library of automation templates and advanced AI solutions through our professional community:\n\n## **[Join AI Growth Tribe](links.aigrowthtribe.com/skool)**\n\n### *Unlock premium automation templates and connect with industry professionals advancing AI implementation strategies.*\n\n---\n## Template Created by Santhej Kallada"
      },
      "typeVersion": 1
    },
    {
      "id": "d6952a55-11ef-4113-be00-6ff365f6a9d6",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1248,
        -512
      ],
      "parameters": {
        "width": 704,
        "height": 400,
        "content": "## How it works\nThis workflow creates complete lead magnet plans automatically using n8n, OpenAI and Claude AI. When a user fills the form, n8n collects the topic or niche and then sends it to the AI models to prepare structure, titles and detailed content. It then combines all the text sections, formats the content into Markdown or Google Docs, and finally sends the ready document by email.\n\nThe process is simple and fast. It is made to help marketers and freelancers build professional lead magnet documents in less time. You can change the prompts or text format as per your project requirement.\n\n## Setup steps\n1. Connect OpenAI and Claude API keys in n8n credentials.  \n2. Configure the form or trigger node to take topic input.  \n3. Edit prompt text inside \u201cTitle and Outline Generator\u201d or \u201cCreate Sections\u201d nodes.  \n4. Add your Google Drive and Gmail credentials for final export.  \n5. Run the workflow once to check output and then make it active.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "1b32a288-54a5-493f-bfd9-9f6c5714dbf8",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1264,
        128
      ],
      "parameters": {
        "color": 6,
        "width": 768,
        "height": 336,
        "content": "## Input and Idea Generation\nThis part collects topic or keyword from the form and sends it to OpenAI to make title ideas and outlines. The output is split into sections that can be expanded later."
      },
      "typeVersion": 1
    },
    {
      "id": "5d6ea28a-c724-4e96-9a64-a838f09933d4",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -448,
        128
      ],
      "parameters": {
        "color": 6,
        "width": 1088,
        "height": 336,
        "content": "## Section Content Creation\nHere AI models generate content for each section of the lead magnet. It merges all sections together, then formats the result in Markdown for better structure and readability.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "a4746363-4082-4161-ad8e-8e02f6109fab",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        688,
        128
      ],
      "parameters": {
        "color": 6,
        "width": 848,
        "height": 336,
        "content": "## Document Creation and Delivery\nThis part converts the final text into a Google Doc and sends it by email. It uses Gmail node for delivery, so user receives a ready lead magnet file instantly."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "e56c998d-8bb3-4a1b-b4e8-f2fbd5723d47",
  "connections": {
    "Markdown": {
      "main": [
        [
          {
            "node": "set_fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate": {
      "main": [
        [
          {
            "node": "Markdown Generator",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out": {
      "main": [
        [
          {
            "node": "Create Sections",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "set_fields": {
      "main": [
        [
          {
            "node": "Prepare_Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Sections": {
      "main": [
        [
          {
            "node": "Aggregate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare_Request": {
      "main": [
        [
          {
            "node": "CreateGoogleDoc1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "CreateGoogleDoc1": {
      "main": [
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Markdown Generator": {
      "main": [
        [
          {
            "node": "Markdown",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Title And Outline Generator",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Title And Outline Generator": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}