{
  "nodes": [
    {
      "id": "d76dcc93-ddc5-4d2c-91e4-5f316e8c774a",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -2060,
        -60
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "hours",
              "hoursInterval": 6
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "ab64859d-5ff3-4ee7-bff0-7045057129e9",
      "name": "Create Sisif Video",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -960,
        -60
      ],
      "parameters": {
        "url": "https://sisif.ai/api/videos/generate/",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "prompt",
              "value": "={{ $json.output.idea }}"
            },
            {
              "name": "duration",
              "value": "5"
            },
            {
              "name": "resolution",
              "value": "540x960"
            }
          ]
        },
        "genericAuthType": "httpBearerAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        },
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.1
    },
    {
      "id": "3ceaee8a-2f0c-4419-9566-96e257faf189",
      "name": "Wait 10s",
      "type": "n8n-nodes-base.wait",
      "position": [
        -680,
        -60
      ],
      "parameters": {
        "unit": "seconds",
        "amount": 10
      },
      "typeVersion": 1
    },
    {
      "id": "d446c5f8-b75a-4335-8efe-b628b4c36868",
      "name": "Check Video Status",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -480,
        -60
      ],
      "parameters": {
        "url": "=https://sisif.ai/api/videos/{{ $json.id }}/",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        },
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.1
    },
    {
      "id": "f6902563-9d3e-48f3-97ab-fd1a4acd5900",
      "name": "Video Ready?",
      "type": "n8n-nodes-base.if",
      "position": [
        -240,
        -60
      ],
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json.status }}",
              "value2": "READY"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "d3039e4d-0025-4fea-820c-be504fb2e332",
      "name": "Prepare Final Data",
      "type": "n8n-nodes-base.function",
      "position": [
        220,
        -80
      ],
      "parameters": {
        "functionCode": "// Extract the final video data\nconst videoData = items[0].json;\n\n// Create a summary of the completed video\nreturn [{\n  json: {\n    prompt: videoData.prompt,\n    duration: videoData.duration,\n    resolution: videoData.resolution,\n    sisif_id: videoData.sisif_id,\n    video_url: videoData.video_url,\n    status: videoData.status,\n    watch_url: `https://sisif.ai/app/watch/${videoData.sisif_id}/`,\n    completed_at: new Date().toISOString()\n  }\n}];"
      },
      "typeVersion": 1
    },
    {
      "id": "4201a3d1-9fe8-4096-bb08-9fcbfe040baf",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        -1320,
        160
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"idea\": \"Generate video ...\"\n}\n"
      },
      "typeVersion": 1.2
    },
    {
      "id": "efdf357d-df86-4bed-a859-7627f42a69fe",
      "name": "Idea creator",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        -1500,
        -60
      ],
      "parameters": {
        "text": "=You are a creative strategist for Instagram Reels. Using the topic {{$json.reels_topic}}, generate a concise, trend-aware idea. Mention the following style {{$json.style}}. Short, vivid wording. Max 30 words.\n\nOutput JSON only: { \"idea\": \"...\" }",
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.6
    },
    {
      "id": "dcb0d350-4e17-42eb-b7ca-8a4ad2d23524",
      "name": "Set Reels Config",
      "type": "n8n-nodes-base.set",
      "position": [
        -1800,
        -60
      ],
      "parameters": {
        "values": {
          "string": [
            {
              "name": "reels_topic",
              "value": "travel-inspired beach vibes"
            },
            {
              "name": "style",
              "value": "honeymoon"
            },
            {
              "name": "duration",
              "value": "5"
            },
            {
              "name": "resolution",
              "value": "540x960"
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 2
    },
    {
      "id": "9dd623aa-d761-460a-9375-600c7c8501d7",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -1500,
        160
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "1b77f2d7-b45b-483a-99eb-62ff8343c548",
      "name": "\ud83d\udfe1 How this workflow works",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1180,
        -640
      ],
      "parameters": {
        "color": 4,
        "width": 1320,
        "height": 840,
        "content": "## Automate Instagram Reels video creation with OpenAI & Sisif.ai\n\n### Who\u2019s it for\nCreators, marketers & agencies needing hands-free Instagram Reels automation.\n\n### How it works\n1. Generates a trend-aware idea (GPT-4o-mini)\n2. Renders a 5-s 540x960 MP4 (Sisif.ai)\n3. Polls until the video is finished.\n\n### Step-by-step setup\n1. Create **OpenAI API** credentials on https://platform.openai.com/api-keys.\n2. Create **Sisif.ai API** credentials on https://sisif.ai/users/api-keys/\n3. Add **OpenAI API** & **Sisif.ai API** creds in n8n.\n4. Open the white sticky \u2192 edit topic, language, duration, resolution.\n5. Enable the Cron trigger (defaults to every 6 h).\n6. Run once to test. Activate when ready.\n\n### Customisation\n\u2022 Change Cron for frequency\n\u2022 Adjust JSON body in **Create Sisif video** for length/resolution\n\u2022 Edit prompt in **Idea creator** for tone\n\u2022 Update retry policy in **Check Video status** loop.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "69d7bbf9-84b0-4d75-93c1-652593dce0d8",
      "name": "\u2b1c\ufe0f Variables to edit",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1880,
        -220
      ],
      "parameters": {
        "color": 5,
        "width": 280,
        "height": 320,
        "content": "**Edit these in \u279c Set Reels Config**\n\n\u2022 `reels_topic`\n\u2022 `style`\n\u2022 `duration` (seconds)\n\u2022 `resolution` (e.g. 540x960)"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Wait 10s": {
      "main": [
        [
          {
            "node": "Check Video Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Idea creator": {
      "main": [
        [
          {
            "node": "Create Sisif Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Video Ready?": {
      "main": [
        [
          {
            "node": "Prepare Final Data",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait 10s",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Set Reels Config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Reels Config": {
      "main": [
        [
          {
            "node": "Idea creator",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Idea creator",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Check Video Status": {
      "main": [
        [
          {
            "node": "Video Ready?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Sisif Video": {
      "main": [
        [
          {
            "node": "Wait 10s",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Idea creator",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    }
  }
}