THE CHALLENGE
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.
AI CONTENT AUTOMATION
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 n8nTHE CHALLENGE
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.
THE SOLUTION
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.
WORKFLOW
Each stage has a defined responsibility, making the system easier to test, maintain, and improve.
The workflow runs on a schedule—no one has to start it.
Gemini writes a structured video prompt with a parsed output.
Build and sign the JWT used for Google authentication.
Exchange the signed JWT for a Google OAuth token.
Send the prompt to the video generation model.
Poll the job until the finished video is ready.
Route failures and reject unusable output.
Turn the base64 result into a real video file.
Publish the video through the Facebook Graph API.

AUTOMATION LOGIC
The workflow is designed around predictable inputs, clear decisions, reviewable AI output, and recoverable errors.
TOOLS
DESIGNED OUTCOME
The workflow is designed to publish AI-generated video content to Facebook automatically on a repeating schedule, with no manual steps in between.
WHAT I LEARNED
Long-running video jobs need patient polling and clear error branches—one bad result should stop at the filter, not reach the page.
NEXT STEP