{
  "name": "Gamma AI Carousel Maker",
  "nodes": [
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        -1568,
        64
      ],
      "id": "3794aae5-7afc-4f89-9584-65f5cbeb5d23",
      "name": "When clicking ‘Execute workflow’"
    },
    {
      "parameters": {
        "documentId": {
          "__rl": true,
          "value": "1j0ow7pG6PH1FpFCJo1Nu0OyXwzZo-ZjHA52UCfO9-kg",
          "mode": "list",
          "cachedResultName": "Social Media",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1j0ow7pG6PH1FpFCJo1Nu0OyXwzZo-ZjHA52UCfO9-kg/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Sheet1",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1j0ow7pG6PH1FpFCJo1Nu0OyXwzZo-ZjHA52UCfO9-kg/edit#gid=0"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        -1408,
        64
      ],
      "id": "4573d358-05cd-4997-b4bf-a33587ad407b",
      "name": "Get Article",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "eI6LlJqGRcrJCtWI",
          "name": "Owais Google Sheets"
        }
      }
    },
    {
      "parameters": {
        "url": "={{ $json.URL }}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.3,
      "position": [
        -1248,
        64
      ],
      "id": "0fd97641-e571-4e9a-a222-dd6cda0d8517",
      "name": "Scrape Article"
    },
    {
      "parameters": {
        "modelId": {
          "__rl": true,
          "value": "models/gemini-2.0-flash-lite-preview-02-05",
          "mode": "list",
          "cachedResultName": "models/gemini-2.0-flash-lite-preview-02-05"
        },
        "messages": {
          "values": [
            {
              "content": "=You are a content extraction assistant. Clean up the following HTML content from a news article and extract only the essential information.\n\nRemove all:\n- HTML tags and formatting\n- Navigation menus, headers, footers\n- Ads and promotional content\n- Social media buttons and sharing widgets\n- Comments sections\n- Related articles suggestions\n- Author bios (unless directly relevant)\n- Cookie notices and popups\n\nReturn only:\n- Article headline/title\n- Main article body text\n- Key facts and statistics\n- Important quotes\n\nFormat the output as clean, readable text with proper paragraph breaks. Keep the content concise and focused on the core message of the article.\n\n---\n\nHTML CONTENT:\n{{ $json.data }}"
            }
          ]
        },
        "simplify": false,
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "typeVersion": 1,
      "position": [
        -1072,
        64
      ],
      "id": "e718aaa5-3b14-4e64-9dc7-f99bb24d689e",
      "name": "Simplify Article",
      "credentials": {
        "googlePalmApi": {
          "id": "DoB65OKBWKlUA9hu",
          "name": "Owais Google Gemini(PaLM) Api"
        }
      }
    },
    {
      "parameters": {
        "amount": 20
      },
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        -368,
        64
      ],
      "id": "7e736ff2-a8fc-4ba0-af7e-9dc39db27449",
      "name": "Wait",
      "webhookId": "6f2d1ddf-4a9e-4a48-9c8c-942c1951bea2"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "3a89ab80-28e8-4db5-b677-95774902ecd9",
              "leftValue": "={{ $json.name }}",
              "rightValue": "completed",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        -32,
        64
      ],
      "id": "0de1f9cf-c3d5-4a66-9479-e57ec072e053",
      "name": "If"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.presenton.ai/api/v1/ppt/presentation/generate",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            },
            {
              "name": "Authorization",
              "value": "Bearer sk-presenton-08e6076dfe0e3d91082f1e88ec7f7da0c74fd2b34920f8c5a7efce74080d9ef47f4c9814b097b91de04918d0369e81046b3f155114dab698ef32b894038198d8"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"content\": \"{{ $json.presentationContent }} Create a 3-card social media carousel based on this article. Extract the most important insights, create a short headline, and break the content into 3 clean slides. Do not use markdown.\",\n  \"textMode\": \"condense\",\n  \"format\": \"social\",\n  \"themeId\": \"moss-and-mist\",\n  \"numCards\": 3,\n  \"cardSplit\": \"auto\",\n  \"additionalInstructions\": \"Card 1: A bold 5–6 word headline with a large centered hero image, bottom text 'Swipe for more →'. Card 2–3: 1 main point per card with a short explanation (20–30 words) and an AI-generated illustration. Keep the design clean and modern.\",\n  \"textOptions\": {\n    \"amount\": \"detailed\"\n  },\n  \"imageOptions\": {\n    \"source\": \"aiGenerated\",\n    \"model\": \"flux-2-pro\"\n  },\n  \"cardOptions\": {\n    \"dimensions\": \"4x5\"\n  },\n  \"sharingOptions\": {\n    \"workspaceAccess\": \"view\",\n    \"externalAccess\": \"noAccess\"\n  }\n}\n",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.3,
      "position": [
        -576,
        64
      ],
      "id": "1a15e9a3-50ab-4801-b314-73fc62837f3b",
      "name": "Create Post with Gamma"
    },
    {
      "parameters": {
        "url": "=https://api.presenton.ai/api/v1/ppt/template/{{ $json.presentation_id }}",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer sk-presenton-08e6076dfe0e3d91082f1e88ec7f7da0c74fd2b34920f8c5a7efce74080d9ef47f4c9814b097b91de04918d0369e81046b3f155114dab698ef32b894038198d8"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.3,
      "position": [
        -208,
        32
      ],
      "id": "6ded2193-f262-4398-9fbc-74e8100e12d5",
      "name": "Get Gamma Post"
    },
    {
      "parameters": {
        "operation": "update",
        "documentId": {
          "__rl": true,
          "value": "1uYjq4Kj0s4Pa6G9IZoPeOYi1WcZej-dDHFs2ODOLLhw",
          "mode": "list",
          "cachedResultName": "Gamma Content Generator",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1uYjq4Kj0s4Pa6G9IZoPeOYi1WcZej-dDHFs2ODOLLhw/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Sheet1",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1uYjq4Kj0s4Pa6G9IZoPeOYi1WcZej-dDHFs2ODOLLhw/edit#gid=0"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "row_number": "={{ $('Get Article').item.json.row_number }}",
            "Gamma Output": "={{ $('Get Gamma Post').item.json.gammaUrl }}",
            "Twitter Copy": "={{ $json.output.twitter }}",
            "LinkedIn Copy": "={{ $json.output.linkedin }}",
            "Instagram Copy": "={{ $json.output.instagram }}"
          },
          "matchingColumns": [
            "row_number"
          ],
          "schema": [
            {
              "id": "URL",
              "displayName": "URL",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Article Title",
              "displayName": "Article Title",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Gamma Output",
              "displayName": "Gamma Output",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Twitter Copy",
              "displayName": "Twitter Copy",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "LinkedIn Copy",
              "displayName": "LinkedIn Copy",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Instagram Copy",
              "displayName": "Instagram Copy",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "displayName": "Status",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "displayName": "row_number",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true,
              "readOnly": true,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        528,
        64
      ],
      "id": "9589957f-2ba5-46b7-857b-407d27b0f28b",
      "name": "Store Content in Sheet",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "eI6LlJqGRcrJCtWI",
          "name": "Owais Google Sheets"
        }
      }
    },
    {
      "parameters": {
        "jsonSchemaExample": "{\n  \"twitter\": \"Your Twitter post text here\",\n  \"linkedin\": \"Your LinkedIn post text here\",\n  \"instagram\": \"Your Instagram post text here\"\n}"
      },
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "typeVersion": 1.3,
      "position": [
        384,
        192
      ],
      "id": "d8a11e0f-ffc1-4f45-9d11-d1d9a8a54c1f",
      "name": "Structured Output Parser"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=You are a social media content creator. Based on the following cleaned news article, create platform-optimized social media posts for Twitter, LinkedIn, and Instagram.\n\nFor each platform, follow these specific requirements:\n\n**TWITTER:**\n- Maximum 280 characters\n- Hook-driven opening (first 10 words must grab attention)\n- Conversational and punchy tone\n- Focus on the most newsworthy angle\n- Sound authentic and personable, like a real person sharing interesting news\n- NO hashtags, NO em dashes (—), NO excessive punctuation\n\n**LINKEDIN:**\n- 150-200 words\n- Professional but conversational tone (not corporate or stiff)\n- Start with a thought-provoking question or bold statement\n- Include context and genuine insights\n- Format with line breaks for readability\n- Write like you're talking to a colleague, not giving a presentation\n- NO hashtags, NO em dashes (—), NO buzzwords or jargon\n\n**INSTAGRAM:**\n- 125-150 words\n- Casual, authentic, visual-first language\n- Strong opening hook (assume they're scrolling fast)\n- Use 1-2 emojis max (only if they feel natural, not forced)\n- Line breaks for easy reading\n- Sound like a friend sharing something cool they just learned\n- NO hashtags, NO em dashes (—), NO emoji spam\n\n**TONE GUIDELINES FOR ALL PLATFORMS:**\n- Write like a real person, not a brand\n- Use simple, clear language\n- Be conversational and direct\n- Avoid hype, superlatives, or marketing speak\n- Sound genuinely interested in the topic\n\n**OUTPUT FORMAT (CRITICAL):**\nYou must return your response as valid JSON in this exact structure:\n\n{\n  \"twitter\": \"Your Twitter post text here\",\n  \"linkedin\": \"Your LinkedIn post text here\\n\\nWith line breaks\",\n  \"instagram\": \"Your Instagram caption here\\n\\nWith line breaks\"\n}\n\n**IMPORTANT:** \n- Return ONLY the JSON object, no additional text before or after\n- Ensure all text is properly escaped for JSON (use \\\\n for line breaks, escape quotes as \\\\\")\n- Do not add markdown code blocks or explanations\n\n---\n\nARTICLE CONTENT:\n{{ $('Simplify Article').item.json.candidates[0].content.parts[0].text }}",
        "hasOutputParser": true,
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3,
      "position": [
        208,
        0
      ],
      "id": "1b684c00-dcbd-49c1-b11e-0c43721061e6",
      "name": "Content Writing Agent"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "typeVersion": 1,
      "position": [
        176,
        192
      ],
      "id": "6b2d24d3-3b61-4995-a7b3-2ae7a7dda461",
      "name": "Google Gemini Chat Model",
      "credentials": {
        "googlePalmApi": {
          "id": "DoB65OKBWKlUA9hu",
          "name": "Owais Google Gemini(PaLM) Api"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "// Get the raw Gemini text safely\nconst raw =\n  $json?.candidates?.[0]?.content?.parts?.[0]?.text || \"\";\n\n// Clean it so it is safe for JSON and Presenton\nconst safe = raw\n  // normalize line breaks\n  .replace(/\\r\\n/g, \"\\n\")\n  // collapse multiple newlines to one space\n  .replace(/\\n+/g, \" \")\n  // replace double quotes to single quotes\n  .replace(/\"/g, \"'\")\n  .trim();\n\n// Keep existing data + add a new safe field\nreturn [\n  {\n    json: {\n      ...$json,\n      presentationContent: safe,\n    },\n  },\n];\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -720,
        64
      ],
      "id": "39f7d911-fc36-4de4-82f2-95f8d8a05b9f",
      "name": "Code in JavaScript"
    }
  ],
  "pinData": {},
  "connections": {
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Get Article",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Article": {
      "main": [
        [
          {
            "node": "Scrape Article",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Scrape Article": {
      "main": [
        [
          {
            "node": "Simplify Article",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simplify Article": {
      "main": [
        [
          {
            "node": "Code in JavaScript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Get Gamma Post",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If": {
      "main": [
        [
          {
            "node": "Content Writing Agent",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Post with Gamma": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Gamma Post": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Content Writing Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Content Writing Agent": {
      "main": [
        [
          {
            "node": "Store Content in Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Content Writing Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript": {
      "main": [
        [
          {
            "node": "Create Post with Gamma",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate"
  },
  "versionId": "db6fcbac-3082-4ba6-95ee-8067ee1fc735",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "089cb37bc0c038203eafef0a664452109ceb0f3b0e0cd089e23fc9c7bc17add3"
  },
  "id": "DmsSxSKe69tyP4pz",
  "tags": []
}