Text to Video AI Automation in n8n with Magic Hour API

Runbo Li
Runbo Li
·
Co-founder & CEO of Magic Hour
· 7 min read
Magic Hour AI x N8n

Introduction


Connecting Magic Hour AI with n8n: A Comprehensive Guide

Welcome to this comprehensive guide on integrating Magic Hour AI with n8n! Whether you're a seasoned automation expert or just starting your journey with no-code tools and APIs, this guide is designed to help you seamlessly connect Magic Hour AI's powerful video generation capabilities with your n8n workflows.

What to Expect

This guide will walk you through the entire process, from setting up your Magic Hour AI account and obtaining your API key to building and testing various API requests within n8n and We attached a video at the end for your understanding, to guide you

How to Best Use This Guide

This document is structured to allow you to quickly find the information most

relevant to your needs.


  • For a complete overview: Start from the beginning and follow the steps sequentially to understand the foundational setup and connection process.
  • Troubleshooting: Throughout the guide, you'll find important tips and common error messages to help you troubleshoot any issues you might encounter.


By the end of this guide, you'll be able to leverage the power of Magic Hour AI directly within your n8n workflows, automating creative tasks and bringing your ideas to life!

Some tips when connecting Magic Hour and n8n

  • Try to keep your Magic Hour API_KEY in n8n variables to use it more easily.
1.png2-1.png
  • Before you dive into using any Magic Hour API to create videos or images, you'll want to check out their documentation (docs.magichour.ai). It'll tell you all the fields you need to fill in. For example, if you're using the Image Background Remover API, you'll first need to figure out what parameters it requires.


Just to give you an idea, the image_file_path field would be a must-have. If you don't provide that, you'll end up with a server error.


{

message:”Missing Request Body”

}

3-1.png

Create an Account on Magic Hour ai and obtain api key


  1. Create an account

    Go to Magic Hour AI and sign up
4-1.png

Magic Hour AI

Create Your Automation Now

Sign Up now
  1. Get your API Key
  • After logging in, go to the Developer Hub
unnamed-1.png
  • Go to  API KEYS and click on Create API Key (you can name it anything).
5-2.png
  • Copy the key and save it somewhere safe (it won’t be shown again).

3. Always open documentation where you copy curL request from , so you can see the proper fields and usage of api.

6-2.png

Text to Video

  • POST Request
  • Go to the docs .
  • Copy the curL request.
7-1.png
  • Go to n8n , add a HTTP Request and import the curL you copied from doc.
8.png
Prepare your workflow in n8n
  • Open n8n and start a new workflow.
  • Choose a trigger (something that starts the workflow, e.g., manual or scheduled trigger), I am choosing manual.
9.png
Add the API request
  • In the workflow, add a new node from Core → HTTP Request (or cURL request).    
10.png11.png
  • Paste the cURL code you copied earlier into the import curl box.
  • Replace <token> with your Magic Hour API key (add it as: Bearer YOUR_API_KEY).
12.png

Add Wait Node after POST request

  • Go to node panel -> core -> Wait ( 300 seconds )
  • Tip : If you are using materials from internet check their extensions ( jpeg,mp4,mp3 ) only these gets allowed.
  • Add 300 seconds wait after it from node panel.
13.png
  • Add another node and add GET the video
  • Go to Get video details .
  • Copy the curL request.
unnamed (1)-1.png
  • Now , go to n8n node panel and add GET request from HTTP Request ( after wait ) 
unnamed (2).png
  • Add your magic hour api key into Bearer <token>
14.png
  • Click on Execute/Trigger to test if its returning url or not .
  • After get has runned , make a new GET Request node and paste this in url ( {{ $json.downloads[0].url }} ).
unnamed (3).pngunnamed (4).png
  • And now you can see ur generated Video.

Basic Workflow

unnamed (6).png

Video For Refernce














Runbo Li
About Runbo Li
Co-founder & CEO of Magic Hour
Runbo Li is the Co-founder & CEO of Magic Hour. He is a Y Combinator W24 alum and was previously a Data Scientist at Meta where he worked on 0-1 consumer social products in New Product Experimentation. He is the creator behind @magichourai and loves building creation tools and making art.