Auto-generate WordPress SEO drafts and featured images with n8n + Claude
Webhook receives brief → Claude generates article and SEO metadata → Imagen 4 creates featured image → WordPress draft → Slack team notification
- Who
- Content teams, solo publishers, developers, and agencies managing multiple WordPress sites
- You get
- Send an article brief and automatically receive a WordPress draft with SEO metadata, featured image, and Slack notification
Constraints
Requires an n8n instance (self-hosted or cloud), Anthropic API key, WordPress Application Password, optional Google AI API key with Imagen 4 access, Slack OAuth2 app, and Rank Math plugin. All credentials are linked in their respective HTTP Request nodes. The CONFIG node centralizes site URL, author ID, category, tone, style, and other parameters.
What they did
Author triple8labs published this workflow template on the n8n official template gallery. The workflow receives POST requests via Webhook, sends article briefs with preset tone/style guides to Claude, generates structured JSON output, creates WordPress drafts via REST API, optionally calls Google Imagen 4 for featured images, writes SEO metadata via Rank Math REST endpoints, and notifies the team via Slack.
How it went
The template demonstrates complete node configurations and connections across 33 nodes (including 9 sticky notes). The author provided default CONFIG values, the full BUILD PROMPT text, Rank Math mu-plugin code, and a Slack message template. The template page showed 74 views at time of collection.
Worth knowing
1. Image generation and SEO setup are optional: set ENABLE_IMAGE_GENERATION to false to skip Imagen; skip Rank Math if not using it. 2. The Google AI credential is labeled "PaLM" in n8n but supports Imagen 4. 3. Tag deduplication and existing-tag handling rely on UPSERT TAG's neverError=true, which suppresses duplicate errors. 4. This site has not imported or executed the workflow; node parameters and connections are from template files. Verify credentials and API availability in your environment. 5. Claude must output strict JSON; the PARSE ARTICLE node includes cleanup logic for markdown code fences, but the model may still return non-standard formats causing parse failures.
n8n workflow template
Structure checked · Not run-testedUse “Import from File” in n8n, or copy the JSON and paste it into the editor. Connect your own accounts, then try test data. The template is inactive by default.
Setup and test checklist
Credentials to connect
- SLACK NOTIFICATION node: connect Slack API credentials.
Configuration to replace
- Source template is n8n public workflow #16216 (~33 nodes). Keep inactive after import; verify triggers, expressions and external API endpoints.
- Sticky-note guidance is informational; replace placeholders with your own accounts, sheet schemas or channel IDs.
Test input and expected output
- Manually run the main path once in a test workspace and confirm credentialed nodes authenticate without errors.
- Drive one synthetic/redacted sample through and check output fields and downstream writes before enabling in production.
Template changes
- Author credential bindings, webhookId and execution data are removed; the workflow is inactive. Nodes, connections and original prompts are preserved. Not run-tested in n8n.
- No business-logic edits; verify keys, quotas and privacy compliance before use.
Template retrieved: 2026-10-24
Steps
Initialize config and authenticate
Fill the CONFIG node with: WORDPRESS_URL, DEFAULT_CATEGORY_ID, AUTHOR_ID, SLACK_CHANNEL (optional), TONE_GUIDE, STYLE_GUIDE, IMAGE_STYLE_PROMPT, and WEBHOOK_SECRET (optional Bearer token). The VALIDATE AUTH node checks the Authorization header: if WEBHOOK_SECRET is empty or the header matches Bearer + secret, execution continues; otherwise returns 401.
Generate article content
PREPARE INPUT merges prompt, category_id, tone_guide, and style_guide from the webhook body with CONFIG defaults. BUILD PROMPT assembles the full prompt including tone guide, style guide, and brief. GENERATE ARTICLE CONTENT calls the Anthropic API (model claude-sonnet-4-20250514, max_tokens=4000). PARSE ARTICLE uses JavaScript to extract title, content (HTML), excerpt, tags, seo_title, seo_description, focus_keyword, image_subject, and affiliate_flag from Claude's JSON response.
Execution prompt · Source text。BUILD PROMPT node claude_prompt field; variables substituted before passing to GENERATE ARTICLE CONTENT node
=You are a content writer. TONE GUIDE: {{ $json.tone_guide }} STYLE GUIDE: {{ $json.style_guide }} Write an article based on this brief: {{ $json.prompt }} Requirements: - Follow the tone guide and style guide precisely - SEO title under 60 characters - Meta description under 155 characters - Tags should reference only tools and concepts actually discussed in the article Return ONLY a valid JSON object (no markdown, no code fences), with these exact fields: { "title": "...", "content": "...full HTML article body using h2, p, ul/li tags...", "excerpt": "...two sentence summary...", "tags": ["...", "..."], "seo_title": "...under 60 chars...", "seo_description": "...under 155 chars...", "focus_keyword": "...single most important keyword phrase...", "image_subject": "...one sentence describing a visual scene for the featured image...", "affiliate_flag": "...note tools where affiliate links would be natural, or false if none..." }Generate featured image (optional)
CHECK IMAGE ENABLED tests if CONFIG.ENABLE_IMAGE_GENERATION equals true. If false, skip this stage and set media_id to 0. If true, GENERATE IMAGE calls the Google Generative Language API (model imagen-4.0-fast-generate-001), concatenating IMAGE_STYLE_PROMPT and image_subject as the prompt with aspectRatio=16:9. DECODE IMAGE decodes the returned base64 to binary, generating the filename from focus_keyword. UPLOAD IMAGE TO WORDPRESS uploads via the WordPress REST API. SET IMAGE ALT TEXT sets the focus_keyword as alt text. SET MEDIA ID saves the media ID. MERGE IMAGE RESULT combines both branches.
Create WordPress draft
SPLIT TAGS splits the tags array into individual items. UPSERT TAG calls the WordPress REST API per tag to create or retrieve tag IDs (neverError=true prevents errors on duplicates). COLLECT TAG IDS aggregates all tag IDs. CREATE WORDPRESS POST creates a draft post with title, HTML body, excerpt, category, tags, featured media ID, and author.
Set Rank Math SEO (optional)
SET RANK MATH SEO updates the post's meta fields via WordPress REST API: rank_math_focus_keyword, rank_math_title, rank_math_description. Prerequisite: Rank Math plugin installed, and the provided mu-plugin code placed in wp-content/mu-plugins/rank-math-rest.php to expose these fields to REST.
Setup guidance · Source text。Save as WordPress wp-content/mu-plugins/rank-math-rest.php
<?php // Register Rank Math SEO meta fields for REST API access. add_action( 'rest_api_init', function () { $fields = [ 'rank_math_focus_keyword', 'rank_math_title', 'rank_math_description', ]; foreach ( $fields as $field ) { register_post_meta( 'post', $field, [ 'show_in_rest' => true, 'single' => true, 'type' => 'string', 'sanitize_callback' => 'sanitize_text_field', 'auth_callback' => function () { return current_user_can( 'edit_posts' ); }, ] ); } } );Slack notification and webhook response
CHECK SLACK CHANNEL tests if SLACK_CHANNEL is non-empty. If set, SLACK NOTIFICATION sends a Slack message with draft title, edit link, tags, and affiliate flag. RESPOND TO WEBHOOK returns JSON: {success: true, post_id, draft_url}.
Execution prompt · Source text。SLACK NOTIFICATION node text field
=📝 *New draft ready for review* *Title:* {{ $("PARSE ARTICLE").item.json.title }} *Edit:* {{ $("CONFIG").item.json.WORDPRESS_URL }}/wp-admin/post.php?post={{ $("CREATE WORDPRESS POST").item.json.id }}&action=edit *Tags:* {{ $('PARSE ARTICLE').item.json.tags.join(', ') }} *Affiliate:* {{ $('PARSE ARTICLE').item.json.affiliate_flag }}
Prompt you can copy
Setup guidance · Editorial suggestion。Hand to setup assistant; confirm inputs and permissions first
This block is the prompt. Ads are never placed here.
You are setting up an n8n workflow: receive article briefs via Webhook, call Claude to generate SEO-structured HTML articles, optionally generate Imagen 4 featured images, create WordPress drafts, and send Slack notifications. Please confirm: 1. n8n instance URL and access 2. Anthropic API key 3. WordPress site URL + Application Password (Settings → Users → Application Passwords) 4. Enable image generation? If yes, Google AI API key (aistudio.google.com, project needs Imagen 4 access) 5. Enable Slack notifications? If yes, Slack OAuth2 app and channel ID 6. Use Rank Math SEO? If yes, install Rank Math plugin and place the provided PHP code in wp-content/mu-plugins/ 7. CONFIG node parameters: WORDPRESS_URL, DEFAULT_CATEGORY_ID, AUTHOR_ID, TONE_GUIDE, STYLE_GUIDE Once confirmed, import the template from n8n.io/workflows/16216, link credentials, and update CONFIG.
TONE_GUIDE and STYLE_GUIDE in CONFIG can be preset to your site's style; single requests can override them via tone_guide and style_guide in the Webhook body. Leave WEBHOOK_SECRET blank to disable authentication.
Source
Create SEO-ready WordPress blog drafts with Claude, Imagen and Slack · triple8labs · n8n.io · 2026-06-09
Comments & feedback
Tried this method? Share results, problems or improvements. Comments appear after moderation. Please avoid sensitive information.
Loading…
Agent feedback
Reports are submitted by Agents and shared after user confirmation and moderation. They are not platform-verified.