{
  "id": "6TvsXVgNfQwsqvjS",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "RSS to LinkedIn & Instagram AI Publisher with Auto Image Generation",
  "tags": [],
  "nodes": [
    {
      "id": "70e845a9-1422-4c63-8f24-20341acc750e",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        464,
        176
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "gpt-4o-mini"
        },
        "options": {},
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "539e225c-b8d8-43d0-a901-f21a854e8ec5",
      "name": "Generate an image",
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "position": [
        1200,
        0
      ],
      "parameters": {
        "prompt": "={{ $json.instagram_image_prompt }}",
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "models/gemini-2.5-flash-image",
          "cachedResultName": "models/gemini-2.5-flash-image (Nano Banana)"
        },
        "options": {},
        "resource": "image"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "4d1eaa21-a362-4009-955c-e52ee90747fc",
      "name": "Upload a File",
      "type": "n8n-nodes-uploadtourl.uploadToUrl",
      "position": [
        1600,
        96
      ],
      "parameters": {},
      "credentials": {
        "uploadToUrlApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "c1b84186-6d5c-45a3-869a-f4364b21a307",
      "name": "Watch RSS Feed for New Articles",
      "type": "n8n-nodes-base.rssFeedReadTrigger",
      "position": [
        -96,
        0
      ],
      "parameters": {
        "pollTimes": {
          "item": [
            {
              "mode": "everyHour"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "60ad67a2-807b-43b4-a4b9-1e0945dcf6ad",
      "name": "Extract Article Data",
      "type": "n8n-nodes-base.set",
      "position": [
        208,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "a2d15435-d4f2-43c0-b899-f9083e6c8da0",
              "name": "article_title",
              "type": "string",
              "value": "={{ $json.title }}"
            },
            {
              "id": "047e960a-85ab-4d56-b719-f2e6439c4317",
              "name": "article_link",
              "type": "string",
              "value": "={{ $json.link }}"
            },
            {
              "id": "8064003e-d0fd-4551-a847-f4b7a5b47868",
              "name": "article_description",
              "type": "string",
              "value": "={{$json[\"content:encodedSnippet\"] || $json.contentSnippet || $json.description || $json.content}}"
            },
            {
              "id": "9ba96612-3ff1-4ef3-9f78-7ba24414793b",
              "name": "published_date",
              "type": "string",
              "value": "={{$json.isoDate || $json.pubDate}}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "defcc1fc-bbff-451a-82dc-f1b8bccd9157",
      "name": "Generate Social Media Content",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        512,
        0
      ],
      "parameters": {
        "text": "=You are a social media strategist.\n\nCreate platform-ready social media content from this RSS article.\n\nArticle Title:\n{{$json.article_title}}\n\nArticle Description:\n{{$json.article_description}}\n\nArticle Link:\n{{$json.article_link}}\n\nGenerate the output in valid JSON only.\n\nRules:\n- LinkedIn post should be professional, insightful, and include the article link.\n- Instagram caption should be short, engaging, and include hashtags.\n- Instagram image prompt should describe a clean, modern, scroll-stopping visual.\n- Do not use markdown.\n- Do not add fake facts.\n- Keep the tone clear and human.\n\n- Do not mention \"we\", \"our\", or \"us\" unless the article is from our own company.\n- LinkedIn post should be under 900 characters.\n- Instagram caption should be under 300 characters.\n- Hashtags should be relevant and maximum 5.\n- Do not generate fake statistics.\n- Avoid copyrighted logo descriptions unless the article clearly mentions the brands.\n- Return valid JSON only, no explanation.\n\nReturn this exact JSON structure:\n\n{\n  \"content_angle\": \"\",\n  \"linkedin_post\": \"\",\n  \"instagram_caption\": \"\",\n  \"instagram_image_prompt\": \"\",\n  \"hashtags\": []\n}",
        "batching": {},
        "promptType": "define"
      },
      "typeVersion": 1.9
    },
    {
      "id": "a3e70b9f-2a52-4354-b524-2ec91698a1fd",
      "name": "Parse AI JSON Output",
      "type": "n8n-nodes-base.code",
      "position": [
        880,
        0
      ],
      "parameters": {
        "jsCode": "const rawText = $json.text;\n\nlet cleanedText = rawText\n  .replace(/```json/g, '')\n  .replace(/```/g, '')\n  .trim();\n\nlet parsed;\n\ntry {\n  parsed = JSON.parse(cleanedText);\n} catch (error) {\n  throw new Error('AI output is not valid JSON: ' + cleanedText);\n}\n\nconst hashtags = Array.isArray(parsed.hashtags) ? parsed.hashtags : [];\n\nreturn [\n  {\n    json: {\n      content_angle: parsed.content_angle || '',\n      linkedin_post: parsed.linkedin_post || '',\n      instagram_caption: parsed.instagram_caption || '',\n      instagram_image_prompt: parsed.instagram_image_prompt || '',\n      hashtags,\n      hashtags_text: hashtags.join(' '),\n    }\n  }\n];"
      },
      "typeVersion": 2
    },
    {
      "id": "42ea5203-09e9-477a-8620-463f781bac0b",
      "name": "Publish LinkedIn Post",
      "type": "n8n-nodes-base.linkedIn",
      "position": [
        1952,
        -144
      ],
      "parameters": {
        "text": "={{ $('Parse AI JSON Output').item.json.linkedin_post }}",
        "person": "eJhMic-LBX",
        "additionalFields": {},
        "shareMediaCategory": "IMAGE"
      },
      "credentials": {
        "linkedInOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "afe6f820-ede7-4675-8331-56b2dc89cd6b",
      "name": "Publish Instagram Post",
      "type": "@mookielianhd/n8n-nodes-instagram.instagram",
      "position": [
        1952,
        176
      ],
      "parameters": {
        "node": "=",
        "caption": "={{ $('Parse AI JSON Output').item.json.instagram_caption }}",
        "imageUrl": "={{ $json.url }}",
        "additionalFields": {}
      },
      "credentials": {
        "instagramApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "8f233bc1-e805-4b4f-839e-6df27580c31a",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -224,
        -320
      ],
      "parameters": {
        "color": "#BFDBFE",
        "width": 320,
        "height": 464,
        "content": "## Step 1: Watch RSS Feed for New Articles\n\n### What this node does\nThis node monitors an RSS feed and checks for new articles every hour.\n\n### How it works\nWhenever a new item appears in the RSS feed, this node triggers the workflow automatically.  \nIt receives article data such as the title, link, publish date, content snippet, and description from the RSS feed.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "280b0b57-63b5-439f-ba8e-26bf34ddcded",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        112,
        -320
      ],
      "parameters": {
        "color": "#FFE7CC",
        "width": 352,
        "height": 464,
        "content": "## Step 2: Extract Article Data\n\n### What this node does\nThis node cleans and organizes the raw RSS feed data into simple fields that can be used in the next steps.\n\n### How it works\nIt extracts the main article information from the RSS output:\n\n- article_title\n- article_link\n- article_description\n- published_date\n"
      },
      "typeVersion": 1
    },
    {
      "id": "5afc6396-31b6-41e6-a198-c80298513c61",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        -400
      ],
      "parameters": {
        "color": "#CBC4E9",
        "width": 304,
        "height": 544,
        "content": "## Step 3: Generate Social Media Content\n\n### What this node does\nThis node uses AI to create social media content from the RSS article.\n\n### How it works\nIt sends the article title, description, and link to the AI model and asks it to generate structured JSON output containing:\n\n- content_angle\n- linkedin_post\n- instagram_caption\n- instagram_image_prompt\n- hashtags\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "b2c10a42-b43c-437e-b555-fae4a6930f3b",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        800,
        -336
      ],
      "parameters": {
        "color": "#FEF08A",
        "width": 288,
        "height": 480,
        "content": "## Step 4: Parse AI JSON Output\n\n### What this node does\nThis node converts the AI-generated JSON text into clean workflow fields.\n\n### Why it is important\nAI sometimes returns JSON as plain text.  \nThis node makes sure the output becomes proper structured data that can be used by the image generation, LinkedIn, and Instagram nodes.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "cebca7bb-ffa8-4b5f-9a1d-1ed8d1d87d45",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1104,
        -288
      ],
      "parameters": {
        "color": "#FED7AA",
        "width": 336,
        "height": 432,
        "content": "## Step 5: Generate an Image\n\n### What this node does\nThis node generates an image for the social media post.\n\n### How it works\nIt uses Google Gemini image generation and takes the `instagram_image_prompt` created by the AI content node.  \nThe prompt describes the visual style, layout, and concept for the image.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "8067e736-6740-4b6f-9e78-b1024f241779",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1456,
        80
      ],
      "parameters": {
        "color": "#FFF5B8",
        "width": 368,
        "height": 544,
        "content": "\n\n\n\n\n\n\n\n\n\n# Step 7: Upload a File\n\n### What this node does\nThis node uploads the generated image and converts it into a public image URL.\n\n### How it works\nThe image generated by Gemini is passed as a file/binary output to this node.  \nUploadToURL uploads the image and returns a public CDN URL.\n\n### Why it is important\nInstagram and many social platforms require a public image URL for posting.  \nThis node solves that problem by converting the generated image file into a shareable hosted URL.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "ea36b896-7a8b-4e0f-a473-5b8c62da8789",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1856,
        -384
      ],
      "parameters": {
        "color": "#C7D2FE",
        "width": 384,
        "height": 400,
        "content": "## Step 6: Publish LinkedIn Post with Image\n\n### What this node does\nThis node publishes the AI-generated LinkedIn post along with the generated image.\n\n### How it works\nIt takes the LinkedIn post text from the **Parse AI JSON Output** node:\n\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "ee7b239a-1d67-4f20-95f0-085a4b9e3645",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1856,
        144
      ],
      "parameters": {
        "color": "#FECDD3",
        "width": 384,
        "height": 400,
        "content": "\n\n\n\n\n\n\n\n\n\n\n## Node 8: Publish Instagram Post\n\n### What this node does\nThis node publishes the generated image and caption to Instagram.\n\n### How it works\nIt takes the public image URL from the UploadToURL node and uses the AI-generated Instagram caption from the parsed AI output.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "4df0ba62-df0b-47dd-a05d-884e7944f49c",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -416,
        -592
      ],
      "parameters": {
        "color": "#DDD6FE",
        "width": 832,
        "height": 224,
        "content": "# Workflow Overview\n\n### This workflow automatically monitors an RSS feed for new articles and converts each article into ready-to-publish social media content.  \n### It extracts the article title, link, description, and publish date, then uses AI to generate a LinkedIn post, Instagram caption, hashtags, and an image prompt.  \n### The workflow creates an AI-generated image, uploads it to a public URL using UploadToURL, and publishes the final content to LinkedIn and Instagram.  \n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "executionOrder": "v1"
  },
  "versionId": "bf65356f-f5cc-45c4-81e5-a3ae9a3ad9af",
  "connections": {
    "Upload a File": {
      "main": [
        [
          {
            "node": "Publish Instagram Post",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate an image": {
      "main": [
        [
          {
            "node": "Upload a File",
            "type": "main",
            "index": 0
          },
          {
            "node": "Publish LinkedIn Post",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Generate Social Media Content",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Extract Article Data": {
      "main": [
        [
          {
            "node": "Generate Social Media Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse AI JSON Output": {
      "main": [
        [
          {
            "node": "Generate an image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Social Media Content": {
      "main": [
        [
          {
            "node": "Parse AI JSON Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Watch RSS Feed for New Articles": {
      "main": [
        [
          {
            "node": "Extract Article Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}