{
  "id": "1Y5FzMEqaYHEsXxR",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Auto-Generate LinkedIn Posts from Articles with Dumpling AI and GPT-4o",
  "tags": [],
  "nodes": [
    {
      "id": "3e99adb0-0445-4516-9404-a96e5e273722",
      "name": "Start Workflow",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -1060,
        -120
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "bed177e1-ac0b-4159-8ac7-ae51af05da37",
      "name": " Get \"To do\" Topics from Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -840,
        -120
      ],
      "parameters": {
        "options": {
          "returnFirstMatch": true
        },
        "filtersUI": {
          "values": [
            {
              "lookupValue": "To do",
              "lookupColumn": "Status"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/173W0S2tDXXSSFmN6igySo9ftW4_MTH1Tr_2wGIRwHdg/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/173W0S2tDXXSSFmN6igySo9ftW4_MTH1Tr_2wGIRwHdg/edit?usp=drivesdk",
          "cachedResultName": "content library"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "cfd11e52-1a0b-4f55-a623-40f7f8233ef1",
      "name": "Scrape Articles via Dumpling AI Search",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -620,
        -120
      ],
      "parameters": {
        "url": " https://app.dumplingai.com/api/v1/search",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"query\": \"{{ $json.Topic }}\",\n  \"numResultsToScrape\": \"3\",\n   \"scrapeResults\": \"true\"\n}\n ",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "96f68697-8ef2-42a7-b9ef-10044cac2b0a",
      "name": "Enable GPT-4o for LangChain Agent",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -540,
        100
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {
          "responseFormat": "json_object"
        }
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "d2acc5f1-b366-4e07-8f1b-953c591f63b0",
      "name": "Summarize 3 Articles + Generate LinkedIn Post + Image Prompt",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -400,
        -120
      ],
      "parameters": {
        "text": "=Article 1:{{ $json.organic[0].scrapeOutput.content }}\n\nArticle 2:{{ $json.organic[1].scrapeOutput.content }}\n\nArticle 3:{{ $json.organic[2].scrapeOutput.content }}",
        "options": {
          "systemMessage": "= Agent Prompt (Final Version):\nYou are a professional AI content assistant. Based on the 3 articles I will provide, generate a LinkedIn post and also create an image prompt that visually represents the message of the post.\n\nInstructions:\n\nRead all 3 articles.\n\nCombine key insights from them into a single LinkedIn post.\n\nWrite the post in a conversational, professional tone \u2014 no robotic language.\n\nThe first line must grab attention and spark curiosity.\n\nAvoid hashtags, emojis, and clickbait phrases.\n\nKeep the post under 1,300 characters.\n\nUse correct punctuation only. Do not use hyphens.\n\nAfter writing the post, generate a short and clear image prompt that can be used to create a LinkedIn graphic. It should be based on the main message or visual idea from the post.\n\nReturn your response in the following JSON format:\n\njson\nCopy\nEdit\n{\n  \"postText\": \"Write the full LinkedIn post here...\",\n  \"imagePrompt\": \"A short visual prompt that summarizes the theme of the post, such as 'A modern workspace with AI-powered tools automating business processes'\"\n}\n"
        },
        "promptType": "define"
      },
      "typeVersion": 1.9
    },
    {
      "id": "d1f25b3a-3044-4ca6-937e-c61439d545c8",
      "name": " Extract Post Text and Image Prompt",
      "type": "n8n-nodes-base.set",
      "position": [
        -20,
        -120
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "bc9d47f0-b4b9-437e-b37d-c1396d316b15",
              "name": "postText",
              "type": "string",
              "value": "={{ JSON.parse($json[\"output\"]).postText }}\n"
            },
            {
              "id": "fc8def21-2cc2-4029-a66d-df02530a1535",
              "name": "imagePrompt",
              "type": "string",
              "value": "={{ JSON.parse($json[\"output\"]).imagePrompt }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "1ccd4791-92c9-4572-9e0c-cb60477dabdd",
      "name": "Generate Image with Dumpling AI",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        220,
        -120
      ],
      "parameters": {
        "url": " https://app.dumplingai.com/api/v1/generate-ai-image",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"model\": \"FLUX.1-pro\",\n  \"input\": {\n    \"prompt\": \"{{ $json.imagePrompt }}\"\n  }\n}\n\n ",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "be8bd9f0-1cff-41c9-b26e-c6f365aa86fd",
      "name": "Update Google Sheet with Post & Image",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        440,
        -120
      ],
      "parameters": {
        "columns": {
          "value": {
            "Image": "={{ $json.images[0].url }}",
            "Topic": "={{ $(' Get \"To do\" Topics from Sheet').item.json.Topic }}",
            "Status": "created",
            "Content": "={{ $(' Extract Post Text and Image Prompt').item.json.postText }}"
          },
          "schema": [
            {
              "id": "Topic",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Topic",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Content",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Content",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Image",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Image",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "string",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Topic"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/173W0S2tDXXSSFmN6igySo9ftW4_MTH1Tr_2wGIRwHdg/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/173W0S2tDXXSSFmN6igySo9ftW4_MTH1Tr_2wGIRwHdg/edit?usp=drivesdk",
          "cachedResultName": "content library"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "44ad06d9-d5f7-4a3c-a894-943ec46ac0f0",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1060,
        -280
      ],
      "parameters": {
        "width": 900,
        "height": 200,
        "content": "### \ud83d\udcda Get Topic and Summarize Articles with AI\n\nThis part starts the workflow manually, pulls the first \"To do\" topic from a Google Sheet, and passes the topic to Dumpling AI to perform a Google search and scrape the top 3 article contents. The LangChain Agent, powered by GPT-4o, uses these articles to generate a LinkedIn post and an image prompt, all formatted in structured JSON. This combines real-world content scraping with AI summarization in one seamless step.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "528021a8-6b26-4177-b9fa-eb2405ac7d8d",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -100,
        -280
      ],
      "parameters": {
        "width": 760,
        "height": 200,
        "content": "### \ud83e\udde0 Refine Output and Store Content\n\nOnce the AI Agent returns the LinkedIn post and image prompt, the Set node extracts both fields. Dumpling AI then uses the image prompt to generate a relevant visual. Finally, the result (post text, generated image, and topic) is saved back to the Google Sheet. This completes the loop from input topic to ready-to-use LinkedIn content with visuals\u2014all automated.\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "5208235f-4bc6-417c-8a38-2bc92b7a75f9",
  "connections": {
    "Start Workflow": {
      "main": [
        [
          {
            "node": " Get \"To do\" Topics from Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    " Get \"To do\" Topics from Sheet": {
      "main": [
        [
          {
            "node": "Scrape Articles via Dumpling AI Search",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Image with Dumpling AI": {
      "main": [
        [
          {
            "node": "Update Google Sheet with Post & Image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Enable GPT-4o for LangChain Agent": {
      "ai_languageModel": [
        [
          {
            "node": "Summarize 3 Articles + Generate LinkedIn Post + Image Prompt",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    " Extract Post Text and Image Prompt": {
      "main": [
        [
          {
            "node": "Generate Image with Dumpling AI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Scrape Articles via Dumpling AI Search": {
      "main": [
        [
          {
            "node": "Summarize 3 Articles + Generate LinkedIn Post + Image Prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Summarize 3 Articles + Generate LinkedIn Post + Image Prompt": {
      "main": [
        [
          {
            "node": " Extract Post Text and Image Prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}