AutomationFlowsWeb Scraping › Generate AI Videos Using Havis AI Grok Imagine

Generate AI Videos Using Havis AI Grok Imagine

ByTran Trung Nghia @trungnghialk on n8n.io

This n8n workflow submits a video generation job to Havis AI Grok Imagine, waits for processing, polls task status, and returns result data when the job completes. Creators who want a reusable no-code generation form. Agencies building client-facing AI automation. Developers who…

Event trigger★★★★☆ complexity15 nodesForm TriggerHTTP Request
Web Scraping Trigger: Event Nodes: 15 Complexity: ★★★★☆ Added:

This workflow corresponds to n8n.io template #15587 — we link there as the canonical source.

This workflow follows the Form Trigger → HTTP Request recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "Havis AI - Grok Imagine",
  "nodes": [
    {
      "id": "880cd3f7-bbe8-49d7-a9c2-4253eb4be6fa",
      "name": "Sticky Note - Workflow Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -144,
        896
      ],
      "parameters": {
        "width": 512,
        "height": 848,
        "content": "## Havis AI - Grok Imagine\n\n### How it works\n\n1. The workflow shows a public n8n form for collecting a Grok Imagine request and a Havis API key.\n2. It converts the form values into the JSON payload expected by the Havis API.\n3. It submits the job to `https://havis.ai/api/grok-imagine` and receives a task ID.\n4. It polls `https://havis.ai/api/task/{task_id}` until the job finishes or fails.\n5. It returns the task metadata, credit usage, payload, and generated result URLs.\n\n### Setup steps\n\n- [ ] Create a Havis API key at https://havis.ai/manager/profile.\n- [ ] Open the form trigger URL after importing this workflow into n8n.\n- [ ] Enter the required Grok Imagine inputs: prompt, model, duration, image_url_1, image_url_2, image_url_3.\n- [ ] Confirm your Havis account has enough credits before running the workflow.\n- [ ] Adjust the polling wait time if your executions need faster or slower status checks.\n\n### Customization\n\nChange default prompt values, optional fields, polling interval, or the final output fields to match your automation. Keep the Havis domain fixed unless you intentionally publish a separate private workflow."
      },
      "typeVersion": 1
    },
    {
      "id": "f3a2fb24-903a-4de9-a5da-b1bd319e19e6",
      "name": "Sticky Note - Request Input",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        448,
        944
      ],
      "parameters": {
        "color": 7,
        "width": 320,
        "height": 384,
        "content": "## Collect request inputs\n\nThe form trigger captures the Havis API key plus the Grok Imagine inputs from the user.\n\nKey fields: prompt, model, duration, image_url_1, image_url_2, image_url_3, image_url_4, tag."
      },
      "typeVersion": 1
    },
    {
      "id": "d23a0f54-0143-42c9-8b29-a868a91b2358",
      "name": "Sticky Note - Payload Preparation",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        848,
        944
      ],
      "parameters": {
        "color": 7,
        "width": 320,
        "height": 384,
        "content": "## Build API payload\n\nThe code node trims blank values, applies default options, and builds a clean JSON body. Optional images, video URLs, audio URLs, tags, modes, or resolution fields are only included when provided."
      },
      "typeVersion": 1
    },
    {
      "id": "c66acbce-4d04-4e33-a0b8-d6206c2a680b",
      "name": "Sticky Note - API Submission",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1248,
        944
      ],
      "parameters": {
        "color": 7,
        "width": 400,
        "height": 384,
        "content": "## Submit generation job\n\nThe HTTP request sends the prepared payload to Havis AI with a bearer token. A successful response should include a `task_id` and the number of credits used for the request."
      },
      "typeVersion": 1
    },
    {
      "id": "7ccdbcd7-6455-4e86-a837-12d131edc4db",
      "name": "Sticky Note - Polling and Output",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1696,
        832
      ],
      "parameters": {
        "color": 7,
        "width": 880,
        "height": 720,
        "content": "## Poll and return result\n\nThe workflow waits, checks task status, branches on completed or failed states, and loops while the job is still processing. Completed runs return result URLs; failed runs return a readable error object."
      },
      "typeVersion": 1
    },
    {
      "id": "603ea7b8-99b2-6646-43b2-e405a40fea17",
      "name": "Form - Grok Imagine",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        520,
        1120
      ],
      "parameters": {
        "options": {},
        "formTitle": "Havis AI - Grok Imagine",
        "formFields": {
          "values": [
            {
              "fieldLabel": "api_key",
              "placeholder": "YOUR_HAVIS_API_KEY",
              "requiredField": true
            },
            {
              "fieldType": "textarea",
              "fieldLabel": "prompt",
              "placeholder": "A playful cinematic scene with surreal motion",
              "requiredField": true
            },
            {
              "fieldType": "dropdown",
              "fieldLabel": "model [optional]",
              "fieldOptions": {
                "values": [
                  {
                    "option": "normal"
                  },
                  {
                    "option": "fun"
                  }
                ]
              }
            },
            {
              "fieldLabel": "duration [optional]",
              "placeholder": "6"
            },
            {
              "fieldLabel": "image_url_1 [optional]",
              "placeholder": "https://example.com/reference.jpg"
            },
            {
              "fieldLabel": "image_url_2 [optional]",
              "placeholder": "https://example.com/reference.jpg"
            },
            {
              "fieldLabel": "image_url_3 [optional]",
              "placeholder": "https://example.com/reference.jpg"
            },
            {
              "fieldLabel": "image_url_4 [optional]",
              "placeholder": "https://example.com/reference.jpg"
            },
            {
              "fieldLabel": "tag [optional]",
              "placeholder": "n8n-grok-imagine"
            }
          ]
        },
        "formDescription": "Submit a Grok Imagine job through Havis AI and poll until it completes."
      },
      "typeVersion": 2.2
    },
    {
      "id": "270c5655-0914-10a8-d959-903d7131d78d",
      "name": "Build Payload",
      "type": "n8n-nodes-base.code",
      "position": [
        920,
        1120
      ],
      "parameters": {
        "jsCode": "const input = $json;\nconst clean = (value) => value === undefined || value === null ? '' : String(value).trim();\nconst body = {};\nconst apiKey = clean(input.api_key);\nfunction put(name, label, type, required) {\n  const value = clean(input[label]);\n  if (!value && !required) return;\n  if (type === \"number\") { const n = Number(value); if (!Number.isNaN(n)) body[name] = n; return; }\n  if (type === \"boolean\") { body[name] = value === \"true\" || value === \"1\" || value.toLowerCase() === \"yes\"; return; }\n  body[name] = value;\n}\nput(\"prompt\", \"prompt\", \"string\", true);\nput(\"model\", \"model [optional]\", \"string\", false);\nput(\"duration\", \"duration [optional]\", \"number\", false);\nif (body[\"model\"] === undefined || body[\"model\"] === '') body[\"model\"] = \"normal\";\nconst arr0 = [\"image_url_1 [optional]\",\"image_url_2 [optional]\",\"image_url_3 [optional]\",\"image_url_4 [optional]\"].map(label => clean(input[label])).filter(Boolean);\nif (arr0.length) body[\"images\"] = arr0;\nbody.tag = clean(input['tag [optional]']) || \"n8n-grok-imagine\";\nreturn [{ json: { api_key: apiKey, body } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "8c90ec3b-acd9-7bb2-3e61-aaa12d772958",
      "name": "Submit - Havis API",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1320,
        1120
      ],
      "parameters": {
        "url": "https://havis.ai/api/grok-imagine",
        "method": "POST",
        "options": {},
        "jsonBody": "={{ $json.body }}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            },
            {
              "name": "Authorization",
              "value": "=Bearer {{ $json.api_key }}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "993d2f2f-bcc9-5adb-69aa-60bb25009e90",
      "name": "Wait 8s",
      "type": "n8n-nodes-base.wait",
      "position": [
        1520,
        1120
      ],
      "parameters": {
        "unit": "seconds",
        "amount": 8
      },
      "typeVersion": 1.1
    },
    {
      "id": "2d93c25f-8474-ed51-aa37-fc3253bc79d5",
      "name": "Check Task Status",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1720,
        1120
      ],
      "parameters": {
        "url": "={{ 'https://havis.ai/api/task/' + $('Submit - Havis API').first().json.task_id }}",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer {{ $('Build Payload').first().json.api_key }}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "b77b1fbc-6554-89cd-bf78-2b7999638459",
      "name": "Is Completed?",
      "type": "n8n-nodes-base.if",
      "position": [
        1920,
        1120
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": false,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "d0f849b2-1de6-b74f-c7e2-72f93839a178",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "completed"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "55253b25-5353-9b05-1335-5827cf652773",
      "name": "Is Failed?",
      "type": "n8n-nodes-base.if",
      "position": [
        2120,
        1240
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": false,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "e7b8e0bf-cec4-6dc0-8545-15ad67b03cd1",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "failed"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "9b898791-b115-e598-d467-35197d7fc546",
      "name": "Wait 8s (loop)",
      "type": "n8n-nodes-base.wait",
      "position": [
        2320,
        1360
      ],
      "parameters": {
        "unit": "seconds",
        "amount": 8
      },
      "typeVersion": 1.1
    },
    {
      "id": "83a5475d-cce9-ecc0-7eba-d6d7ce85ca12",
      "name": "Return Result",
      "type": "n8n-nodes-base.set",
      "position": [
        2320,
        1040
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "e49d5fa0-4ce3-38fd-aa12-2c73141a1e60",
              "name": "task_id",
              "type": "string",
              "value": "={{ $('Submit - Havis API').first().json.task_id }}"
            },
            {
              "id": "867e3fde-2078-1c85-7899-416dc320b834",
              "name": "status",
              "type": "string",
              "value": "={{ $json.status }}"
            },
            {
              "id": "1a5dacf8-b379-3cda-7399-a4566e9f535c",
              "name": "model",
              "type": "string",
              "value": "={{ $json.model }}"
            },
            {
              "id": "8bc9e081-b5e2-7994-d0a8-187dd97dad3f",
              "name": "result_urls",
              "type": "string",
              "value": "={{ JSON.stringify($json.result_urls || []) }}"
            },
            {
              "id": "41544d80-8192-bda5-fcec-d3560a98ea34",
              "name": "credits_used",
              "type": "string",
              "value": "={{ $('Submit - Havis API').first().json.creditsUsed || $('Submit - Havis API').first().json.credits_used || '' }}"
            },
            {
              "id": "b94211e8-a4fd-4ae9-35e5-0e7d08d0d9b8",
              "name": "submitted_payload",
              "type": "string",
              "value": "={{ JSON.stringify($('Build Payload').first().json.body) }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "d0d4a61c-2465-a80c-81e6-b211a0c2d1e8",
      "name": "Return Error",
      "type": "n8n-nodes-base.set",
      "position": [
        2320,
        1200
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "b3007a7f-5423-90d4-9886-b1c3fb6d29a2",
              "name": "task_id",
              "type": "string",
              "value": "={{ $('Submit - Havis API').first().json.task_id }}"
            },
            {
              "id": "ca1461b6-f63f-d464-9dcd-e1d179765809",
              "name": "status",
              "type": "string",
              "value": "={{ $json.status }}"
            },
            {
              "id": "87ea986c-aba2-e9d4-7cb2-d2cb511b176f",
              "name": "model",
              "type": "string",
              "value": "={{ $json.model }}"
            },
            {
              "id": "1003dbb5-3f4d-33bc-8f56-4918afcb9da6",
              "name": "error_message",
              "type": "string",
              "value": "={{ $json.error_message || $json.message || \"Generation failed\" }}"
            },
            {
              "id": "5525ede1-bf9d-658d-d253-01bd518c39d1",
              "name": "credits_used",
              "type": "string",
              "value": "={{ $('Submit - Havis API').first().json.creditsUsed || $('Submit - Havis API').first().json.credits_used || '' }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    }
  ],
  "connections": {
    "Wait 8s": {
      "main": [
        [
          {
            "node": "Check Task Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is Failed?": {
      "main": [
        [
          {
            "node": "Return Error",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait 8s (loop)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Payload": {
      "main": [
        [
          {
            "node": "Submit - Havis API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is Completed?": {
      "main": [
        [
          {
            "node": "Return Result",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Is Failed?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 8s (loop)": {
      "main": [
        [
          {
            "node": "Check Task Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Task Status": {
      "main": [
        [
          {
            "node": "Is Completed?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Submit - Havis API": {
      "main": [
        [
          {
            "node": "Wait 8s",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Form - Grok Imagine": {
      "main": [
        [
          {
            "node": "Build Payload",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This n8n workflow submits a video generation job to Havis AI Grok Imagine, waits for processing, polls task status, and returns result data when the job completes. Creators who want a reusable no-code generation form. Agencies building client-facing AI automation. Developers who…

Source: https://n8n.io/workflows/15587/ — original creator credit. Request a take-down →

More Web Scraping workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Web Scraping

This workflow allows you to import any workflow from a file or another n8n instance and map the credentials easily. A multi-form setup guides you through the entire process At the beginning you have t

Execute Command, Read Write File, HTTP Request +3
Web Scraping

[n8n] Advanced URL Parsing and Shortening Workflow - Switchy.io Integration. Uses splitInBatches, stickyNote, httpRequest, html. Event-driven trigger; 56 nodes.

HTTP Request, GitHub, Stop And Error +1
Web Scraping

[](https://youtu.be/c7yCZhmMjtI)

HTTP Request, GitHub, Stop And Error +1
Web Scraping

N8n recently introduced folders and it has been a big improvement on workflow management on top of the tags.

HTTP Request, n8n, Form Trigger +1
Web Scraping

This workflow automates the creation of press releases for music artists releasing a new single. Upload your MP3, fill in basic info, and receive a publication-ready press release saved as a Google Do

Form Trigger, HTTP Request, Google Docs