{
  "id": "GtYv5ToTbYHws3v1",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Viral news AI agent for Instagram",
  "tags": [
    {
      "id": "87rqmUYMvRxZKuQC",
      "name": "Gotenberg",
      "createdAt": "2025-12-31T21:11:31.952Z",
      "updatedAt": "2025-12-31T21:11:31.952Z"
    },
    {
      "id": "W7cN2BjW7XOjWnkT",
      "name": "meta",
      "createdAt": "2025-12-31T21:11:25.974Z",
      "updatedAt": "2025-12-31T21:11:25.974Z"
    },
    {
      "id": "WHW7Kccez2bV2IYZ",
      "name": "Instagram Carosuel",
      "createdAt": "2025-12-31T21:11:50.519Z",
      "updatedAt": "2025-12-31T21:11:50.519Z"
    },
    {
      "id": "bJdWsuy5xEJEo5Ok",
      "name": "News",
      "createdAt": "2025-12-31T21:11:55.369Z",
      "updatedAt": "2025-12-31T21:11:55.369Z"
    },
    {
      "id": "oQrKR2P2OcrIAf3A",
      "name": "APITemplate",
      "createdAt": "2025-12-31T21:11:36.832Z",
      "updatedAt": "2025-12-31T21:11:36.832Z"
    }
  ],
  "nodes": [
    {
      "id": "3f97b97a-6a23-48ba-a509-2b92371ea1e2",
      "name": "Designer",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        576,
        288
      ],
      "parameters": {
        "url": "http://gotenberg:3000/forms/chromium/screenshot/html",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "bodyParameters": {
          "parameters": [
            {
              "name": "index.html",
              "parameterType": "formBinaryData",
              "inputDataFieldName": "index_html"
            },
            {
              "name": "width",
              "value": "1080"
            },
            {
              "name": "height",
              "value": "1350"
            },
            {
              "name": "format",
              "value": "jpeg"
            },
            {
              "name": "waitDelay",
              "value": "1s"
            }
          ]
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "0d74e41a-2615-4974-a760-ce0f237f53e0",
      "name": "The Setup",
      "type": "n8n-nodes-base.code",
      "position": [
        -400,
        288
      ],
      "parameters": {
        "jsCode": "// 1. GET DATA\nconst aiItems = $input.all();\nconst formJson = $('SETUP FORM').first().json;\nconst primaryColor = formJson.PRIMARY_COLOR || \"#3B82F6\"; // Uses Form Color or defaults to Blue\n\nlet cleanerItems = [];\ntry { cleanerItems = $('Cleaner').all(); } catch (e) { cleanerItems = []; }\n\nconst results = [];\nconst DEFAULT_BG = \"https://images.unsplash.com/photo-1620712943543-bcc4688e7485?q=80&w=1080&auto=format&fit=crop\";\n\n// Get Today's Date\nconst dateOptions = { month: 'short', day: 'numeric', year: 'numeric' };\nconst today = new Date().toLocaleDateString('en-US', dateOptions).toUpperCase().replace(',', ' \u2022');\n\nfor (let i = 0; i < aiItems.length; i++) {\n  const item = aiItems[i];\n  \n  // --- 2. RESTORE DATA ---\n  let bgImage = DEFAULT_BG;\n  let fallbackTitle = \"Breaking News\";\n  \n  if (cleanerItems.length > i) {\n    if (cleanerItems[i].json.scraped_image) bgImage = cleanerItems[i].json.scraped_image;\n    if (cleanerItems[i].json.title) fallbackTitle = cleanerItems[i].json.title;\n  }\n\n  // --- 3. PARSE AI RESPONSE ---\n  let aiData = {};\n  let rawText = \"\";\n  if (item.json.output && item.json.output[0]?.content && item.json.output[0].content[0]?.text) {\n    rawText = item.json.output[0].content[0].text;\n  } else if (typeof item.json.output === 'string') rawText = item.json.output;\n  else if (item.json.text) rawText = item.json.text;\n\n  try {\n    const cleanText = rawText.replace(/```json/g, \"\").replace(/```/g, \"\").trim();\n    const firstBracket = cleanText.indexOf('{');\n    const lastBracket = cleanText.lastIndexOf('}');\n    if (firstBracket !== -1) aiData = JSON.parse(cleanText.substring(firstBracket, lastBracket + 1));\n    else throw new Error(\"No JSON\");\n  } catch (error) {\n    aiData = { headline: fallbackTitle, category: \"NEWS UPDATE\", caption: \"Link in bio.\" };\n  }\n\n  const headline = (aiData.headline || fallbackTitle).replace(/\"/g, '\"');\n  const category = (aiData.category || \"TECHNOLOGY\").toUpperCase();\n  const caption = (aiData.caption || \"\").replace(/\"/g, '\"');\n  \n  // --- 4. HTML LAYOUT (With Dynamic Color) ---\n  const htmlContent = `\n  <!DOCTYPE html>\n  <html>\n  <head>\n    <style>\n      body { \n        margin: 0; padding: 0; \n        width: 1080px; height: 1350px; \n        background: linear-gradient(rgba(0,0,0,0.85), rgba(0,0,0,0.9)), url('${bgImage}');\n        background-size: cover; background-position: center;\n        font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; \n        color: white; \n        display: flex; flex-direction: column; \n        justify-content: space-between; \n        align-items: center; text-align: center; \n        box-sizing: border-box;\n      }\n      .top-bar {\n        width: 100%; padding-top: 60px;\n        display: flex; justify-content: center;\n      }\n      .date-badge {\n        font-size: 28px; font-weight: 700; letter-spacing: 3px; \n        color: rgba(255,255,255,0.6); text-transform: uppercase;\n        border: 2px solid rgba(255,255,255,0.3);\n        padding: 10px 30px; border-radius: 50px;\n      }\n      .container { \n        padding: 80px; display: flex; flex-direction: column; align-items: center; \n        margin-bottom: 100px;\n      }\n      .category-text {\n        font-size: 34px; font-weight: 800; letter-spacing: 8px; \n        color: ${primaryColor}; /* DYNAMIC COLOR HERE */\n        text-transform: uppercase;\n        margin-bottom: 30px;\n      }\n      .headline { \n        font-size: 95px; line-height: 1.05; font-weight: 900; \n        margin-bottom: 60px; text-shadow: 0px 4px 10px rgba(0,0,0,0.8);\n      }\n      .caption {\n        font-size: 42px; line-height: 1.5; font-weight: 400; color: #e0e0e0;\n        max-width: 950px; \n        border-left: 8px solid ${primaryColor}; /* DYNAMIC COLOR HERE */\n        padding-left: 40px; text-align: left;\n      }\n      .footer { \n        padding-bottom: 50px; font-size: 28px; opacity: 0.5; letter-spacing: 4px; font-weight: 600;\n      }\n    </style>\n  </head>\n  <body>\n    <div class=\"top-bar\">\n      <div class=\"date-badge\">${today}</div>\n    </div>\n    <div class=\"container\">\n      <div class=\"category-text\">${category}</div>\n      <div class=\"headline\">${headline}</div>\n      <div class=\"caption\">${caption}</div>\n    </div>\n    <div class=\"footer\">${formJson.BRAND_NAME}</div>\n  </body>\n  </html>\n  `;\n\n  const binaryData = await this.helpers.prepareBinaryData(Buffer.from(htmlContent), 'index.html', 'text/html');\n\n  results.push({\n    json: { \n      ...item.json, \n      headline, category, caption, \n      image_url: bgImage\n    },\n    binary: { index_html: binaryData }\n  });\n}\n\nreturn results;"
      },
      "typeVersion": 2
    },
    {
      "id": "e44277ec-3c05-4422-9509-f2a9423779fc",
      "name": "News Source",
      "type": "n8n-nodes-base.rssFeedRead",
      "position": [
        -1760,
        288
      ],
      "parameters": {
        "url": "={{ $json.RSS_FEED_URL }}",
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "9867484e-23d3-451c-a899-c731258c27db",
      "name": "AI Analyst",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -752,
        288
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "chatgpt-4o-latest",
          "cachedResultName": "CHATGPT-4O-LATEST"
        },
        "options": {},
        "responses": {
          "values": [
            {
              "content": "=You are a Viral News Editor. Analyze this news:\nHeadline: {{ $json.title }}\nSummary: {{ $json.content }}\n\nTask:\n1. Extract a \"Viral Category\" (Max 2 words, e.g., \"ROBOTICS\", \"AI\", \"SAAS\").\n2. Write a sensational Headline (Max 7 words).\n3. Write a \"Hot Take\" Caption (Max 20 words).\n\nReturn JSON ONLY:\n{\n \"category\": \"ROBOTICS\",\n \"headline\": \"Underwater Drones Just Got Smarter\",\n \"caption\": \"Skana Robotics is changing deep-sea warfare with their new AI comms system.\"\n}"
            }
          ]
        },
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "dada8fa7-d8ce-4ad8-ab35-9197f8f8b0b9",
      "name": "Cleaner",
      "type": "n8n-nodes-base.code",
      "position": [
        -1088,
        288
      ],
      "parameters": {
        "jsCode": "// Get data from the RSS feed (Source) and the Scraper (Current Input)\nconst rssItems = $('News Source').all(); \nconst scrapedItems = $input.all();\nconst results = [];\n\n// Default image if none found\nconst DEFAULT_BG = \"https://images.unsplash.com/photo-1620712943543-bcc4688e7485?q=80&w=1080&auto=format&fit=crop\";\n\nfor (let i = 0; i < scrapedItems.length; i++) {\n  const html = scrapedItems[i].json.data || \"\";\n  let bgImage = DEFAULT_BG;\n\n  // 1. EXTRACT IMAGE FROM HTML (Lightweight Regex)\n  try {\n    const match = html.match(/<meta property=\"og:image\" content=\"([^\"]+)\"/);\n    if (match && match[1]) {\n      bgImage = match[1];\n    }\n  } catch (e) {}\n\n  // 2. MERGE DATA\n  // We take the clean text from RSS and combine it with our new image\n  // We DO NOT pass the 'html' forward, saving thousands of tokens.\n  if (rssItems[i]) {\n    results.push({\n      json: {\n        title: rssItems[i].json.title,\n        content: rssItems[i].json.contentSnippet || rssItems[i].json.content, // Use text only\n        link: rssItems[i].json.link,\n        scraped_image: bgImage\n      }\n    });\n  }\n}\n\nreturn results;"
      },
      "typeVersion": 2
    },
    {
      "id": "776a4a02-900f-488c-9db4-5e23dfd2f00c",
      "name": "Get Article HTML",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1312,
        288
      ],
      "parameters": {
        "url": "={{ $json.link }}",
        "options": {
          "redirect": {
            "redirect": {}
          },
          "response": {
            "response": {
              "responseFormat": "text"
            }
          }
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "2d1eb999-1654-438e-8df5-337cdb32292f",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -48,
        288
      ],
      "parameters": {
        "options": {},
        "batchSize": 10
      },
      "typeVersion": 3
    },
    {
      "id": "a65ca63c-0d73-414f-b291-c9a2ff83d8d8",
      "name": "Create Container",
      "type": "n8n-nodes-base.facebookGraphApi",
      "position": [
        1680,
        496
      ],
      "parameters": {
        "edge": "media",
        "node": "REPLACE_WITH_YOUR_ID",
        "options": {
          "queryParameters": {
            "parameter": [
              {
                "name": "image_url",
                "value": "=https://lh3.googleusercontent.com/d/{{ $('Upload file').item.json.id }}"
              },
              {
                "name": "is_carousel_item",
                "value": "true"
              }
            ]
          }
        },
        "graphApiVersion": "v23.0",
        "httpRequestMethod": "POST"
      },
      "credentials": {
        "facebookGraphApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "9f1aa68d-f0c7-4402-a29a-b7b2a28ecd21",
      "name": "Carousel Bundle",
      "type": "n8n-nodes-base.facebookGraphApi",
      "position": [
        1424,
        192
      ],
      "parameters": {
        "edge": "media",
        "node": "REPLACE_WITH_YOUR_ID",
        "options": {
          "queryParameters": {
            "parameter": [
              {
                "name": "media_type",
                "value": "CAROUSEL"
              },
              {
                "name": "children",
                "value": "={{ $json.children_string }}"
              },
              {
                "name": "caption",
                "value": "={{ $json.caption }}"
              }
            ]
          }
        },
        "graphApiVersion": "v23.0",
        "httpRequestMethod": "POST"
      },
      "credentials": {
        "facebookGraphApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "2397a867-2b68-4869-9d5f-fdec7831baaa",
      "name": "Upload file",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1200,
        384
      ],
      "parameters": {
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "172cYWt7ryoD6QqNpnC_e8HwpRQrGUiah",
          "cachedResultUrl": "https://drive.google.com/drive/folders/172cYWt7ryoD6QqNpnC_e8HwpRQrGUiah",
          "cachedResultName": "Viral News"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "f42a3056-9e87-471c-b113-79e54c31e9b8",
      "name": "Share file",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1424,
        384
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        },
        "options": {},
        "operation": "share",
        "permissionsUi": {
          "permissionsValues": {
            "role": "reader",
            "type": "anyone",
            "allowFileDiscovery": true
          }
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "ec33bd2e-f7bd-44cd-8d8e-79aa3d9aa9e0",
      "name": "Publish Carousel",
      "type": "n8n-nodes-base.facebookGraphApi",
      "position": [
        1648,
        192
      ],
      "parameters": {
        "edge": "media_publish",
        "node": "REPLACE_WITH_YOUR_ID",
        "options": {
          "queryParameters": {
            "parameter": [
              {
                "name": "creation_id",
                "value": "={{ $json.id }}"
              }
            ]
          }
        },
        "graphApiVersion": "v23.0",
        "httpRequestMethod": "POST"
      },
      "credentials": {
        "facebookGraphApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "df60f9c8-6a31-4e2e-a7c5-521cc2ad74cb",
      "name": "Carousel Prep",
      "type": "n8n-nodes-base.code",
      "position": [
        1200,
        192
      ],
      "parameters": {
        "jsCode": "// 1. Fetch IDs from the Facebook node to link the carousel\nconst containerItems = $('Create Container').all();\nconst mediaIds = containerItems.map(item => item.json.id).slice(0, 10);\n\n// 2. Fetch the Headlines from the AI node for the caption list\nconst aiItems = $('AI Analyst').all();\nconst headlineList = aiItems\n  .map(item => {\n    let headline = \"News Update\";\n    \n    // Extracting headline from the AI JSON output\n    try {\n      let rawText = \"\";\n      if (item.json.output && item.json.output[0]?.content) {\n        rawText = item.json.output[0].content[0].text;\n      } else if (typeof item.json.output === 'string') {\n        rawText = item.json.output;\n      }\n      \n      const cleanText = rawText.replace(/```json/g, \"\").replace(/```/g, \"\").trim();\n      const data = JSON.parse(cleanText);\n      headline = data.headline;\n    } catch (e) {\n      // Fallback to original RSS title if parsing fails\n      headline = item.json.title || \"Breaking News\";\n    }\n    \n    return `\u25aa\ufe0f ${headline}`;\n  })\n  .slice(0, 10) // Ensure we only list the 10 slides\n  .join('\\n');\n\n// 3. Format Today's Date (e.g., \"DEC 30\")\nconst dateOptions = { month: 'short', day: 'numeric' };\nconst today = new Date().toLocaleDateString('en-US', dateOptions).toUpperCase();\n\n// 4. Build the final professional caption\nconst finalCaption = `\u26a1 DAILY TECH BRIEF \u2022 ${today}\n\n${headlineList}\n\n\ud83d\udd17 Link in Bio for full stories.\n\n#TECH #AI #TechNews #Pixril`;\n\nreturn {\n  json: {\n    children_string: mediaIds.join(','),\n    caption: finalCaption\n  }\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "5e9c9d86-e82c-4d2d-88ac-4c507c4d131d",
      "name": "SETUP FORM",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -1984,
        288
      ],
      "parameters": {
        "options": {
          "customCss": ":root {\n  /* --- CYBERPUNK THEME --- */\n  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif;\n  \n  /* Colors */\n  --color-background: #0f111a; /* Dark Navy Background */\n  --color-card-bg: #1e2130;    /* Lighter Navy Card */\n  --color-card-border: #2d3248;\n  --color-card-shadow: rgba(0, 0, 0, 0.4);\n  \n  --color-header: #ffffff;\n  --color-header-subtext: #a0aec0;\n  --color-label: #cbd5e0;\n  \n  /* Input Fields */\n  --color-input-bg: #151823;\n  --color-input-border: #2d3248;\n  --color-input-text: #ffffff;\n  --color-focus-border: #3B82F6; /* Bright Blue Focus */\n  \n  /* Buttons */\n  --color-submit-btn-bg: #3B82F6;\n  --color-submit-btn-text: #ffffff;\n  --color-submit-btn-hover: #2563EB;\n  \n  /* Dimensions & Spacing */\n  --border-radius-card: 12px;\n  --border-radius-input: 8px;\n  --container-width: 500px;\n  --submit-btn-height: 52px;\n}\n\n/* Body Background */\nbody {\n  background-color: var(--color-background) !important;\n  color: var(--color-input-text);\n}\n\n/* Card Styling */\n.n8n-form-container {\n  box-shadow: 0 10px 40px -10px rgba(0,0,0,0.5);\n  border: 1px solid var(--color-card-border);\n}\n\n/* Header Typography */\nh1 {\n  font-weight: 800 !important;\n  letter-spacing: -0.5px;\n  background: linear-gradient(to right, #fff, #a0aec0);\n  -webkit-background-clip: text;\n  -webkit-text-fill-color: transparent;\n}\n\n/* Input Styling */\ninput, select, textarea {\n  background-color: var(--color-input-bg) !important;\n  border-color: var(--color-input-border) !important;\n  color: white !important;\n  transition: all 0.2s ease;\n}\n\ninput:focus, select:focus {\n  border-color: var(--color-focus-border) !important;\n  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);\n}\n\n/* Button Styling */\nbutton[type=\"submit\"] {\n  background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);\n  font-weight: 600;\n  letter-spacing: 0.5px;\n  text-transform: uppercase;\n  font-size: 14px;\n  transition: transform 0.1s;\n}\n\nbutton[type=\"submit\"]:hover {\n  transform: translateY(-1px);\n  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);\n}"
        },
        "formTitle": "AI News Carousel Setup",
        "formFields": {
          "values": [
            {
              "fieldLabel": "RSS_FEED_URL",
              "placeholder": "e.g. https://techcrunch.com/feed/",
              "requiredField": true
            },
            {
              "fieldLabel": "BRAND_NAME",
              "placeholder": "e.g. PIXRIL",
              "requiredField": true
            },
            {
              "fieldLabel": "PRIMARY_COLOR",
              "placeholder": "e.g. #FF5733",
              "requiredField": true
            },
            {
              "fieldType": "dropdown",
              "fieldLabel": "IMAGE_ENGINE",
              "fieldOptions": {
                "values": [
                  {
                    "option": "FREE_GOTENBERG"
                  },
                  {
                    "option": "PAID_APITEMPLATE"
                  }
                ]
              },
              "requiredField": true
            }
          ]
        },
        "formDescription": "Enter your details to generate today's viral carousels."
      },
      "typeVersion": 2.3
    },
    {
      "id": "7e836ec0-cfff-437c-97ee-a6789e5c101a",
      "name": "Route by Engine",
      "type": "n8n-nodes-base.switch",
      "position": [
        192,
        304
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Gotenberg",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "5f94db4e-f2ba-4766-a8f2-781bdd9f4f2d",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $(\"SETUP FORM\").first().json.IMAGE_ENGINE }}",
                    "rightValue": "FREE_GOTENBERG"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "APITemplate",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "3c31ec43-8900-49fe-84a7-b460a8cb8544",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $(\"SETUP FORM\").first().json.IMAGE_ENGINE }}",
                    "rightValue": "PAID_APITEMPLATE"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.3
    },
    {
      "id": "d5aed350-2b88-477b-aa0c-a462f4b20d9c",
      "name": "Download Image",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        592,
        480
      ],
      "parameters": {
        "url": "={{ $json.download_url || $json.url }}",
        "options": {
          "response": {
            "response": {
              "responseFormat": "file"
            }
          }
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "adc26ef8-9d4a-4e63-9a97-9ff01f04f815",
      "name": "Generate Image",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        368,
        480
      ],
      "parameters": {
        "url": "https://rest.apitemplate.io/v2/create-image",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"overrides\": [\n    {\n      \"name\": \"headline\",\n      \"text\": \"{{ $json.headline }}\"\n    },\n    {\n      \"name\": \"category\",\n      \"text\": \"{{ $json.category }}\"\n    },\n    {\n      \"name\": \"caption\",\n      \"text\": \"{{ $json.caption }}\"\n    },\n    {\n      \"name\": \"background_image\",\n      \"src\": \"{{ $json.image_url.split(',')[0] }}\"\n    },\n    {\n      \"name\": \"footer\",\n      \"text\": \"{{ $('SETUP FORM').first().json.BRAND_NAME }}\"\n    },\n    {\n      \"name\": \"date\",\n      \"text\": \"{{ new Date().toLocaleDateString('en-US', { month: 'short', day: 'numeric' }).toUpperCase() }}\"\n    }\n  ]\n}",
        "sendBody": true,
        "sendQuery": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "queryParameters": {
          "parameters": [
            {
              "name": "template_id",
              "value": "PASTE_YOUR_TEMPLATE_ID_HERE"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "X-API-KEY",
              "value": "PASTE_YOUR_KEY_HERE"
            }
          ]
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "cee28420-a456-4037-ab88-7a33ed386532",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2096,
        -432
      ],
      "parameters": {
        "width": 544,
        "height": 496,
        "content": "## Viral News Agent (Instagram)\nThis workflow acts as a fully autonomous \"News Agency.\" It scrapes RSS feeds, uses AI to write viral scripts, designs carousel slides, and auto-posts to Instagram.\n\n## How it works\n1. **Scrape:** Monitors RSS feeds (Tech, Sports, etc.) for breaking news.\n2. **Analyze:** GPT-4o extracts viral hooks and writes a 10-slide script.\n3. **Design:** Generates images using either **Gotenberg (Free)** or **APITemplate (Paid)**.\n4. **Publish:** Uploads the carousel to Instagram Business.\n\n## Setup Steps\n1. **Credentials:** Connect OpenAI, Google Drive, and Facebook Graph API.\n2. **Instagram ID:** Open the 3 Facebook nodes (\"Create Container\", \"Bundle\", \"Publish\") and replace the default ID with your **Instagram Business Account ID**.\n3. **Image Engine:** In the \"Generate Image\" node, add your API Key if using the Paid mode. If using Free, ensure Docker is running Gotenberg."
      },
      "typeVersion": 1
    },
    {
      "id": "18c7edc7-54c1-49ba-b130-a7a7733b2b8a",
      "name": "Limit to Top 10",
      "type": "n8n-nodes-base.limit",
      "position": [
        -1536,
        288
      ],
      "parameters": {
        "maxItems": 10
      },
      "typeVersion": 1
    },
    {
      "id": "4f2cec77-fe6f-46f8-997d-287ddc97626f",
      "name": "Wait for Processing",
      "type": "n8n-nodes-base.wait",
      "position": [
        816,
        384
      ],
      "parameters": {
        "amount": 1
      },
      "typeVersion": 1.1
    },
    {
      "id": "2bc8214f-d1b7-4900-8fd5-f75110553cca",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2080,
        176
      ],
      "parameters": {
        "color": 7,
        "width": 1152,
        "height": 288,
        "content": "## 1. Input & Scraping\nFetches RSS feed, limits to top 10, and extracts clean data."
      },
      "typeVersion": 1
    },
    {
      "id": "83ab2198-bc4a-4186-916f-a4b433db4a15",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -816,
        176
      ],
      "parameters": {
        "color": 7,
        "width": 576,
        "height": 304,
        "content": "## 2. AI Content Generation\nUses GPT-4o to analyze the news content and generate viral hooks, headlines, and captions."
      },
      "typeVersion": 1
    },
    {
      "id": "adaf67bd-4469-4e34-8f18-1a6bd0fbe40f",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -128,
        160
      ],
      "parameters": {
        "color": 7,
        "width": 1152,
        "height": 480,
        "content": "## 3. Image Engine\nIterates through each news item. Based on user selection, it routes data to either Gotenberg (Free) or APITemplate (Paid) to generate the slide."
      },
      "typeVersion": 1
    },
    {
      "id": "facc7f22-9afc-4ffc-8adf-17339ae90d51",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1136,
        96
      ],
      "parameters": {
        "color": 7,
        "width": 832,
        "height": 672,
        "content": "## 4. Instagram Publishing\nUploads images, bundles the carousel, and publishes to Instagram."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "12b00d09-35c8-48f4-bed4-a74bbdff6c4f",
  "connections": {
    "Cleaner": {
      "main": [
        [
          {
            "node": "AI Analyst",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Designer": {
      "main": [
        [
          {
            "node": "Wait for Processing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "The Setup": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Analyst": {
      "main": [
        [
          {
            "node": "The Setup",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SETUP FORM": {
      "main": [
        [
          {
            "node": "News Source",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Share file": {
      "main": [
        [
          {
            "node": "Create Container",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "News Source": {
      "main": [
        [
          {
            "node": "Limit to Top 10",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload file": {
      "main": [
        [
          {
            "node": "Share file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Carousel Prep": {
      "main": [
        [
          {
            "node": "Carousel Bundle",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Image": {
      "main": [
        [
          {
            "node": "Wait for Processing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Image": {
      "main": [
        [
          {
            "node": "Download Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Carousel Bundle": {
      "main": [
        [
          {
            "node": "Publish Carousel",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Limit to Top 10": {
      "main": [
        [
          {
            "node": "Get Article HTML",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Carousel Prep",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Route by Engine",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route by Engine": {
      "main": [
        [
          {
            "node": "Designer",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Generate Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Container": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Article HTML": {
      "main": [
        [
          {
            "node": "Cleaner",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait for Processing": {
      "main": [
        [
          {
            "node": "Upload file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}