> ## Documentation Index
> Fetch the complete documentation index at: https://docs.videobgremover.com/llms.txt
> Use this file to discover all available pages before exploring further.

# n8n Integration

> Automate video background removal with n8n workflows. Connect to 400+ apps, batch process videos, and build custom automation.

## Overview

[n8n](https://n8n.io) is a visual workflow automation platform that lets you connect apps and automate tasks without code. By integrating VideoBGRemover with n8n, you can:

* **Batch process videos** automatically from Google Drive, Airtable, or any connected app
* **Schedule video processing** with cron triggers for off-peak hours
* **Chain workflows** by connecting to 400+ apps (Slack notifications, database updates, etc.)
* **No coding required** - visual workflow builder with drag-and-drop nodes

We provide two pre-built workflow templates to get you started instantly.

***

## Template 1: Video Composition Workflow

### What It Does

Removes the background from a video, composites it onto a custom background, and uploads the final result to Google Drive.

Perfect for: AI-generated videos (Sora, HeyGen), product demos, talking head videos, social media content.

### Workflow Steps

```
1. Trigger (Webhook or Manual)
   ↓
2. Create Job (POST /v1/jobs with video URL)
   ↓
3. Start Composition (POST /v1/jobs/{id}/start with background)
   ↓
4. Poll Status (GET /v1/jobs/{id}/status every 20 seconds)
   ↓
5. Download Processed Video
   ↓
6. Upload to Google Drive
```

### API Key Required

* **VIDEOBGREMOVER\_KEY** - Get from [API Management](https://videobgremover.com/api-management)

### Processing Time

3-5 minutes per minute of video

### Get the Template

[**Import Workflow from GitHub →**](https://raw.githubusercontent.com/videobgremover/videobgremover-n8n-templates/main/templates/01-video-composition-gdrive.json)

***

## Template 2: AI UGC Ad Generator Workflow

### What It Does

Complete AI pipeline that analyzes an app screen recording, generates a UGC-style ad script with AI actors, and composites everything into a final video.

Perfect for: App developers, SaaS marketing teams, mobile app demos, feature announcements.

### Workflow Steps

```
1. Upload App Screen Recording
   ↓
2. Gemini AI Analysis
   - Analyzes app features
   - Generates ad script (hook, problem, solution, CTA)
   - Describes ideal AI actor
   ↓
3. Sora 2 AI Video Generation
   - Creates AI actor video
   - Natural UGC-style delivery
   - 4-12 second duration
   ↓
4. VideoBGRemover Composition
   - Removes actor background
   - Composites actor over app recording
   - Mixes audio (30% app + 100% actor)
   ↓
5. Upload to Google Drive
```

### API Keys Required

* **GEMINI\_KEY** - Get from [Google AI Studio](https://aistudio.google.com/apikey)
* **FAL\_KEY** - Get from [FAL AI Dashboard](https://fal.ai/dashboard/keys)
* **VIDEOBGREMOVER\_KEY** - Get from [API Management](https://videobgremover.com/api-management)

### Processing Time

5-8 minutes total (Gemini: \~30s, Sora 2: \~2-4 min, VideoBGRemover: \~2-3 min)

### Get the Template

[**Import Workflow from GitHub →**](https://raw.githubusercontent.com/videobgremover/videobgremover-n8n-templates/main/templates/02-ugc-screenrecord-video.json)

***

## Quick Start

### 1. Import Workflow to n8n

In your n8n instance:

* Go to **Workflows → Import from URL**
* Paste the GitHub template URL (see above)
* Click **Import**

### 2. Configure API Keys

Add your API keys to n8n environment variables:

```
Settings → Variables → Add new variable

For Template 1:
- Name: VIDEOBGREMOVER_KEY
- Value: vbr_your_key_here

For Template 2 (add all three):
- Name: GEMINI_KEY
- Value: your_gemini_key
- Name: FAL_KEY
- Value: your_fal_key
- Name: VIDEOBGREMOVER_KEY
- Value: vbr_your_key_here
```

### 3. Connect Google Drive

* Click on the "Upload to Google Drive" node
* Click **"Create New Credential"**
* Follow the OAuth authorization flow
* Select the folder where videos should be saved (optional)

### 4. Test the Workflow

**For Template 1:**

* Update the video URLs in the "Sample Video URLs" node
* Click **"Execute Workflow"**
* Wait 3-5 minutes for processing
* Check Google Drive for the final video

**For Template 2:**

* Update the `screenshot_video_url` in the "Sample Input" node
* Click **"Execute Workflow"**
* Wait 5-8 minutes for processing
* Check Google Drive for the UGC ad

***

## How the Workflows Work

Both templates follow the same polling pattern used by our API:

1. **Create a job** by uploading your video (`POST /v1/jobs`)
2. **Start processing** with composition parameters (`POST /v1/jobs/{id}/start`)
3. **Poll the status** every 20 seconds (`GET /v1/jobs/{id}/status`)
4. **Download the video** when status is `completed`
5. **Upload to storage** (Google Drive) and return the shareable link

The workflow handles:

* ✅ Automatic status polling and retries
* ✅ Error handling for failed jobs
* ✅ Both webhook and manual triggers
* ✅ Seamless Google Drive integration

***

## Automation Options

### Webhook Triggers

Activate the workflow and use the webhook URL to trigger processing from external applications:

```bash theme={"dark"}
curl -X POST https://your-n8n-instance.com/webhook/compose-video \
  -H "Content-Type: application/json" \
  -d '{
    "foreground_video_url": "https://example.com/video.mp4",
    "background_video_url": "https://example.com/background.mp4"
  }'
```

### Batch Processing

Connect the workflow to:

* **Google Sheets** - Process rows of video URLs
* **Airtable** - Process database records
* **Google Drive Watch** - Auto-process new uploads
* **Cron Schedule** - Process videos at specific times

### Notifications

Add nodes to send notifications when processing completes:

* **Slack** - Post message with video link
* **Discord** - Send webhook notification
* **Email** - Send download link
* **SMS** - Text notification via Twilio

***

## Resources

* [**GitHub Templates Repository**](https://github.com/videobgremover/videobgremover-n8n-templates) - Full workflow JSON files and setup instructions
* [**Blog Tutorial: Automate Video Backgrounds in n8n**](https://videobgremover.com/blog/automate-video-backgrounds-n8n) - Step-by-step guide with examples
* [**Composition Builder**](https://videobgremover.com/composition-builder) - Visual tool to design composition parameters
* [**API Reference**](/api-reference/introduction) - Complete API documentation
* [**Video Composition Guide**](/video-composition/overview) - Understanding composition parameters
* **Support** - Email us at [paul@videobgremover.com](mailto:paul@videobgremover.com)

***

## Next Steps

<CardGroup cols={2}>
  <Card title="API Reference" icon="book-open" href="/api-reference/introduction">
    Explore the full API documentation
  </Card>

  <Card title="Examples" icon="code" href="/examples">
    See code examples in Python, Node.js, and cURL
  </Card>

  <Card title="Video Composition" icon="film" href="/video-composition/overview">
    Learn about composition templates and positioning
  </Card>

  <Card title="Get API Key" icon="key" href="https://videobgremover.com/api-management">
    Sign up and get your API key
  </Card>
</CardGroup>
