# Create a source-backed WordPress blog draft

Turn an editorial brief and a small source pack into a WordPress draft. Each section links to the sources supplied for review.

**Category** Marketing · Content Creation  
**Tools** n8n, OpenAI, WordPress, n8n Data Tables  
**Trigger** Authenticated POST from an editorial queue or internal form  
**Package** [Workflow JSON](source-backed-wordpress-draft.n8n.json) · [Test payloads](test-payloads.json) · [Validation report](validation-report.txt)

Import the JSON in n8n and run **Run with sample data**. The workflow imports inactive with **dryRun** enabled. The sample run uses fictional data and skips connected apps. Select credentials on the named nodes before testing live inputs.

## How it works

1. Validate the topic, intended audience, brief, and two to five source excerpts with URLs.
2. Ask OpenAI for a structured article. Assemble the HTML with escaped text and links drawn from the source pack.
3. Save a **draft** in WordPress, and record its post ID in the Data Table.

## How to use

1. Create an n8n Data Table with text columns **event_key**, **status**, **detail**, and **result_id**. Enter its ID in **Setup** along with the WordPress hostname, an optional installation path such as **/blog**, the OpenAI model, and your brand voice.
2. Create a WordPress application password for an account that can create drafts. Use **HTTP Basic Auth** on **Create WordPress draft** with that username and application password. Connect OpenAI using a bearer **Header Auth** credential.
3. Secure **Receive event** with a private **Header Auth** credential. POST **requestId**, **topic**, **audience**, **brief**, and **sources** containing **title**, **url**, and **excerpt**. Use the editorial brief fixture to check the shape. The webhook acknowledges receipt.
4. With staging credentials selected, disable dry run and use a test topic. Confirm the post appears under **Drafts** and each source link resolves to the right reference.

## Test and operate

- Invalid source URLs, missing excerpts, and invented source IDs stop the workflow before a WordPress write.
- The same request ID is reserved once for serial delivery. Use a fresh revision ID to intentionally create another draft.
- If a request stops at **draft_pending**, look up the slug in WordPress and record the ID if the draft exists. Clear the pending record only after checking.
- An editor should verify each claim against its cited source and add any original examples or images before publishing.

The source pack is an editorial input. The workflow uses the supplied excerpts for writing and preserves their source links.

[n8n Marketing source](https://n8n.io/workflows/12477-generate-research-backed-blog-articles-from-news-with-openai-tavily-and-google-docs/) · [WordPress posts API](https://developer.wordpress.org/rest-api/reference/posts/) · [WordPress application passwords](https://developer.wordpress.org/advanced-administration/security/application-passwords/)
