{
  "name": "Automated AI content creation & Instagram publishing from Google Sheets",
  "nodes": [
    {
      "id": "c53bc70a-2e85-465a-b977-73cfd268ba41",
      "name": "Scheduled Start: Check for New Posts",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -1240,
        -380
      ]
    },
    {
      "id": "aa73f2af-f311-465b-8270-b027b17eec0d",
      "name": "1. Get Next Post Idea from Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -920,
        -380
      ]
    },
    {
      "id": "42e129d0-5e4f-4226-a86f-b7fd04c8c497",
      "name": "2. Prepare Input Variables (Topic, Audience, etc.)",
      "type": "n8n-nodes-base.set",
      "position": [
        -620,
        -380
      ]
    },
    {
      "id": "5036db9b-1a1b-48d7-bfaa-1839ba5331b5",
      "name": "3a. Generate Content Concept (Gemini)",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        -160,
        -380
      ]
    },
    {
      "id": "5a882770-53af-466c-a297-856b088eb2b9",
      "name": "(LLM Model for Concept)",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -160,
        -220
      ]
    },
    {
      "id": "a4132a05-def7-4c4f-ad1d-092533f3b9f2",
      "name": "(Parse Concept JSON)",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        0,
        -220
      ]
    },
    {
      "id": "46338aad-5f7d-464f-a7fe-e9ae00aacad5",
      "name": "3b. Generate Image Prompt Options (Gemini)",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        580,
        -380
      ]
    },
    {
      "id": "950b7c2f-cebc-41ae-aad8-38b139c1b2ea",
      "name": "(LLM Model for Prompts)",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        580,
        -220
      ]
    },
    {
      "id": "bfda2858-3a3a-4997-b30c-ce64429bd255",
      "name": "(Parse Prompts JSON)",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        740,
        -220
      ]
    },
    {
      "id": "0151450f-fca2-4628-a268-f90186a79b9e",
      "name": "3c. Generate Post Caption (Gemini)",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        1540,
        -380
      ]
    },
    {
      "id": "d4667681-a5aa-4b63-802c-2adf8c111bb9",
      "name": "(LLM Model for Caption)",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        1560,
        -220
      ]
    },
    {
      "id": "59da1f6c-ee55-4095-8c95-d60d1177c142",
      "name": "(Parse Caption JSON)",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1700,
        -220
      ]
    },
    {
      "id": "a8d38be7-85b5-4a39-bd39-7f765699d471",
      "name": "4. Generate Image using Prompt 1 (Replicate Flux)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2360,
        -380
      ]
    },
    {
      "id": "cc0f0035-0d63-4988-8ec8-89260261960a",
      "name": "5. Prepare Data for Instagram API",
      "type": "n8n-nodes-base.set",
      "position": [
        2880,
        -380
      ]
    },
    {
      "id": "f010c17f-1af3-4d04-a69c-8b03c70fc8f0",
      "name": "6a. Create Instagram Media Container",
      "type": "n8n-nodes-base.facebookGraphApi",
      "position": [
        3180,
        -380
      ]
    },
    {
      "id": "c69f1856-efa2-48a5-9e41-71ab67bcaeca",
      "name": "6b. Wait for Container Processing",
      "type": "n8n-nodes-base.wait",
      "position": [
        3480,
        -380
      ]
    },
    {
      "id": "516b61f0-825e-468b-8eb7-80f757171465",
      "name": "6c. Publish Post to Instagram",
      "type": "n8n-nodes-base.facebookGraphApi",
      "position": [
        3780,
        -380
      ]
    },
    {
      "id": "1a94c8ba-7b59-4337-ae07-5c0b2b8349dd",
      "name": "7. Update Post Status in Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        4440,
        -380
      ]
    },
    {
      "id": "68651653-07fb-435a-a82d-b8ee911b4161",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -240,
        -820
      ],
      "parameters": {
        "width": 460,
        "height": 740,
        "content": "# 01. Content Concept Generation\n\n**Purpose:** This step uses Google Gemini to generate **one unique content concept** tailored for the specified platform (Instagram/LinkedIn), based on the input topi"
      }
    },
    {
      "id": "c463e2b6-6b2b-498d-8672-a0a9b15c06b8",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2220,
        -820
      ],
      "parameters": {
        "width": 380,
        "height": 740,
        "content": "# 03b. Image Generation\n\n**Purpose:** Generates the actual image using the **first detailed prompt** created in step 3b. It sends this prompt to the Replicate API, specifically using the 'Flux 1.1 Pro"
      }
    },
    {
      "id": "4636ef23-11e1-45dd-94c1-5774ad612811",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        400,
        -820
      ],
      "parameters": {
        "width": 740,
        "height": 740,
        "content": "# 02. Image Prompt Elaboration & Options\n\n**Purpose:** Takes the generated content concept and expands on it to create **two distinct, detailed image generation prompts**. These prompts are optimized "
      }
    },
    {
      "id": "1996f6d0-42bc-4b23-a1af-59c4bb1cb3ee",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1380,
        -820
      ],
      "parameters": {
        "width": 620,
        "height": 740,
        "content": "# 03a. Caption Generation\n\n**Purpose:** Uses Google Gemini to write a short, engaging social media caption **specifically tailored for the target platform**. The caption complements the image (represe"
      }
    },
    {
      "id": "25e2ae24-c0c5-46fd-8c81-39a9fcafe472",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2800,
        -820
      ],
      "parameters": {
        "width": 1160,
        "height": 740,
        "content": "# 04. Instagram Publishing\n\n**Purpose:** This block takes the final image URL and caption, prepares them for the Instagram Graph API, uploads the media to create a container, waits for Instagram to pr"
      }
    },
    {
      "id": "d7082400-def2-40eb-9dbc-3e15d24c8f8f",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4640,
        -480
      ],
      "parameters": {
        "width": 380,
        "height": 300,
        "content": "# 05. Finalize: Update Sheet Status\n\n**Purpose:** Marks the processed post idea as completed in the Google Sheet.\n\n**Action:** Finds the corresponding row in the sheet (using the 'Topic' to match) and"
      }
    },
    {
      "id": "4e5433ff-5d04-424a-8165-6fd85cca1ad0",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -100,
        -300
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": ""
      }
    },
    {
      "id": "71bf2b4d-eaa1-423b-b798-8c0f737f4371",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1760,
        -440
      ],
      "parameters": {
        "width": 420,
        "height": 240,
        "content": "# 00. Scheduled Start & Input Preparation\n\n**Purpose:** Initiates the workflow automatically based on the user-defined schedule. Fetches the next available post idea (Status=0) from Google Sheets and "
      }
    }
  ],
  "connections": {
    "(Parse Caption JSON)": {
      "ai_outputParser": [
        [
          {
            "node": "3c. Generate Post Caption (Gemini)",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "(Parse Concept JSON)": {
      "ai_outputParser": [
        [
          {
            "node": "3a. Generate Content Concept (Gemini)",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "(Parse Prompts JSON)": {
      "ai_outputParser": [
        [
          {
            "node": "3b. Generate Image Prompt Options (Gemini)",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "(LLM Model for Caption)": {
      "ai_languageModel": [
        [
          {
            "node": "3c. Generate Post Caption (Gemini)",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "(LLM Model for Concept)": {
      "ai_languageModel": [
        [
          {
            "node": "3a. Generate Content Concept (Gemini)",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "(LLM Model for Prompts)": {
      "ai_languageModel": [
        [
          {
            "node": "3b. Generate Image Prompt Options (Gemini)",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "6c. Publish Post to Instagram": {
      "main": [
        [
          {
            "node": "7. Update Post Status in Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "1. Get Next Post Idea from Sheet": {
      "main": [
        [
          {
            "node": "2. Prepare Input Variables (Topic, Audience, etc.)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "5. Prepare Data for Instagram API": {
      "main": [
        [
          {
            "node": "6a. Create Instagram Media Container",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "6b. Wait for Container Processing": {
      "main": [
        [
          {
            "node": "6c. Publish Post to Instagram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3c. Generate Post Caption (Gemini)": {
      "main": [
        [
          {
            "node": "4. Generate Image using Prompt 1 (Replicate Flux)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "6a. Create Instagram Media Container": {
      "main": [
        [
          {
            "node": "6b. Wait for Container Processing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Scheduled Start: Check for New Posts": {
      "main": [
        [
          {
            "node": "1. Get Next Post Idea from Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3a. Generate Content Concept (Gemini)": {
      "main": [
        [
          {
            "node": "3b. Generate Image Prompt Options (Gemini)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3b. Generate Image Prompt Options (Gemini)": {
      "main": [
        [
          {
            "node": "3c. Generate Post Caption (Gemini)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "4. Generate Image using Prompt 1 (Replicate Flux)": {
      "main": [
        [
          {
            "node": "5. Prepare Data for Instagram API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2. Prepare Input Variables (Topic, Audience, etc.)": {
      "main": [
        [
          {
            "node": "3a. Generate Content Concept (Gemini)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}