🔗 G-Labs Webhook × n8n Integration
Automate AI image & video generation by connecting G-Labs Automation with n8n — the open-source workflow automation platform.
MAX plan required for Webhook API.
1. 🌟 Overview
G-Labs Webhook API provides a local REST API server running on your computer. You can send image/video generation requests from any tool — including n8n.
Why use n8n?
- Full automation: Schedule image/video creation by time or events
- Multi-platform integration: Pull prompts from Google Sheets, Telegram, email → generate → send results
- Drag-and-drop interface: No coding required
- Free & self-hosted: Runs on your own machine
text
n8n Workflow → [HTTP Request] → G-Labs Webhook API (127.0.0.1:8765)
↓
Added to G-Labs queue
↓
G-Labs generates image/video
↓
n8n Workflow ← [Polling / Check status] ← Returns result (file URLs)2. 🛠️ Prerequisites
| Component | Details |
|---|---|
| G-Labs Automation | Installed, MAX plan active |
| n8n | Installed |
| Google Account | At least 1 valid account in G-Labs |
Install n8n
Option 1 — n8n Desktop: Download from n8n.io/get-started
Option 2 — npm:
bash
npm install n8n -g
n8n startOption 3 — Docker:
bash
docker run -it --rm --name n8n -p 5678:5678 n8nio/n8nn8n and G-Labs must run on the same computer (the Webhook API only listens on
127.0.0.1).3. 🚀 Enable Webhook Server
- Open G-Labs Automation
- In the left sidebar, click Webhook (🔗)
- Copy your API Key
- Configure port (default: 8765)
- Click Start Server → status changes to 🟢 Server Online
4. 🖼️ Workflow 1: Generate AI Images
text
[Manual Trigger] → [HTTP: Generate] → [Wait 30s] → [HTTP: Check Status] → [IF completed?]
↓ Yes
[HTTP: Download]
↓ No
[Back to Wait]Step 4.3 — HTTP Request (Generate)
| Property | Value |
|---|---|
| Method | POST |
| URL | http://127.0.0.1:8765/api/image/generate |
| Header | X-API-Key: YOUR_API_KEY |
json
{
"prompt": "a beautiful sunset over the ocean, cinematic, 8k",
"model": "nano_banana_2",
"aspect_ratio": "16:9",
"upscale": ["2K"],
"reference_images": []
}5. 🎬 Workflow 2: Generate AI Videos
Similar to image workflow — change the endpoint and parameters:
json
{
"prompt": "a golden retriever running on the beach, slow motion",
"model": "veo_31_fast",
"mode": "text_to_video",
"aspect_ratio": "16:9",
"resolution": ["720p", "1080p"]
}Videos take 1–5 minutes. Set Wait = 60 seconds between status checks.
6. 📦 Workflow 3: Batch Generation
Read a list of prompts from Google Sheets / CSV → generate images in bulk.
json
{
"prompt": "={{ $json.prompt }}",
"model": "={{ $json.model || 'nano_banana_2' }}",
"aspect_ratio": "={{ $json.aspect_ratio || '16:9' }}"
}7. ⚠️ Error Handling & Tips
| Tip | Details |
|---|---|
| Health check first | Add GET /api/health node at the start |
| Timeout protection | Counter for poll attempts. If > 20 → stop and report |
| Save credentials | Settings → Credentials → create Header Auth to reuse API Key |
| Parallel requests | Send multiple requests (G-Labs manages its own queue) |
| Retry | Use Error Trigger + Retry on Fail |
8. 📖 API Quick Reference
| Endpoint | Method | Auth | Description |
|---|---|---|---|
/api/health | GET | ❌ | Check server status |
/api/image/generate | POST | ✅ | Submit image generation |
/api/video/generate | POST | ✅ | Submit video generation |
/api/grok/generate | POST | ✅ | Submit Grok image/video |
/api/status/{task_id} | GET | ✅ | Check task status |
/api/result/{task_id} | GET | ✅ | Get task result |
/api/files/{filename} | GET | ❌ | Download file |
/api/tasks | GET | ✅ | List all tasks |