How it works
What this workflow does
Turn an editorial brief and a small source pack into a WordPress draft that an editor can review. One authenticated webhook validates the request, asks OpenAI for a structured article, assembles escaped HTML with links to the supplied sources, reserves the request in an n8n Data Table, and saves the post as a WordPress draft.
The workflow imports inactive with dryRun: true. Run with sample data uses a fictional brief, source pack, and article, so the preview does not call OpenAI, WordPress, or the Data Table.
This is the drafting layer for the Content Publishing, Social Distribution & Newsletter Intelligence blueprint, with campaign distribution covered by the Campaign Launch Assurance & Weekly Performance blueprint.
Validate the editorial inputs
Validate editorial brief requires a lowercase request ID, topic, audience, writing brief, and two to five distinct public HTTPS sources. Each source needs a title and a relevant excerpt between 30 and 2,200 characters. The generated slug uses the request ID so a retry maps to the same draft slug.
The Data Table stores the request state by event_key. An existing request is skipped, a new request is reserved with draft_pending, the WordPress draft is created, and the row is updated to draft_ready with the post ID. The reservation prevents a serial replay from creating a second post.
The model writes, code assembles
OpenAI returns JSON with a title, excerpt, intro, and two to six sections. Each section has a heading, plain-text body, and a nonempty list of supplied source IDs. The model may not include URLs, HTML, invented numbers, or claims beyond the source excerpts. The workflow rejects the draft if the shape, lengths, or source IDs are invalid.
Assemble cited WordPress draft escapes all text, turns paragraphs into HTML, and appends a source link for every cited ID using the supplied title and URL. The WordPress payload always uses status: "draft"; the workflow never publishes directly.
Validation scope
The supplied report confirms the isolated n8n 2.47.4 import, inactive state, and sample path. It also covers structural checks, draft-only WordPress output, source URLs drawn from the brief, and invented source ID rejection. Live OpenAI, WordPress, and Data Table calls require a staging test with your accounts. Editors should verify each claim and add original examples or images before publishing.
How to use
Before you start
- A current n8n instance.
- An OpenAI API key and a model that supports JSON mode.
- A WordPress account that can create posts and an application password for it.
- An n8n Data Table for request state.
- A trusted editorial queue or internal form that can send the authenticated payload.
1. Import and run the sample
Download the complete package, extract the ZIP, and read the full setup guide. Import source-backed-wordpress-draft.n8n.json and keep it inactive.
Open Run with sample data and choose Test workflow. Assemble cited WordPress draft should return a sample article with escaped HTML and the two supplied source links.
2. Create the Data Table
Create an n8n Data Table with these text columns:
| event_key | status | detail | result_id |
|---|
Enter its ID in Setup. The workflow uses event_key for the request ID, status for draft_pending or draft_ready, detail for the slug, and result_id for the WordPress post ID.
3. Configure WordPress and OpenAI
Set wordpressHost, an optional wordpressPath such as /blog, the model, and your brandVoice in Setup.
Create a WordPress application password for an account that can create drafts. Configure HTTP Basic Auth on Create WordPress draft with that username and application password. Add a Header Auth credential on Write article with OpenAI using Authorization: Bearer <OpenAI API key>.
4. Secure the inbound webhook
Add a private Header Auth credential to Receive event. POST requestId, topic, audience, brief, and a sources array containing title, url, and excerpt. Use the supplied test payloads to check the shape.
Invalid source URLs, missing excerpts, and invented source IDs stop the workflow before a WordPress write. Use a fresh revision ID when you intentionally want a second draft.
5. Test and operate
With staging credentials selected, set dryRun to false and use a test topic. Confirm the post appears under Drafts and that each source link resolves to the correct reference.
If a request stops at draft_pending, look up the slug in WordPress and record the post ID if the draft exists. Clear the pending state only after checking. An editor should verify each claim against its cited source and add any original examples or images before publishing.
Related automations
Use the Article-to-Social Draft System to repurpose the published article, and the Company Positioning Brief System for audience and message research. The Industry News Digest System is a recurring source of story ideas, and the Search Content Decay Detection System identifies existing pages that need a refresh. Read the Content Publishing & Newsletter Intelligence blueprint for the full publishing process. When the content is a commercial document, use the Proposal Draft & Slack Approval System for a separately configured approval path.