Quick overview
This workflow collects a business and topic via an n8n form, uses OpenAI to generate a ready-to-publish social post plus an image prompt, creates a matching image with OpenAI, and returns an HTML preview with the text and embedded image.
How it works
- Receives a content request through an n8n Form with fields for business, topic, audience, tone, and language.
- Cleans and normalizes the submitted inputs to ensure required defaults are present.
- Uses OpenAI (GPT-5 Mini) to generate a social post and a detailed image prompt, returned as strict JSON.
- Validates and parses the JSON output to ensure the post text and image prompt are present.
- Uses OpenAI Images (gpt-image-1) to generate an image from the returned image prompt.
- Builds an HTML preview that displays the headline, post text, and the generated image inline.
- Shows the final preview in the form completion screen and keeps the content and image available in the execution data.
Setup
- Add an OpenAI API credential in n8n and connect it to both OpenAI steps (text generation and image generation).
- Open the test URL for the n8n Form trigger and use it as the entry point to submit content requests.
- If needed, customize the form fields and the OpenAI system instructions to match your brand rules and desired output format.