{
  "id": "HHh4OQdlW0968mQl",
  "meta": {
    "templateId": "6047"
  },
  "name": "Create Sora 2 Video",
  "tags": [],
  "nodes": [
    {
      "id": "4767c432-c789-48c6-b3a4-477bf044058b",
      "name": "Sora 2Video",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -32,
        1664
      ],
      "parameters": {
        "url": "https://api.openai.com/v1/videos",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "model",
              "value": "sora-2"
            },
            {
              "name": "prompt",
              "value": "={{ $json.prompt }}"
            },
            {
              "name": "size",
              "value": "720x1280"
            },
            {
              "name": "seconds",
              "value": "4"
            }
          ]
        },
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "ac5a8923-d853-4f57-bc58-4eeed4aaf6bc",
      "name": "Get Video",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        304,
        1664
      ],
      "parameters": {
        "url": "=https://api.openai.com/v1/videos/{{ $json.id }}",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "2f52071d-81b0-4690-b253-f33310f8cdb6",
      "name": "Check if Video Generation is Complete1",
      "type": "n8n-nodes-base.if",
      "position": [
        480,
        1664
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "db9a5dec-997b-4c3f-9582-37c9bbeb19ff",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "=true",
              "rightValue": "={{ $json.data.successFlag == 1 }}"
            }
          ]
        },
        "looseTypeValidation": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "7695bace-f47f-4cbe-9e3b-1e3a03dc98f6",
      "name": "Text Prompt",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -240,
        1664
      ],
      "parameters": {
        "options": {
          "appendAttribution": false
        },
        "formTitle": "AI video generator",
        "formFields": {
          "values": [
            {
              "fieldLabel": "prompt",
              "requiredField": true
            }
          ]
        },
        "formDescription": "Please fill in the following information to generate your video"
      },
      "typeVersion": 2.2
    },
    {
      "id": "ecc61af3-2780-41d6-90cc-73b43fda6af1",
      "name": "Download Video",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        736,
        1648
      ],
      "parameters": {
        "url": "=https://api.openai.com/v1/videos/{{ $json.id }}/content",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "bf04ae62-72ff-4b14-8273-4c3793b49679",
      "name": "Wait for Video",
      "type": "n8n-nodes-base.wait",
      "position": [
        128,
        1664
      ],
      "parameters": {
        "unit": "minutes",
        "amount": 1
      },
      "typeVersion": 1.1
    },
    {
      "id": "f889e810-9f3f-4ee8-8859-3cce630a780c",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -880,
        1344
      ],
      "parameters": {
        "color": 3,
        "width": 576,
        "height": 848,
        "content": "## For more tutorials visit our [Youtube](https://www.youtube.com/@AIBIZElevate77)\n\n\n---\n\n### 1. Setup\n\n- Obtain your OpenAI API key from the [OpenAI account dashboard](https://openai.com/api/).\n\n- Replace 'Your_API_Key' in all HTTP request nodes with your actual OpenAI API key (Sora 2 Video node, Get Video node, Download Video node).\n\n- If you need to adjust video parameters such as video size or length refer to Sora 2 API [documentation](https://platform.openai.com/docs/models/sora-2).\n\n### 2. How it works:\n\n- Describe the video you want to create and enter the text prompt in Trigger Node (Text Prompt)\n\n- Sora 2 Video http node sends API request to OpenAI Sora 2.\n\n- A video generation takes a few minutes.\n\n- Get Video node checks the status of the video (in_progress or completed) in regular intervals (set up in Wait for Video node).\n\n-  When video is still processing, workflow loops back to wait and check the video status again.\n\n\n- When the video status equals completed (IF node condition), the Download Video node downloads the final video in mp4 format.\n\n---\n## Need Help or Want to Customize?\nFor further automation or integration, feel free to [book an appointment](https://aibizelevate.com/) or [LinkedIn](https://www.linkedin.com/in/barbora-svobodova-461b92285/)\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "1c8fd723-57a2-4e9f-a0ca-07db3a768cf2",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -288,
        1536
      ],
      "parameters": {
        "width": 224,
        "height": 336,
        "content": "## 1. Trigger Node\nFill your video prompt in the form and sumbit it to start the automation."
      },
      "typeVersion": 1
    },
    {
      "id": "9184cfc8-4c30-4da6-9a59-a5ff11fa69a8",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -48,
        1536
      ],
      "parameters": {
        "width": 720,
        "height": 336,
        "content": "## 2. Create Video and Check Status\nWhen the video creation request is submitted, the automation checks the video completion status in regular intervals."
      },
      "typeVersion": 1
    },
    {
      "id": "1512b07e-ce5e-49ef-883c-252d01ef9dfd",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        688,
        1536
      ],
      "parameters": {
        "width": 224,
        "height": 336,
        "content": "## Download Video\nDownload the completed video in mp4 format."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "91e4b8b0-1b1d-49e5-ab23-82b80ed1f485",
  "connections": {
    "Get Video": {
      "main": [
        [
          {
            "node": "Check if Video Generation is Complete1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sora 2Video": {
      "main": [
        [
          {
            "node": "Wait for Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Text Prompt": {
      "main": [
        [
          {
            "node": "Sora 2Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait for Video": {
      "main": [
        [
          {
            "node": "Get Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if Video Generation is Complete1": {
      "main": [
        [
          {
            "node": "Download Video",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait for Video",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}