Generate and optimize AI blog posts for WordPress with Gemini and OpenAI

Go to Workflow
0 views
Built by rodo h orellana rodo h orellana
Created on September 16, 2026

Description

Quick overview
This workflow receives a webhook request with a draft article and AI configuration, then uses Google Gemini, OpenAI, and/or OpenRouter to generate WordPress-ready HTML content, SEO metadata, FAQs, and a cover image (base64) formatted for WPBakery, returning the assembled payload as JSON.

How it works
Receives a POST webhook request containing a title, article text, writing and image style instructions, optional existing data, and AI provider settings.
Normalizes the incoming payload, determines whether the request is for a new post or for regenerating a specific asset, and prepares defaults such as categories and image constraints.
For regeneration requests, generates only the requested asset (image, excerpt, FAQ, or SEO JSON) using a fallback chain across Google Gemini, OpenAI, and OpenRouter, then returns the result to the webhook response.
For new post requests, generates excerpt, FAQ items, a single category selection, and SEO fields in one JSON response using the same multi-provider fallback strategy.
Rewrites the full article into clean WordPress-ready HTML (for example using , , , and ) while preserving the original meaning and applying the requested writing style.
Creates a detailed image prompt from the article, then generates a cover image with Google Gemini (fallback to OpenAI), and returns the final JSON containing content, SEO metadata, and base64 image data.

Setup
Configure the Webhook trigger URL (POST /create-post) in your WordPress plugin or source system that sends the article payload.
Provide at least one AI provider credential in the incoming ai_config (Google Gemini API key, OpenAI API key, and/or OpenRouter API key) and enable the corresponding text/image flags.
Update the allowed category list sent in available_categories (or set a default in the workflow) to match the categories you use in WordPress.
Set your preferred Gemini/OpenAI/OpenRouter model names in ai_config (including image models if you want image generation) and adjust retry_count and retry_delay as needed.
Use the Manual Trigger test path to validate the payload structure and confirm that the webhook response returns the expected JSON fields (content_body, seo_data, faq_items, and image_base64).

Nodes Used (1)

Code
n8n-nodes-base.code