{
  "name": "Product URL to UGC-style vertical video ad with Sisif, Slack approval and Instagram publishing",
  "nodes": [
    {
      "id": "0b8e4309-976e-4dbc-9668-c0d075227f3f",
      "name": "Setup instructions",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -1300,
        -620
      ],
      "parameters": {
        "content": "## Product URL to UGC-style vertical video ad, approved in Slack, posted to Instagram\nPaste a product page URL, get three 9:16 ad variants, pick one in Slack and publish it as an Instagram Reel.\n\n### Setup\n1. Connect an **OpenAI** credential on **OpenAI Chat Model**.\n2. Create a Sisif API key at https://sisif.ai/users/api-keys/ and add it as a **Bearer Auth** credential named *Sisif API key* on **Create Sisif Video** and **Check Video Status**.\n3. Connect **Slack** and choose the review channel in **Ask For Approval In Slack**.\n4. Connect a **Facebook Graph API** credential with *instagram_basic* and *instagram_content_publish* for a Business/Creator account linked to a Facebook Page.\n5. Open **Settings** and set **ig_user_id** (your Instagram business account id).\n6. Submit the form once to test. Use the webhook trigger instead if another tool sends the URLs.",
        "width": 620,
        "height": 560,
        "color": 4
      }
    },
    {
      "id": "d1bc3546-efed-4145-b487-51f26ba77c1e",
      "name": "Blotato alternative",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        2900,
        -420
      ],
      "parameters": {
        "content": "### Prefer Blotato?\nReplace the three Instagram nodes with Blotato (community node or HTTP Request to the Blotato API) to post the chosen video to Instagram, TikTok, YouTube Shorts and more from a single node. Pass **video_url** and **caption** from **Pick Approved Variant**.",
        "width": 420,
        "height": 220
      }
    },
    {
      "id": "5c1759ff-431b-4c99-a07d-efbdf484e75e",
      "name": "Scraping note",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -520,
        -320
      ],
      "parameters": {
        "content": "### Scraping\nA plain HTTP GET works for most store pages (Shopify, WooCommerce). JavaScript-heavy pages may return little text; swap **Fetch Product Page** for a scraping API in that case.",
        "width": 380,
        "height": 200
      }
    },
    {
      "id": "b8884f55-77e7-4f9c-a20d-62035197ff4f",
      "name": "Product URL Form",
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2.2,
      "position": [
        -1200,
        100
      ],
      "parameters": {
        "formTitle": "Create a UGC video ad",
        "formDescription": "Paste a product page URL to generate three vertical ad variants.",
        "formFields": {
          "values": [
            {
              "fieldLabel": "product_url",
              "placeholder": "https://store.example.com/products/item",
              "requiredField": true
            }
          ]
        },
        "options": {}
      },
      "webhookId": "a7e11a3a-37dd-4500-90c4-d02e29058bfb"
    },
    {
      "id": "6cbf751f-2a9b-46fa-8c12-dfbc4c4c8894",
      "name": "Product URL Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        -1200,
        300
      ],
      "parameters": {
        "httpMethod": "POST",
        "path": "ugc-video-ad",
        "options": {}
      },
      "webhookId": "5b32d907-f67a-4b61-8e2d-24843db319b2"
    },
    {
      "id": "1290be12-8902-4e0d-b4ae-d1bd20dcce9d",
      "name": "Settings",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -980,
        200
      ],
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "6a2175e0-520c-459c-9c3a-0018bf8f5146",
              "name": "product_url",
              "value": "={{ $json.product_url || $json.body?.product_url }}",
              "type": "string"
            },
            {
              "id": "5684bca7-c134-449c-9b84-efd2d245e6ad",
              "name": "ig_user_id",
              "value": "YOUR_IG_USER_ID",
              "type": "string"
            },
            {
              "id": "b5790b87-5f29-4dc5-88c2-39ab16253e76",
              "name": "graph_version",
              "value": "v21.0",
              "type": "string"
            }
          ]
        },
        "options": {}
      }
    },
    {
      "id": "c4938f08-d483-4b73-a4d5-cebb9af0dce7",
      "name": "Fetch Product Page",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        -760,
        200
      ],
      "parameters": {
        "url": "={{ $json.product_url }}",
        "options": {
          "response": {
            "response": {
              "responseFormat": "text"
            }
          }
        }
      }
    },
    {
      "id": "8bb3aa50-13e4-4e7d-af19-77409f35e7db",
      "name": "Extract Page Text",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -540,
        200
      ],
      "parameters": {
        "jsCode": "const html = $input.first().json.data || '';\nconst pick = (re) => (html.match(re) || [])[1] || '';\nconst title = pick(/<meta[^>]+property=[\"']og:title[\"'][^>]+content=[\"']([^\"']+)/i) || pick(/<title[^>]*>([^<]*)<\\/title>/i);\nconst description = pick(/<meta[^>]+(?:name|property)=[\"'](?:og:)?description[\"'][^>]+content=[\"']([^\"']+)/i);\nconst image = pick(/<meta[^>]+property=[\"']og:image[\"'][^>]+content=[\"']([^\"']+)/i);\nconst text = html.replace(/<script[\\s\\S]*?<\\/script>|<style[\\s\\S]*?<\\/style>/gi, ' ').replace(/<[^>]+>/g, ' ').replace(/\\s+/g, ' ').trim().slice(0, 6000);\nreturn [{ json: { title, description, image, text, product_url: $('Settings').first().json.product_url } }];"
      }
    },
    {
      "id": "997706da-1d9b-4c05-9e5f-9809e929face",
      "name": "Write Hook And Script",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "typeVersion": 1.5,
      "position": [
        -320,
        200
      ],
      "parameters": {
        "promptType": "define",
        "text": "=You are a UGC ad scriptwriter. From the product page below, write a short vertical video ad.\nReturn:\n- hook: a scroll-stopping first line (max 12 words)\n- script: a 3-sentence voiceover-style script in a casual first-person UGC tone\n- caption: an Instagram caption with up to 5 hashtags\n- prompts: exactly 3 different visual prompts (max 60 words each) for a 5 second 9:16 video, each a different angle (unboxing, in-use close-up, lifestyle). No on-screen text.\n\nTitle: {{ $json.title }}\nDescription: {{ $json.description }}\nPage text: {{ $json.text }}",
        "hasOutputParser": true
      }
    },
    {
      "id": "2e55efc5-0b01-4131-8b3a-54e83ad55337",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        -380,
        420
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "",
          "name": "OpenAI account"
        }
      }
    },
    {
      "id": "bdaa6acf-bead-47d4-9338-4b00295d48d0",
      "name": "Ad Script Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "typeVersion": 1.2,
      "position": [
        -200,
        420
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"hook\": \"Stop scrolling if your coffee goes cold\",\n  \"script\": \"...\",\n  \"caption\": \"... #coffee\",\n  \"prompts\": [\n    \"...\",\n    \"...\",\n    \"...\"\n  ]\n}"
      }
    },
    {
      "id": "2772380d-9174-4211-8e79-d5a08ea851cc",
      "name": "Split Into Variants",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        40,
        200
      ],
      "parameters": {
        "jsCode": "const o = $input.first().json.output;\nreturn o.prompts.slice(0, 3).map((prompt, i) => ({ json: { variant: i + 1, prompt, hook: o.hook, script: o.script, caption: o.caption } }));"
      }
    },
    {
      "id": "6a2a3284-7bb7-462c-bb4e-b5e97ce12d8f",
      "name": "Loop Over Variants",
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 3,
      "position": [
        260,
        200
      ],
      "parameters": {
        "options": {}
      }
    },
    {
      "id": "e11ca159-eee8-478f-a523-7a627c608b40",
      "name": "Create Sisif Video",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        480,
        300
      ],
      "parameters": {
        "method": "POST",
        "url": "https://sisif.ai/api/videos/generate/",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth",
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "prompt",
              "value": "={{ $json.prompt }}"
            },
            {
              "name": "duration",
              "value": "5"
            },
            {
              "name": "resolution",
              "value": "720x1280"
            }
          ]
        },
        "options": {}
      },
      "credentials": {
        "httpBearerAuth": {
          "id": "",
          "name": "Sisif API key"
        }
      }
    },
    {
      "id": "6deeb243-342d-4516-b4fc-8537514af87e",
      "name": "Wait Before Status Check",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        700,
        300
      ],
      "parameters": {
        "amount": 15
      },
      "webhookId": "8463adf5-7098-499b-8079-554daf962f72"
    },
    {
      "id": "b3e0f899-e436-42dd-8089-8ec9657eb7e0",
      "name": "Check Video Status",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        920,
        300
      ],
      "parameters": {
        "url": "=https://sisif.ai/api/videos/{{ $json.poll_id }}/",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth",
        "options": {}
      },
      "credentials": {
        "httpBearerAuth": {
          "id": "",
          "name": "Sisif API key"
        }
      }
    },
    {
      "id": "6a836955-5e30-408a-859e-096772f54f0f",
      "name": "Is Video Ready?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        1140,
        300
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "c4806d6b-1ca7-48d9-b2e9-69c0c8d0bb32",
              "leftValue": "={{ $json.status }}",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "rightValue": "READY"
            }
          ],
          "combinator": "and"
        },
        "options": {}
      }
    },
    {
      "id": "f13466b1-b61d-4290-9910-0bab84959d16",
      "name": "Did Generation Fail?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        1360,
        420
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "44e06ba4-eaaa-4a14-a748-9f71fdaf9fe8",
              "leftValue": "={{ $json.status }}",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "rightValue": "ERROR"
            },
            {
              "id": "28bc3ebc-e33f-41c7-b1c9-72a8f4f3d785",
              "leftValue": "={{ $json.status }}",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "rightValue": "REFUNDED"
            }
          ],
          "combinator": "or"
        },
        "options": {}
      }
    },
    {
      "id": "1b23f18e-4788-4719-83db-1bbe326d2975",
      "name": "Collect Variant",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1580,
        200
      ],
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "8b2d8001-53ed-4d63-8dc6-08cf5df962e4",
              "name": "variant",
              "value": "={{ $('Loop Over Variants').item.json.variant }}",
              "type": "number"
            },
            {
              "id": "667b4ff5-86ae-4b6c-8fd7-ee8b959f430e",
              "name": "video_url",
              "value": "={{ $json.status === 'READY' ? $json.video_url : '' }}",
              "type": "string"
            },
            {
              "id": "070f34f6-cbda-4c71-a553-64cc4d09ff26",
              "name": "status",
              "value": "={{ $json.status === 'READY' || $json.status === 'ERROR' || $json.status === 'REFUNDED' ? $json.status : 'TIMED_OUT' }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      }
    },
    {
      "id": "1b8ed602-6348-461f-b4b4-8aa508cf0ee9",
      "name": "Build Slack Message",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        480,
        0
      ],
      "parameters": {
        "jsCode": "const v = $input.all().map(i => i.json);\nconst s = $('Split Into Variants').first().json;\nconst lines = v.map(x => `Variant ${x.variant}: ${x.video_url || 'failed (' + x.status + ')'}`).join('\\n');\nreturn [{ json: { ready_count: v.filter(x => x.video_url).length, variants: v, caption: s.caption, message: `*New UGC ad for review*\\nHook: ${s.hook}\\nScript: ${s.script}\\n\\n${lines}\\n\\nCaption:\\n${s.caption}` } }];"
      }
    },
    {
      "id": "fa39c8a6-bc53-426c-8035-6deba5545a25",
      "name": "Ask For Approval In Slack",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.3,
      "position": [
        700,
        0
      ],
      "parameters": {
        "operation": "sendAndWait",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "message": "={{ $json.message }}",
        "responseType": "customForm",
        "formFields": {
          "values": [
            {
              "fieldLabel": "decision",
              "fieldType": "dropdown",
              "fieldOptions": {
                "values": [
                  {
                    "option": "Variant 1"
                  },
                  {
                    "option": "Variant 2"
                  },
                  {
                    "option": "Variant 3"
                  },
                  {
                    "option": "Reject"
                  }
                ]
              },
              "requiredField": true
            }
          ]
        },
        "options": {}
      },
      "credentials": {
        "slackOAuth2Api": {
          "id": "",
          "name": "Slack account"
        }
      },
      "webhookId": "dca1a5c7-9ffd-458c-b8ee-876e25053d28"
    },
    {
      "id": "b8a2c3ec-2666-4365-89d0-92a2fea8d04e",
      "name": "Was A Variant Approved?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        920,
        0
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "a213e2c3-c12c-43bc-9b98-8ff1f03d049e",
              "leftValue": "={{ $json.data.decision }}",
              "operator": {
                "type": "string",
                "operation": "notEquals"
              },
              "rightValue": "Reject"
            }
          ],
          "combinator": "and"
        },
        "options": {}
      }
    },
    {
      "id": "31b3bc1c-f5c8-452c-8c6c-e8f58de13e5a",
      "name": "Pick Approved Variant",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1140,
        -100
      ],
      "parameters": {
        "jsCode": "const n = Number(String($input.first().json.data.decision).replace(/\\D/g, ''));\nconst m = $('Build Slack Message').first().json;\nconst v = m.variants.find(x => x.variant === n);\nif (!v || !v.video_url) throw new Error(`Variant ${n} has no video`);\nreturn [{ json: { video_url: v.video_url, caption: m.caption } }];"
      }
    },
    {
      "id": "822f7873-c036-40df-b8c8-1db569898b82",
      "name": "Create Instagram Reel Container",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1360,
        -100
      ],
      "parameters": {
        "method": "POST",
        "url": "=https://graph.facebook.com/{{ $('Settings').first().json.graph_version }}/{{ $('Settings').first().json.ig_user_id }}/media",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "facebookGraphApi",
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "media_type",
              "value": "REELS"
            },
            {
              "name": "video_url",
              "value": "={{ $json.video_url }}"
            },
            {
              "name": "caption",
              "value": "={{ $json.caption }}"
            }
          ]
        },
        "options": {}
      },
      "credentials": {
        "facebookGraphApi": {
          "id": "",
          "name": "Facebook Graph account"
        }
      }
    },
    {
      "id": "a4cd5640-f5e7-40e0-b6e1-c1c761bc22dc",
      "name": "Wait For Instagram Processing",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        1580,
        -100
      ],
      "parameters": {
        "amount": 30
      },
      "webhookId": "263fdcbc-f8ba-473d-8ff2-827935fbba80"
    },
    {
      "id": "512bac30-4ceb-4676-aede-ddbb8610d55e",
      "name": "Check Container Status",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1800,
        -100
      ],
      "parameters": {
        "url": "=https://graph.facebook.com/{{ $('Settings').first().json.graph_version }}/{{ $json.poll_id }}",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "facebookGraphApi",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "fields",
              "value": "status_code"
            }
          ]
        },
        "options": {}
      },
      "credentials": {
        "facebookGraphApi": {
          "id": "",
          "name": "Facebook Graph account"
        }
      }
    },
    {
      "id": "70b17b60-02fa-43ef-89bf-c1b66db81f76",
      "name": "Is Container Finished?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        2020,
        -100
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "4e3e2cac-6cdb-4a9c-a6c1-2cf30375c244",
              "leftValue": "={{ $json.status_code }}",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "rightValue": "FINISHED"
            }
          ],
          "combinator": "and"
        },
        "options": {}
      }
    },
    {
      "id": "7cd5275f-6bab-44aa-a036-dfb2f6e371e3",
      "name": "Publish Instagram Reel",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        2240,
        -200
      ],
      "parameters": {
        "method": "POST",
        "url": "=https://graph.facebook.com/{{ $('Settings').first().json.graph_version }}/{{ $('Settings').first().json.ig_user_id }}/media_publish",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "facebookGraphApi",
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "creation_id",
              "value": "={{ $('Create Instagram Reel Container').item.json.id }}"
            }
          ]
        },
        "options": {}
      },
      "credentials": {
        "facebookGraphApi": {
          "id": "",
          "name": "Facebook Graph account"
        }
      }
    },
    {
      "id": "80e1b99f-d602-4149-a4a7-b6bfc939e49a",
      "name": "Start Poll Counter",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        590,
        480
      ],
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "37a183a5-09f6-4534-830e-7eb6caec7771",
              "name": "poll_id",
              "value": "={{ $json.id }}",
              "type": "string"
            },
            {
              "id": "974bfbda-80a0-4f72-a694-e7ea8cddb8a6",
              "name": "attempt",
              "value": "0",
              "type": "number"
            }
          ]
        },
        "options": {}
      }
    },
    {
      "id": "0cb6b732-fc12-49f3-af81-d18363c6b9d9",
      "name": "Track Poll Attempt",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1030,
        480
      ],
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "06753fb5-8dd5-48ea-8cbf-cda3b161b612",
              "name": "poll_id",
              "value": "={{ $('Wait Before Status Check').item.json.poll_id }}",
              "type": "string"
            },
            {
              "id": "fdc0fd7b-52e6-4d5f-b97b-93a6e4ff3441",
              "name": "attempt",
              "value": "={{ $('Wait Before Status Check').item.json.attempt + 1 }}",
              "type": "number"
            }
          ]
        },
        "options": {},
        "includeOtherFields": true
      }
    },
    {
      "id": "8ed77733-b19e-4688-b2db-b1ae6d6d9eca",
      "name": "Under Max Attempts?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        1250,
        700
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "c26105d0-b075-4b35-a433-5203136caa7b",
              "leftValue": "={{ $json.attempt }}",
              "operator": {
                "type": "number",
                "operation": "lt"
              },
              "rightValue": 40
            }
          ],
          "combinator": "and"
        },
        "options": {}
      }
    },
    {
      "id": "a4de87d3-f512-484b-a14c-5a2c36409efa",
      "name": "Instagram Processing Timed Out",
      "type": "n8n-nodes-base.stopAndError",
      "typeVersion": 1,
      "position": [
        2460,
        0
      ],
      "parameters": {
        "errorMessage": "Instagram did not finish processing the Reel after 40 status checks"
      }
    },
    {
      "id": "0fb9bf24-e36f-4e63-b2bc-5b368bd6e219",
      "name": "Start Instagram Poll Counter",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1470,
        80
      ],
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "5f60b429-347b-4487-8c1a-8a1646eca966",
              "name": "poll_id",
              "value": "={{ $json.id }}",
              "type": "string"
            },
            {
              "id": "592a51b0-3775-43db-a9ad-26325eb787b1",
              "name": "attempt",
              "value": "0",
              "type": "number"
            }
          ]
        },
        "options": {}
      }
    },
    {
      "id": "94dc66e7-c267-48ca-99a4-a0b7aac28e4d",
      "name": "Track Instagram Poll Attempt",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1910,
        80
      ],
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "5b4cbad3-58eb-4f9b-9cec-b066abe56ef3",
              "name": "poll_id",
              "value": "={{ $('Wait For Instagram Processing').item.json.poll_id }}",
              "type": "string"
            },
            {
              "id": "c50a1c2a-c188-4bb5-a793-59a3ffbadaea",
              "name": "attempt",
              "value": "={{ $('Wait For Instagram Processing').item.json.attempt + 1 }}",
              "type": "number"
            }
          ]
        },
        "options": {},
        "includeOtherFields": true
      }
    },
    {
      "id": "1e8a8810-6205-4b5f-a90c-322096c7a684",
      "name": "Under Instagram Max Attempts?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        2130,
        300
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "48de5d3f-cc7a-40ff-947c-ff678b406aab",
              "leftValue": "={{ $json.attempt }}",
              "operator": {
                "type": "number",
                "operation": "lt"
              },
              "rightValue": 40
            }
          ],
          "combinator": "and"
        },
        "options": {}
      }
    },
    {
      "id": "d09bd910-a52d-42dc-8930-7a2a26de1bde",
      "name": "Any Variant Ready?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        590,
        -200
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "54f8c03d-a288-4091-86b7-7f71bd0ec53f",
              "leftValue": "={{ $json.ready_count }}",
              "operator": {
                "type": "number",
                "operation": "gt"
              },
              "rightValue": 0
            }
          ],
          "combinator": "and"
        },
        "options": {}
      }
    },
    {
      "id": "6ebb3acc-63f1-44b9-a35f-29262a11f9d4",
      "name": "All Variants Failed",
      "type": "n8n-nodes-base.stopAndError",
      "typeVersion": 1,
      "position": [
        810,
        -360
      ],
      "parameters": {
        "errorMessage": "=None of the 3 Sisif variants finished: {{ $json.variants.map(v => 'Variant ' + v.variant + ' ' + v.status).join(', ') }}"
      }
    }
  ],
  "connections": {
    "Product URL Form": {
      "main": [
        [
          {
            "node": "Settings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Product URL Webhook": {
      "main": [
        [
          {
            "node": "Settings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Settings": {
      "main": [
        [
          {
            "node": "Fetch Product Page",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Product Page": {
      "main": [
        [
          {
            "node": "Extract Page Text",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Page Text": {
      "main": [
        [
          {
            "node": "Write Hook And Script",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Write Hook And Script": {
      "main": [
        [
          {
            "node": "Split Into Variants",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Into Variants": {
      "main": [
        [
          {
            "node": "Loop Over Variants",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Sisif Video": {
      "main": [
        [
          {
            "node": "Start Poll Counter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait Before Status Check": {
      "main": [
        [
          {
            "node": "Check Video Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Video Status": {
      "main": [
        [
          {
            "node": "Track Poll Attempt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Collect Variant": {
      "main": [
        [
          {
            "node": "Loop Over Variants",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Slack Message": {
      "main": [
        [
          {
            "node": "Any Variant Ready?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ask For Approval In Slack": {
      "main": [
        [
          {
            "node": "Was A Variant Approved?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Pick Approved Variant": {
      "main": [
        [
          {
            "node": "Create Instagram Reel Container",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Instagram Reel Container": {
      "main": [
        [
          {
            "node": "Start Instagram Poll Counter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait For Instagram Processing": {
      "main": [
        [
          {
            "node": "Check Container Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Container Status": {
      "main": [
        [
          {
            "node": "Track Instagram Poll Attempt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Variants": {
      "main": [
        [
          {
            "node": "Build Slack Message",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Create Sisif Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is Video Ready?": {
      "main": [
        [
          {
            "node": "Collect Variant",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Did Generation Fail?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Did Generation Fail?": {
      "main": [
        [
          {
            "node": "Collect Variant",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Under Max Attempts?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Was A Variant Approved?": {
      "main": [
        [
          {
            "node": "Pick Approved Variant",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is Container Finished?": {
      "main": [
        [
          {
            "node": "Publish Instagram Reel",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Under Instagram Max Attempts?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Write Hook And Script",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Ad Script Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Write Hook And Script",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Start Poll Counter": {
      "main": [
        [
          {
            "node": "Wait Before Status Check",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Track Poll Attempt": {
      "main": [
        [
          {
            "node": "Is Video Ready?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Under Max Attempts?": {
      "main": [
        [
          {
            "node": "Wait Before Status Check",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Collect Variant",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Start Instagram Poll Counter": {
      "main": [
        [
          {
            "node": "Wait For Instagram Processing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Track Instagram Poll Attempt": {
      "main": [
        [
          {
            "node": "Is Container Finished?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Under Instagram Max Attempts?": {
      "main": [
        [
          {
            "node": "Wait For Instagram Processing",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Instagram Processing Timed Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Any Variant Ready?": {
      "main": [
        [
          {
            "node": "Ask For Approval In Slack",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "All Variants Failed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": false
  }
}