{
  "id": "qh5hZfyvDNG0QYai",
  "meta": {
    "templateId": "4028",
    "templateCredsSetupCompleted": true
  },
  "name": "Create and publish Instagram carousels using OpenAI gpt-image-1 and AI caption",
  "tags": [],
  "nodes": [
    {
      "id": "04e5caba-3ecc-4539-8062-9dd7689c944c",
      "name": "Basic LLM Chain",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        272,
        -160
      ],
      "parameters": {},
      "typeVersion": 1.7
    },
    {
      "id": "2a400720-e19f-4e57-8174-f6e704dbbed2",
      "name": "Item List Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserItemList",
      "position": [
        400,
        32
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "f9a611ed-705d-4a06-96d0-c9cb18a32961",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        240,
        32
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "6d7f5f7d-cced-4938-96d2-2d5a84b56e30",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        624,
        -128
      ],
      "parameters": {},
      "typeVersion": 3
    },
    {
      "id": "a1e10f52-8a0c-405b-bbe6-b756e5281d85",
      "name": "OpenAI - Generate Image ",
      "type": "n8n-nodes-base.httpRequest",
      "maxTries": 2,
      "position": [
        944,
        112
      ],
      "parameters": {},
      "notesInFlow": false,
      "retryOnFail": true,
      "typeVersion": 4.2
    },
    {
      "id": "65d10c85-ffe4-4ab6-93cf-862fa4163514",
      "name": "Separate Image Outputs ",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1168,
        112
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "a86f4c5f-6963-450b-b31b-f570dace824d",
      "name": "Convert to File ",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        1360,
        112
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "a685d9a7-c812-484c-9233-7b328545d99e",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        1920,
        112
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "c3c00221-07dc-4b86-a54f-ff8b2bd04238",
      "name": "Cloudinary",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1568,
        112
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "98e6bf4a-7fd2-4d26-81ec-6f28111f1829",
      "name": "URL",
      "type": "n8n-nodes-base.set",
      "position": [
        1744,
        112
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "0d135ef8-c8f4-49f0-9186-a741a09b2bbe",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        -288,
        -144
      ],
      "parameters": {},
      "typeVersion": 2.2
    },
    {
      "id": "f304e736-2a74-46a9-9db1-538ad6cd2439",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -640,
        -144
      ],
      "parameters": {},
      "typeVersion": 1.2
    },
    {
      "id": "b019477a-8f5a-4b8c-a581-842713b8c8de",
      "name": "Completed",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1744,
        -320
      ],
      "parameters": {},
      "typeVersion": 4.6
    },
    {
      "id": "bca24a8e-00bd-4ecd-8efd-6f1bd8bf6245",
      "name": "Next Pending",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1952,
        -320
      ],
      "parameters": {},
      "typeVersion": 4.6
    },
    {
      "id": "0ed677b7-4118-459a-922f-ef365b578727",
      "name": "Get Pending",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -448,
        -144
      ],
      "parameters": {},
      "typeVersion": 4.6
    },
    {
      "id": "fdbb6b9b-342f-4035-bbea-10545048cb73",
      "name": "IG images ID",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        800,
        -320
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "6bf67b5b-a7ef-450b-8466-89f230482638",
      "name": "IG Media Carousel",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1216,
        -320
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "7ee3138b-1dc8-4336-907b-ae86e0c920fc",
      "name": "IG post Media",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueRegularOutput",
      "position": [
        1520,
        -320
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "d4a60d34-b6bd-4c72-b847-c975a4b71726",
      "name": "Images ID Array",
      "type": "n8n-nodes-base.code",
      "position": [
        1024,
        -320
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "d704a8e3-b2f6-44df-9087-1f1467f815a9",
      "name": "ig-user-id",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        192,
        464
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "d122046b-8334-41e7-aed9-f8aecb28a23e",
      "name": "IG User ID",
      "type": "n8n-nodes-base.set",
      "position": [
        384,
        464
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "a5e53c61-3a9c-46e3-9971-81374fe2cf45",
      "name": "Facebook Pages",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -16,
        464
      ],
      "parameters": {},
      "typeVersion": 4.2
    },
    {
      "id": "76643fcd-5362-4f17-b9b7-9f3bfc99be9e",
      "name": "Setup Instructions",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -640,
        -480
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "163a62cf-2081-4df0-b2b5-d3b94102a9f8",
      "name": "Setup Instructions1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        -384
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "ff9f313b-ecb8-4ff0-b4b6-7bc71c924430",
      "name": "Setup Instructions2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        752,
        -640
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "ad627edc-378c-4849-89d8-9b77a68cbf54",
      "name": "Setup Instructions3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1200,
        -640
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "ee269d83-2f01-498b-98b1-46639f8015f6",
      "name": "Setup Instructions4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1664,
        -640
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "abff7da3-e605-4959-aef0-42d5dacc771b",
      "name": "Setup Instructions5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        240
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "9a94d62e-7bbb-4b21-9ec0-c212d3c66477",
      "name": "Setup Instructions6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        880,
        -96
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "ac930dd9-c7a3-4b22-9618-2502106fe913",
      "name": "Setup Instructions7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1520,
        -576
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "3cfb46e8-4581-46dc-a207-2ff6f2cff82a",
      "name": "Wait1",
      "type": "n8n-nodes-base.wait",
      "position": [
        1360,
        -320
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "2089e370-9f98-4f27-80bf-5172df529d37",
      "name": "Generate Description for Instagram",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -64,
        -160
      ],
      "parameters": {},
      "retryOnFail": true,
      "typeVersion": 1.4,
      "waitBetweenTries": 5000
    }
  ],
  "active": false,
  "settings": {
    "timezone": "America/Argentina/Buenos_Aires",
    "callerPolicy": "workflowsFromSameOwner",
    "executionOrder": "v1",
    "saveExecutionProgress": true
  },
  "versionId": "a188baf3-fef0-4dbc-882f-28ebdb12e1ef",
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "Generate Description for Instagram",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "URL": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait1": {
      "main": [
        [
          {
            "node": "IG post Media",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Completed": {
      "main": [
        [
          {
            "node": "Next Pending",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Cloudinary": {
      "main": [
        [
          {
            "node": "URL",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ig-user-id": {
      "main": [
        [
          {
            "node": "IG User ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Pending": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IG images ID": {
      "main": [
        [
          {
            "node": "Images ID Array",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IG post Media": {
      "main": [
        [
          {
            "node": "Completed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Facebook Pages": {
      "main": [
        [
          {
            "node": "ig-user-id",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Basic LLM Chain": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Images ID Array": {
      "main": [
        [
          {
            "node": "IG Media Carousel",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "IG images ID",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "OpenAI - Generate Image ",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to File ": {
      "main": [
        [
          {
            "node": "Cloudinary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Get Pending",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IG Media Carousel": {
      "main": [
        [
          {
            "node": "Wait1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Item List Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Separate Image Outputs ": {
      "main": [
        [
          {
            "node": "Convert to File ",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI - Generate Image ": {
      "main": [
        [
          {
            "node": "Separate Image Outputs ",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Description for Instagram": {
      "main": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}