Génération d'images IA avec MagicHour

Avancé

Ceci est uncontenant 25 nœuds.Utilise principalement des nœuds comme If, Set, Wait, Webhook, HttpRequest. Création de médias IA automatisée, optimisation des prompts avec MagicHour AI et GPT-4

Prérequis
  • Point de terminaison HTTP Webhook (généré automatiquement par n8n)
  • Peut nécessiter les informations d'identification d'authentification de l'API cible
  • Clé API OpenAI

Catégorie

-
Aperçu du workflow
Visualisation des connexions entre les nœuds, avec support du zoom et du déplacement
Exporter le workflow
Copiez la configuration JSON suivante dans n8n pour importer et utiliser ce workflow
{
  "id": "PwD9bKQiuu5Rtufl",
  "meta": {
    "instanceId": "3c35a703d75886d08705c211ee107a7513430dd05494ec0c569f28570a3768fa",
    "templateCredsSetupCompleted": true
  },
  "name": "AI Image Generation with MagicHour",
  "tags": [],
  "nodes": [
    {
      "id": "f00a60e4-3025-4561-8e82-a737b69ce1e6",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -2208,
        -960
      ],
      "webhookId": "316b0cb8-1699-400b-a68b-97311bef3c17",
      "parameters": {
        "path": "generate-image",
        "options": {
          "allowedOrigins": "*"
        },
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 2.1
    },
    {
      "id": "6ee2c66f-5cb2-43ca-9cae-c73bb908d1fb",
      "name": "Générer un prompt d'image",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -1344,
        -1232
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1",
          "cachedResultName": "GPT-4.1"
        },
        "options": {
          "topP": 1,
          "temperature": 0.5
        },
        "messages": {
          "values": [
            {
              "content": "=Generate a comprehensive and detailed image generation prompt from {{ $json.body.prompt }} for AI image generation model as input. Use the following information:\n\n**Subject**: AI generated\n**Image Count**: {{ $json.body.parameters.image_count }}\n**Orientation**: {{ $json.body.parameters.orientation }}\n**Style**: {{ $json.body.parameters.style.tool }}"
            },
            {
              "role": "system",
              "content": "=## Purpose\nYou are a prompt-generation agent. Your task is to convert structured user input into a clean, descriptive prompt suitable for text-to-image generation models (e.g., RunwayML, Stability AI, Midjourney). You do not generate images yourself. You must never invent or infer content beyond what is explicitly provided.\n\n---\n\n## Generate Subject\n- **Subject**: \n  - **ANALYZE** the user prompt carefully to create a subject. Make sure the subject is precisely inline with user expectation and their tone. \n\n## Generate Characters\n- **Character list**: \n  - Create a character list based on their roles in the user prompt\n  - Create authentic appearance, clothing when any religious prompt is provided\n\n## Output Requirements\n- Generate a **non-empty prompt** that is **≤1000 characters**, measured in UTF-16 code units.\n- The prompt must be:\n  - Grammatically correct\n  - Visually descriptive\n  - Free of filler, emotional tone, or interpretation unless explicitly provided\n  - Strictly limited to elements present in the input\n  - NO USE OF \"\". ONLY use ''\n\n---\n\n## Input Expectations\nYou will receive structured input containing:\n- **Style**: visual style (e.g., realistic, cinematic, flat vector, watercolor)\n- **Scene details**: setting, objects, characters\n- **Text overlays** (if any): exact wording and placementl\n- **Aspect ratio or dimensions** (optional)\n\nIf any required field is missing or ambiguous, you must request clarification. Do not guess or proceed with assumptions.\n\n---\n\n## Prompt Format\nProduce a single prompt string suitable for direct use in a text-to-image API. Example:\n\n> \"A realistic portrait of a Sikh man in traditional attire standing in front of the Golden Temple at sunrise, with soft lighting and warm tones. No text overlay.\"\n\n---\n\n## Constraints\n- Do **not** add characters, objects, settings, or styles not present in the input.\n- Do **not** infer emotional tone, symbolism, or narrative unless explicitly described.\n- Do **not** include fantasy, surreal, or fictional elements unless requested.\n- Do **not** include political figures, celebrities, or religious icons unless authorized.\n- Do **not** exceed 500 UTF-16 characters under any circumstance.\n- Do **not** use double quotes. Output should be JSON compatible\n\n\n---\n\n## Character Control\n- Only include characters listed in the input.\n- Do **not** invent names, faces, roles, or behaviors.\n- If a character is referenced without description, request clarification.\n\n---\n\n## Typography & Text Rules\n- Use only text explicitly provided.\n- Do **not** add slogans, captions, or labels unless specified.\n- Font style, size, color, and placement must match instructions.\n\n---\n\n## Clarification Logic\nIf the input is vague, contradictory, or incomplete:\n- **Pause prompt generation**\n- **Respond with a clarification request**\n- Do **not** guess or proceed with assumptions\n\n---\n\n## Integration Notes\n- Designed for use in automated workflows (e.g., n8n, Zapier, API pipelines)\n- Output is a single prompt string for downstream image generation\n- Compatible with models that accept natural language input and enforce character limits (e.g., RunwayML, Stability AI)\n"
            }
          ]
        }
      },
      "credentials": {
        "openAiApi": {
          "id": "PzzLblAykQPFIDZf",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "c623f5ca-8b61-471f-958a-fe631a344af1",
      "name": "Répondre à Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1216,
        -976
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.4
    },
    {
      "id": "941f585d-52aa-4a34-bf38-04c7a6c8c3fe",
      "name": "Si",
      "type": "n8n-nodes-base.if",
      "position": [
        -1920,
        -1104
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "08c86a8b-f2a8-4a5d-99a3-dc1079267c87",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.body.type }}",
              "rightValue": "image"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "cb6e7ecb-a20e-40b1-9c98-dd1cd788a560",
      "name": "Attendre",
      "type": "n8n-nodes-base.wait",
      "position": [
        16,
        -1216
      ],
      "webhookId": "9835fad4-06fc-4e09-9595-0c6f5ad59283",
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "0a9dc79f-32b5-4ca6-a4f1-beb656b3acc6",
      "name": "Obtenir les détails de l'image",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        256,
        -1136
      ],
      "parameters": {
        "url": "=https://api.magichour.ai/v1/image-projects/{{ $('ai-image-generator').item.json.id }}",
        "options": {},
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "accept",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpBearerAuth": {
          "id": "bGXAPcjNHEGxQCF1",
          "name": "MagicHour AI"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "6c753ca8-98c1-4a8a-9e04-6d69094d731b",
      "name": "Si1",
      "type": "n8n-nodes-base.if",
      "position": [
        544,
        -1136
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "e240e5dc-6bdf-47a3-85c4-098b5e3235fc",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "complete"
            },
            {
              "id": "cfeb1810-471d-438a-ad2c-f2bf14124616",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "error"
            },
            {
              "id": "5b001186-3156-4f1a-bc59-7e55c51d83ff",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "cancelled"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "c1d25e83-a30a-4f2d-84cf-d4a6a86e646b",
      "name": "Note adhésive",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -16,
        -1568
      ],
      "parameters": {
        "width": 416,
        "height": 576,
        "content": "## The image can be one of the following status\n\n**draft** - not currently used\nqueued - the job is queued and waiting for a GPU\n**rendering** - the generation is in progress\n**complete** - the image is successful created\n**error** - an error occurred during rendering\n**canceled** - image render is canceled by the user\n\n**IF Loop** is to check if the Image processing has completed at the backend or not."
      },
      "typeVersion": 1
    },
    {
      "id": "deb09fda-0660-4c02-a3cc-1c022bf44b9e",
      "name": "Si2",
      "type": "n8n-nodes-base.if",
      "position": [
        -640,
        -960
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "19a5f814-1943-49b7-97b6-e0af31eee57b",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.id }}",
              "rightValue": ""
            },
            {
              "id": "deea2b1d-a20d-4a8f-911c-02518bcad2ad",
              "operator": {
                "type": "number",
                "operation": "gt"
              },
              "leftValue": "={{ $json.credits_charged }}",
              "rightValue": 0
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "f4c83f1a-e23c-496c-8594-6f4d2301798d",
      "name": "Télécharger l'image",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        832,
        -1152
      ],
      "parameters": {
        "url": "={{ $json.downloads[0].url }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "dfdccb9b-0ee4-42ea-adb7-0ebc652efe9f",
      "name": "Générer un prompt vidéo",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -1360,
        -704
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1",
          "cachedResultName": "GPT-4.1"
        },
        "options": {
          "topP": 1,
          "temperature": 0.6
        },
        "messages": {
          "values": [
            {
              "content": "=Generate a comprehensive and detailed video generation prompt from {{ $json.body.prompt }} for AI image generation model as input. Use the following information:\n\n**Subject**: AI generated\n**Duration**: {{ $json.body.parameters.end_seconds }}\n**Orientation**: {{ $json.body.parameters.orientation }}\n**Resolution**: {{ $json.body.parameters.resolution }}"
            },
            {
              "role": "system",
              "content": "=## 🔹 Purpose\nYou are a prompt-generation agent. Your task is to convert minimal or structured user input into a clean, descriptive prompt suitable for text-to-video generation models (e.g., RunwayML Gen-2, Pika, Luma). You do not generate videos yourself. You must never invent characters, narrative arcs, or symbolic meaning beyond what is explicitly provided or reasonably inferred.\n\n---\n\n## 🔹 Output Requirements\n- Generate a **non-empty**, grammatically correct prompt string\n- Output must be **≤1000 UTF-16 characters**\n- Prompt must be:\n  - Visually descriptive\n  - Free of emotional tone or interpretation unless specified\n  - Strictly limited to elements provided or inferred from context\n  - Suitable for direct use in a text-to-video API\n\n---\n\n## 🔹 Input Expectations\nYou may receive minimal or structured input containing:\n- **Subject or concept** (e.g., “two world leaders playing chess”)\n- **Duration** (e.g., 5 seconds)\n- **Style** (e.g., realistic, cinematic, animated)\n- **Optional details**:\n  - Characters\n  - Setting\n  - Scene breakdown\n  - Audio/narration\n  - Text overlays\n  - End frame instructions\n\n---\n\n## 🔹 Default Handling Logic\nIf specific details are missing, apply the following default assumptions:\n\n- **Characters**: Represent as generic silhouettes or neutral figures unless described\n- **Setting**: Default to a neutral indoor space with soft lighting\n- **Scene Breakdown**: Use a single continuous shot with minimal movement\n- **Audio/Narration**: Assume silence unless ambient sound or narration is specified\n- **Text Overlays**: Assume no text unless explicitly requested\n- **Transitions**: Use hard cuts or static framing unless otherwise described\n\n---\n\n## 🔹 Output Format\nProduce a single prompt string. Example:\n\n> \"A 5-second cinematic video showing two silhouetted world leaders seated across a chessboard in a dimly lit formal room. One leader makes a move while the other watches intently. The camera remains static. No narration or text overlay.\"\n\n---\n\n## 🔹 Constraints\n- Do **not** add characters, symbols, or narrative elements not present or implied\n- Do **not** infer emotional tone, symbolism, or political meaning\n- Do **not** include fantasy, surreal, or fictional content unless requested\n- Do **not** include political figures, celebrities, or religious icons unless authorized\n\n---\n\n## 🔹 Clarification Logic\nIf the input is contradictory or dangerously vague:\n- **Pause prompt generation**\n- **Respond with a clarification request**\n- Do **not** guess or proceed with assumptions that could misrepresent intent\n\n---\n\n## 🔹 Integration Notes\n- Designed for use in automated workflows (e.g., n8n, Zapier, API pipelines)\n- Output is a single prompt string for downstream video generation\n- Compatible with models that accept natural language input and enforce character limits\n"
            }
          ]
        }
      },
      "credentials": {
        "openAiApi": {
          "id": "PzzLblAykQPFIDZf",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "a18904cc-6f73-494c-903a-8b074159218d",
      "name": "Modifier les champs2",
      "type": "n8n-nodes-base.set",
      "position": [
        -1568,
        -688
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "3e45a85a-be16-480c-8ce9-f9fe7ae07ba5",
              "name": "body.prompt",
              "type": "string",
              "value": "={{ $('Webhook').item.json.body.parameters.style.prompt }}"
            },
            {
              "id": "d1742fce-32ae-4d00-940b-7a6e341f90f7",
              "name": "body.parameters.name",
              "type": "string",
              "value": "={{ $('Webhook').item.json.body.parameters.name }}"
            },
            {
              "id": "b32892cc-7b6b-4ad7-a24f-27e93bc99364",
              "name": "body.parameters.end_seconds",
              "type": "number",
              "value": "={{ $('Webhook').item.json.body.parameters.end_seconds }}"
            },
            {
              "id": "69b8e6de-23dd-4fd1-b31c-a63fbf52b6c9",
              "name": "body.parameters.orientation",
              "type": "string",
              "value": "={{ $('Webhook').item.json.body.parameters.orientation }}"
            },
            {
              "id": "6e6c76ad-a508-497c-9e35-66f0aa0798a9",
              "name": "body.parameters.resolution",
              "type": "string",
              "value": "={{ $('Webhook').item.json.body.parameters.resolution }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "56c92629-de44-455a-bdea-a8af21a436f3",
      "name": "Obtenir les données de Webhook",
      "type": "n8n-nodes-base.set",
      "position": [
        -1568,
        -1232
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "3e45a85a-be16-480c-8ce9-f9fe7ae07ba5",
              "name": "body.prompt",
              "type": "string",
              "value": "={{ $json.body.parameters.style.prompt }}"
            },
            {
              "id": "4c8bbfdd-15e9-4e4b-8d85-2c3ed5048738",
              "name": "body.parameters.style.tool",
              "type": "string",
              "value": "={{ $json.body.parameters.style.tool }}"
            },
            {
              "id": "e75c66ce-03a8-486b-a761-a362e2a0236f",
              "name": "body.parameters.name",
              "type": "string",
              "value": "={{ $json.body.parameters.name }}"
            },
            {
              "id": "93503d53-a707-406c-81c2-5062b06391b6",
              "name": "body.parameters.image_count",
              "type": "number",
              "value": "={{ $json.body.parameters.image_count }}"
            },
            {
              "id": "5a10f233-78cb-4b87-b3cd-61f087f947ff",
              "name": "body.parameters.orientation",
              "type": "string",
              "value": "={{ $json.body.parameters.orientation }}"
            },
            {
              "id": "909e57e2-5fa4-4647-94ec-7143be75062f",
              "name": "body.type",
              "type": "string",
              "value": "={{ $json.body.type }}"
            },
            {
              "id": "6271c772-a93a-4495-af5b-694e23483d79",
              "name": "body.action",
              "type": "string",
              "value": "={{ $json.body.action }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "33d63aeb-a2ad-4828-ac5a-43fac9794aac",
      "name": "Note adhésive1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1104,
        -1600
      ],
      "parameters": {
        "width": 384,
        "height": 592,
        "content": "## POST Request\n\n**Add credentials** for the MagicHour.ai and  the make sure the body content has the JSON in following format;\n\n```\n{\n  \"name\": \"<String>\",\n  \"image_count\": <Number>,\n  \"orientation\": \"<String>\",\n  \"style\": {\n    \"prompt\": \"<String>\",\n    \"tool\": \"<String>\"\n  }\n}\n```"
      },
      "typeVersion": 1
    },
    {
      "id": "424e2d3a-93dc-4415-963b-f10f1fdbe092",
      "name": "Note adhésive2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        736,
        -1376
      ],
      "parameters": {
        "width": 336,
        "height": 832,
        "content": "## GET Request\n\n**GET** request to download the created Image or the video file\n"
      },
      "typeVersion": 1
    },
    {
      "id": "27979d9b-1e87-4777-b935-175d58acdf31",
      "name": "Note adhésive3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1104,
        -960
      ],
      "parameters": {
        "width": 368,
        "height": 416,
        "content": "## POST Request\n\nThe **POST Request** responds back with Id\n\n```\n{\n  \"id\": \"cuid-example\",\n  \"estimated_frame_cost\": 450,\n  \"credits_charged\": 450\n}\n\n```"
      },
      "typeVersion": 1
    },
    {
      "id": "9321dada-7ef9-42bd-9b4b-e405de84ae3f",
      "name": "Si3",
      "type": "n8n-nodes-base.if",
      "position": [
        -352,
        -1088
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "69e57e0d-864d-4080-a8a8-1cf933308e79",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $item(\"0\").$node[\"Webhook\"].json[\"body\"][\"type\"] }}",
              "rightValue": "image"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "69469d82-f353-4c10-a31d-fbb5414f6718",
      "name": "Obtenir les détails d'erreur",
      "type": "n8n-nodes-base.set",
      "position": [
        192,
        -256
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "817f5e6f-6548-49b2-834b-9a9199a63c06",
              "name": "error.message",
              "type": "string",
              "value": "={{ $json.error.message }}"
            },
            {
              "id": "80b4427b-7157-41e1-b694-dfe214cd4c1c",
              "name": "error.code",
              "type": "string",
              "value": "={{ $json.error.code }}"
            },
            {
              "id": "37299c90-153c-48d1-b21b-f4c8c97e97d3",
              "name": "error.status",
              "type": "number",
              "value": "={{ $json.error.status }}"
            },
            {
              "id": "712965ae-c018-4dbf-84c5-d031e76214ae",
              "name": "finish_reason",
              "type": "string",
              "value": "={{ $json.finish_reason }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "79aa3064-f37f-4bbb-bfde-d9dba40a5975",
      "name": "Note adhésive4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        32,
        -464
      ],
      "parameters": {
        "width": 384,
        "height": 352,
        "content": "## Capture Errors from HTTP run\n\nThis will catch any errors in running the HTTP Post request. \n\nThis **does not** capture the errors from generating Image or Video\n"
      },
      "typeVersion": 1
    },
    {
      "id": "205e235d-fac9-4288-983d-b1b31407f0dc",
      "name": "générateur-ai-image",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueErrorOutput",
      "position": [
        -976,
        -1232
      ],
      "parameters": {
        "url": "https://api.magichour.ai/v1/ai-image-generator",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"name\": \"{{ $('Get Data from Webhook').item.json.body.parameters.name }}\",\n  \"image_count\": {{ $('Get Data from Webhook').item.json.body.parameters.image_count }},\n  \"orientation\": \"{{ $('Get Data from Webhook').item.json.body.parameters.orientation }}\",\n  \"style\": {\n    \"prompt\": \"{{ $json.message.content }}\",\n    \"tool\": \"{{ $('Get Data from Webhook').item.json.body.parameters.style.tool }}\"\n  }\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "accept",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpBearerAuth": {
          "id": "bGXAPcjNHEGxQCF1",
          "name": "MagicHour AI"
        }
      },
      "typeVersion": 4.2,
      "alwaysOutputData": true
    },
    {
      "id": "c0186ccf-3bfa-4390-a5a0-41245db45873",
      "name": "texte-vers-vidéo",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueErrorOutput",
      "position": [
        -976,
        -688
      ],
      "parameters": {
        "url": "https://api.magichour.ai/v1/text-to-video",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"name\": \"{{ $('Edit Fields2').item.json.body.parameters.name }}\",\n  \"end_seconds\": {{ $('Edit Fields2').item.json.body.parameters.end_seconds }},\n  \"orientation\": \"{{ $('Edit Fields2').item.json.body.parameters.orientation }}\",\n  \"resolution\": \"{{ $('Edit Fields2').item.json.body.parameters.resolution }}\",\n  \"style\": {\n    \"prompt\": \"{{ $json.message.content }}\"\n  }\n} ",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "accept",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpBearerAuth": {
          "id": "bGXAPcjNHEGxQCF1",
          "name": "MagicHour AI"
        }
      },
      "typeVersion": 4.2,
      "alwaysOutputData": true
    },
    {
      "id": "e4bfdb41-1e79-40b9-adc7-fc353bb9dc64",
      "name": "Attendre1",
      "type": "n8n-nodes-base.wait",
      "position": [
        32,
        -736
      ],
      "webhookId": "3b834feb-d5dd-4637-b488-d00e66c9537d",
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "aaf5f07a-7086-4f90-b959-fc3a51d5cb3c",
      "name": "Obtenir les détails de la vidéo",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        224,
        -736
      ],
      "parameters": {
        "url": "https://api.magichour.ai/v1/video-projects/id",
        "options": {},
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "accept",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpBearerAuth": {
          "id": "bGXAPcjNHEGxQCF1",
          "name": "MagicHour AI"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "b86b8653-7125-49cc-934a-efbf729e92df",
      "name": "Si4",
      "type": "n8n-nodes-base.if",
      "position": [
        560,
        -736
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "e240e5dc-6bdf-47a3-85c4-098b5e3235fc",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "complete"
            },
            {
              "id": "cfeb1810-471d-438a-ad2c-f2bf14124616",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "error"
            },
            {
              "id": "5b001186-3156-4f1a-bc59-7e55c51d83ff",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "cancelled"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "0dec21e4-5da8-4b1c-acfd-e051d12daf27",
      "name": "Télécharger la vidéo",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        864,
        -752
      ],
      "parameters": {
        "url": "={{ $json.downloads[0].url }}",
        "options": {}
      },
      "typeVersion": 4.2
    }
  ],
  "active": true,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "ce361a06-9a8c-4df2-a40d-139c04f5ce71",
  "connections": {
    "941f585d-52aa-4a34-bf38-04c7a6c8c3fe": {
      "main": [
        [
          {
            "node": "56c92629-de44-455a-bdea-a8af21a436f3",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "a18904cc-6f73-494c-903a-8b074159218d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "6c753ca8-98c1-4a8a-9e04-6d69094d731b": {
      "main": [
        [
          {
            "node": "f4c83f1a-e23c-496c-8594-6f4d2301798d",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "cb6e7ecb-a20e-40b1-9c98-dd1cd788a560",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "deb09fda-0660-4c02-a3cc-1c022bf44b9e": {
      "main": [
        [
          {
            "node": "9321dada-7ef9-42bd-9b4b-e405de84ae3f",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "9321dada-7ef9-42bd-9b4b-e405de84ae3f": {
      "main": [
        [
          {
            "node": "cb6e7ecb-a20e-40b1-9c98-dd1cd788a560",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "e4bfdb41-1e79-40b9-adc7-fc353bb9dc64",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "b86b8653-7125-49cc-934a-efbf729e92df": {
      "main": [
        [
          {
            "node": "0dec21e4-5da8-4b1c-acfd-e051d12daf27",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "e4bfdb41-1e79-40b9-adc7-fc353bb9dc64",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "cb6e7ecb-a20e-40b1-9c98-dd1cd788a560": {
      "main": [
        [
          {
            "node": "0a9dc79f-32b5-4ca6-a4f1-beb656b3acc6",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "e4bfdb41-1e79-40b9-adc7-fc353bb9dc64": {
      "main": [
        [
          {
            "node": "aaf5f07a-7086-4f90-b959-fc3a51d5cb3c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "f00a60e4-3025-4561-8e82-a737b69ce1e6": {
      "main": [
        [
          {
            "node": "941f585d-52aa-4a34-bf38-04c7a6c8c3fe",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a18904cc-6f73-494c-903a-8b074159218d": {
      "main": [
        [
          {
            "node": "dfdccb9b-0ee4-42ea-adb7-0ebc652efe9f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "c0186ccf-3bfa-4390-a5a0-41245db45873": {
      "main": [
        [
          {
            "node": "deb09fda-0660-4c02-a3cc-1c022bf44b9e",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "69469d82-f353-4c10-a31d-fbb5414f6718",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "f4c83f1a-e23c-496c-8594-6f4d2301798d": {
      "main": [
        [
          {
            "node": "c623f5ca-8b61-471f-958a-fe631a344af1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "0dec21e4-5da8-4b1c-acfd-e051d12daf27": {
      "main": [
        [
          {
            "node": "c623f5ca-8b61-471f-958a-fe631a344af1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "69469d82-f353-4c10-a31d-fbb5414f6718": {
      "main": [
        [
          {
            "node": "c623f5ca-8b61-471f-958a-fe631a344af1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "0a9dc79f-32b5-4ca6-a4f1-beb656b3acc6": {
      "main": [
        [
          {
            "node": "6c753ca8-98c1-4a8a-9e04-6d69094d731b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "aaf5f07a-7086-4f90-b959-fc3a51d5cb3c": {
      "main": [
        [
          {
            "node": "b86b8653-7125-49cc-934a-efbf729e92df",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "205e235d-fac9-4288-983d-b1b31407f0dc": {
      "main": [
        [
          {
            "node": "deb09fda-0660-4c02-a3cc-1c022bf44b9e",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "69469d82-f353-4c10-a31d-fbb5414f6718",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "6ee2c66f-5cb2-43ca-9cae-c73bb908d1fb": {
      "main": [
        [
          {
            "node": "205e235d-fac9-4288-983d-b1b31407f0dc",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "dfdccb9b-0ee4-42ea-adb7-0ebc652efe9f": {
      "main": [
        [
          {
            "node": "c0186ccf-3bfa-4390-a5a0-41245db45873",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "56c92629-de44-455a-bdea-a8af21a436f3": {
      "main": [
        [
          {
            "node": "6ee2c66f-5cb2-43ca-9cae-c73bb908d1fb",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Foire aux questions

Comment utiliser ce workflow ?

Copiez le code de configuration JSON ci-dessus, créez un nouveau workflow dans votre instance n8n et sélectionnez "Importer depuis le JSON", collez la configuration et modifiez les paramètres d'authentification selon vos besoins.

Dans quelles scénarios ce workflow est-il adapté ?

Avancé

Est-ce payant ?

Ce workflow est entièrement gratuit et peut être utilisé directement. Veuillez noter que les services tiers utilisés dans le workflow (comme l'API OpenAI) peuvent nécessiter un paiement de votre part.

Informations sur le workflow
Niveau de difficulté
Avancé
Nombre de nœuds25
Catégorie-
Types de nœuds8
Description de la difficulté

Adapté aux utilisateurs avancés, avec des workflows complexes contenant 16+ nœuds

Auteur
inderjeet Bhambra

inderjeet Bhambra

@idsinghbhambra

I am on a journey to learn and spread the automations through n8n workflows.

Liens externes
Voir sur n8n.io

Partager ce workflow

Catégories

Catégories: 34