All Projects
PROJECT / 04

AI Content Automation System

A published n8n workflow that writes its content prompt with Gemini, generates an AI video, and posts it to a Facebook page on a schedule.

Built in n8n

A process worth improving.

Keeping a social page supplied with video content means writing prompts, generating each video, waiting for it to finish, converting the file, and posting it—by hand, over and over.

A structured automation architecture.

A scheduled n8n workflow generates its prompt with Gemini, signs a JWT and exchanges it for a Google access token, sends the prompt to the video model, polls until the video completes, converts the result to a file, and publishes it through the Facebook Graph API—with filter and error checks so unusable output never reaches the page.

From trigger to reliable output.

Each stage has a defined responsibility, making the system easier to test, maintain, and improve.

01
Schedule trigger

The workflow runs on a schedule—no one has to start it.

n8n
02
Generate prompt

Gemini writes a structured video prompt with a parsed output.

Google Gemini
03
Auth payload

Build and sign the JWT used for Google authentication.

JWT
04
Access token

Exchange the signed JWT for a Google OAuth token.

Google OAuth
05
Generate video

Send the prompt to the video generation model.

AI video
06
Wait & check

Poll the job until the finished video is ready.

n8n
07
Filter & error checks

Route failures and reject unusable output.

Logic
08
Convert to file

Turn the base64 result into a real video file.

n8n
09
Post to Facebook

Publish the video through the Facebook Graph API.

Facebook API
n8n editor showing the AI content workflow with Gemini prompt generation, video generation, wait and check nodes, Convert to File, and Facebook Graph API
The live workflow in the n8n editor.

Built as a system, not a shortcut.

The workflow is designed around predictable inputs, clear decisions, reviewable AI output, and recoverable errors.

  1. 01Trigger — receives and validates the initial input
  2. 02Data processing — structures information for downstream steps
  3. 03AI step — generates or classifies within defined constraints
  4. 04Conditions — route each result to the correct path
  5. 05API calls — exchange data with connected applications
  6. 06Output — delivers or stores a usable result
  7. 07Error handling — records failures and supports recovery
n8nGoogle GeminiAI Video GenerationJWT AuthenticationFacebook Graph API

The workflow is designed to publish AI-generated video content to Facebook automatically on a repeating schedule, with no manual steps in between.

Long-running video jobs need patient polling and clear error branches—one bad result should stop at the filter, not reach the page.

Have a workflow like this?

Let’s Work Together