{
  "id": "jYtmNu9biqEaTS14",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Wikipedia to LinkedIn AI Content Poster with Image via Bright Data",
  "tags": [],
  "nodes": [
    {
      "id": "9b8ad45f-4bd8-4eb9-a9f1-9a0f869205a0",
      "name": "Wait for status",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        80,
        48
      ],
      "parameters": {
        "url": "=https://api.brightdata.com/datasets/v3/progress/{{ $json.snapshot_id }}",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "format",
              "value": "json"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer YOUR_TOKEN_HERE"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "1d74b201-ff92-475e-badf-3adcdfc88149",
      "name": "Check Final Status",
      "type": "n8n-nodes-base.if",
      "position": [
        272,
        48
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "35ed620d-b5d5-4e97-bcc5-52b283d85616",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "ready"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "78c09194-2899-4b0b-b00a-dd35f85b95c4",
      "name": "Wikipedia Scrap Post",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        512,
        32
      ],
      "parameters": {
        "url": "=https://api.brightdata.com/datasets/v3/snapshot/{{ $json.snapshot_id }}",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "format",
              "value": "json"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer YOUR_TOKEN_HERE"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "2f36e8a4-4c76-4b32-8519-56e16e26f349",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        736,
        32
      ],
      "parameters": {
        "text": "=here is the title:-  {{ $json.cataloged_text[0].title }}\nhere is the article of my title :- {{ $json.cataloged_text[0].text }}",
        "options": {
          "systemMessage": "=Task:- \nSummarize the following article in under 2000 characters, keeping it professional, informative, and engaging enough for a LinkedIn audience.\n\nUse bullet points if helpful. Avoid repetition. Remove any unnecessary fluff.\n\nTone should be confident, insightful, and thought-leadership oriented \u2014 ideal for busy professionals who want quick understanding.\n\nHere's the content:\n---\n{{ $json.cataloged_text[0].text }}\n---\n"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2.1
    },
    {
      "id": "776e4ef3-61f8-4a31-aff3-550ff32861c8",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        720,
        272
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "79f161a8-325c-47f1-8f83-541db9b922dc",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        880,
        608
      ],
      "parameters": {
        "jsonSchemaExample": "{\n\t\"text\": \"California\"\n\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "ce3f23b3-aa8f-479c-b50b-8b7811c98ae5",
      "name": "Auto-fixing Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserAutofixing",
      "position": [
        816,
        368
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "a7c51767-3fb8-4931-9316-8ada84ced20c",
      "name": "Image Generate",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1120,
        32
      ],
      "parameters": {
        "url": "https://api.ideogram.ai/v1/ideogram-v3/generate",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "=prompt",
              "value": "={{ $json.output.text }}"
            },
            {
              "name": "rendering_speed",
              "value": "TURBO"
            },
            {
              "name": "resolution",
              "value": "1280x704"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Api-Key",
              "value": "IDEOGRAM_API_KEY"
            }
          ]
        }
      },
      "typeVersion": 4.2,
      "alwaysOutputData": true
    },
    {
      "id": "973e8cc1-c121-41d6-beb2-53ade53aaa8b",
      "name": "Create a post",
      "type": "n8n-nodes-base.linkedIn",
      "position": [
        1648,
        32
      ],
      "parameters": {
        "text": "={{ $('AI Agent').item.json.output.text }}",
        "person": "LINKEDIN_PROFILE_ID",
        "additionalFields": {},
        "shareMediaCategory": "IMAGE"
      },
      "credentials": {
        "linkedInOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "ee187ab3-c45f-4379-925b-b35a38ae6960",
      "name": "HTTP Request1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1328,
        32
      ],
      "parameters": {
        "url": "={{ $json.data[0].url }}",
        "options": {
          "response": {
            "response": {
              "responseFormat": "file"
            }
          }
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "badfa608-4dce-4d7f-bee8-b91df407daa5",
      "name": "Anthropic Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "position": [
        816,
        768
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "claude-sonnet-4-20250514",
          "cachedResultName": "Claude 4 Sonnet"
        },
        "options": {}
      },
      "credentials": {
        "anthropicApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "9bc87c92-4ad5-4166-821a-908b8f21789a",
      "name": "LinkedIn URL",
      "type": "n8n-nodes-base.code",
      "onError": "continueRegularOutput",
      "position": [
        1872,
        32
      ],
      "parameters": {
        "mode": "runOnceForEachItem",
        "jsCode": "const item = $input.item;\nconst shareUrn = item.json.urn || '';\n\n// Check if it's a valid LinkedIn share URN\nif (shareUrn.startsWith('urn:li:share:')) {\n  item.json.linkedinUrl = `https://www.linkedin.com/feed/update/${shareUrn}/`;\n} else {\n  item.json.linkedinUrl = 'Invalid LinkedIn URN';\n}\n\nreturn item;\n"
      },
      "typeVersion": 2
    },
    {
      "id": "8d794457-0fda-4f5a-b104-dc1d49e3cbc9",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        480,
        208
      ],
      "parameters": {
        "unit": "minutes",
        "amount": 1
      },
      "typeVersion": 1.1
    },
    {
      "id": "0e4118e7-40e8-412b-bcf8-f98e313475f7",
      "name": "\ud83d\udcdd On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -368,
        48
      ],
      "parameters": {
        "options": {},
        "formTitle": "Wikipedia Search",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Article Name"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "18ba69a8-bdaf-4895-8aea-332cbca7cd5e",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -512,
        -112
      ],
      "parameters": {
        "color": 7,
        "width": 496,
        "height": 352,
        "content": "\ud83d\udcdd+\ud83c\udf10 Start & Submit Article\n\"User starts the flow by entering the article name in the form.\nThe system sends a scraping request with that article name to BrightData.\"\n\nCovers:\n\nOn form submission\n\nHTTP Request"
      },
      "typeVersion": 1
    },
    {
      "id": "616019f6-fd99-4688-89c6-52fb87a8d1b3",
      "name": "\ud83c\udf10 HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -160,
        48
      ],
      "parameters": {
        "url": "https://api.brightdata.com/datasets/v3/trigger",
        "method": "POST",
        "options": {},
        "jsonBody": "=[\n  {\n    \"keyword\": \"{{ $json[\"Article Name\"] }}\",\n    \"pages_load\": 1\n  }\n] ",
        "sendBody": true,
        "sendQuery": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "queryParameters": {
          "parameters": [
            {
              "name": "dataset_id",
              "value": "gd_lr9978962kkjr3nx49"
            },
            {
              "name": "include_errors",
              "value": "true"
            },
            {
              "name": "type",
              "value": "discover_new"
            },
            {
              "name": "discover_by",
              "value": "keyword"
            },
            {
              "name": "limit_per_input",
              "value": "1"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer YOUR_TOKEN_HERE"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "36051a55-4361-4771-b9e8-0ec9a45d9b6b",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        16,
        -368
      ],
      "parameters": {
        "color": 2,
        "width": 624,
        "height": 800,
        "content": "\ud83d\udd37 Bright Data Extraction Section:\n\ud83d\udd35 HTTP Request (Trigger Dataset)\nStarts the Bright Data dataset crawl using the submitted keyword.\n\n\ud83d\udd35 Wait for Status\nChecks crawl progress using snapshot_id.\n\n\ud83d\udd35 Check Final Status (IF node)\nChecks if crawl status is 'ready'. If not, it waits.\n\n\ud83d\udd35 Wait (1 min)\nWaits before rechecking crawl status.\n\n\ud83d\udd35 Wikipedia Scrap Post\nFetches scraped data (title & text) using snapshot_id."
      },
      "typeVersion": 1
    },
    {
      "id": "6fc44f9d-c523-4e5c-9aac-56ee9d186ee8",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        688,
        -416
      ],
      "parameters": {
        "color": 3,
        "width": 768,
        "height": 912,
        "content": "\ud83e\udd16 AI Summarization Section:\n\ud83e\udd16 AI Agent\nSummarizes the scraped Wikipedia text into 2000 characters, suitable for a LinkedIn audience.\n\n\ud83e\udde0 OpenAI Chat Model\nGPT-4.1-mini model that powers the AI Agent.\n\n\ud83e\udde0 Anthropic Chat Model (Claude)\nAlternative language model linked to autofixing output.\n\n\ud83d\udd27 Auto-fixing Output Parser\nImproves/fixes AI output structure if needed.\n\n\ud83d\udcd0 Structured Output Parser\nEnsures final output follows JSON format.\n\n\ud83d\uddbc\ufe0f Image Generation Section:\n\ud83c\udfa8 Image Generate (Ideogram API)\nCreates a relevant image based on summarized text.\n\n\ud83d\udce6 HTTP Request1\nDownloads the generated image from Ideogram.\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "63c942b0-4dac-4414-8278-9bf91d69816a",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1488,
        -160
      ],
      "parameters": {
        "color": 4,
        "width": 608,
        "height": 416,
        "content": "\ud83d\udce4 Publishing Section:\n\ud83d\udd17 Create a Post (LinkedIn)\nPosts summary + image to a specified LinkedIn profile.\n\n\ud83d\udd17 LinkedIn URL (Code node)\nGenerates public LinkedIn post URL using URN.\n\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "c1901b18-15a5-434b-8670-5a63f7058f34",
  "connections": {
    "Wait": {
      "main": [
        [
          {
            "node": "Wait for status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Image Generate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create a post": {
      "main": [
        [
          {
            "node": "LinkedIn URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request1": {
      "main": [
        [
          {
            "node": "Create a post",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Image Generate": {
      "main": [
        [
          {
            "node": "HTTP Request1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait for status": {
      "main": [
        [
          {
            "node": "Check Final Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "\ud83c\udf10 HTTP Request": {
      "main": [
        [
          {
            "node": "Wait for status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Final Status": {
      "main": [
        [
          {
            "node": "Wikipedia Scrap Post",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Anthropic Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Auto-fixing Output Parser",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Wikipedia Scrap Post": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\ud83d\udcdd On form submission": {
      "main": [
        [
          {
            "node": "\ud83c\udf10 HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Auto-fixing Output Parser",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Auto-fixing Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    }
  }
}