ChatGPTCreativeWritingAI score · PendingAI-assisted edit · no obvious prompt-injection riskn8n.io

Auto-Generate AI Social Captions from WordPress Blogs to Four Platforms

WordPress publish → n8n webhook trigger → AI generates platform-specific captions → parallel publish to X, Facebook, Instagram, LinkedIn

ExperiencedStepsWorkflowPromptTip
Who
Content creators, digital marketing agencies, SEO teams, and businesses publishing blog content regularly
You get
Every WordPress blog post automatically gets four platform-optimized social captions and publishes simultaneously without manual rewriting
You need
n8n

Constraints

Prerequisites: WordPress admin access; WP Webhooks or similar plugin; n8n instance (self-hosted or cloud) with a publicly accessible webhook URL; OpenRouter API key; Twitter/X OAuth2 app credentials; Facebook Page Access Token or System User Token; Instagram Business Account connected to your Facebook Page; LinkedIn Company Page OAuth2 credentials. Costs: OpenRouter pay-per-call; social media API calls subject to platform rate limits.

What they did

Author salmanmehboob published an official template on n8n.io. The template triggers via WordPress webhook on blog publish, automatically converts HTML content to Markdown, uses an AI Agent (OpenRouter GPT-4o) to generate four platform-specific social captions according to strict guidelines, enforces JSON output via Structured Output Parser, and publishes in parallel to Twitter/X, Facebook, Instagram, and LinkedIn.

How it went

The author claims the workflow achieves 'zero manual effort' simultaneous publishing, with AI-generated captions matching each platform's length, tone, and format requirements (author_report). Instagram uses Meta's official two-step publishing flow, Facebook posts as photo posts with captions for better reach, and LinkedIn downloads image binary data to meet API requirements.

Worth knowing

1. The facebook_page_id and instagram_id in workflow.json are hardcoded placeholder values and must be replaced. 2. The LinkedIn node's organization field contains placeholder 'your_org_URN'. 3. The AI reads only the first 800 characters by default; adjust slice(0, 800) in the user prompt to change context length. 4. The source mentions switching to Mistral to reduce cost, but workflow.json defaults to openai/gpt-4o. 5. Each social media API has independent rate limits and content policies; automated publishing must comply with platform terms. 6. This site has not tested this workflow; actual execution may encounter credential expiration, image download failures, or API changes.

n8n workflow template

Structure checked · Not run-tested

Use “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

  • OpenRouter Chat Model node: connect openRouterApi credentials.
  • Create Tweet node: connect twitterOAuth2Api credentials.
  • Create a post node: connect linkedInOAuth2Api credentials.
  • Post on FB node: connect httpQueryAuth credentials.
  • Create Media Container node: connect httpQueryAuth credentials.
  • Post On IG node: connect httpQueryAuth credentials.

Configuration to replace

  • Source template is n8n public workflow #14923 (~19 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

  1. Configure WordPress Webhook Trigger

    Install the WP Webhooks plugin (free, wordpress.org/plugins/wp-webhooks) on your WordPress site. Go to Settings → WP Webhooks → Send Data, add a new webhook, select trigger Post Published or Post Updated, and paste your n8n Webhook node URL as the delivery URL. Save and test by publishing a blog post; verify the n8n Webhook node receives a POST request containing post_title, post_content, post_type, post_status, post_permalink, and post_thumbnail.

  2. Set Up Conditional Filtering and Data Normalization

    Configure the If node with two conditions: post_type equals 'post' AND post_status equals 'publish', ensuring only published blog posts proceed. Then configure the Clean Data (Set) node to map fields from the Webhook: post_title, post_content (from HTML To Markdown output), post_link, post_thumbnail. Replace the hardcoded facebook_page_id and instagram_id with your real IDs (the workflow.json currently contains placeholder values 788563884350153 and 17841478701285041).

  3. Convert HTML to Markdown

    Add the HTML To Markdown node, with input from the Webhook's post.post_content. This removes HTML tags, shortcodes, and formatting markup, providing clean text to the AI and avoiding quality degradation from raw HTML.

  4. Configure AI Agent Prompt and Model

    The AI Agent node uses the OpenRouter Chat Model (default openai/gpt-4o; switchable to Claude, Gemini, Mistral, etc.). Configure as follows:

    Execution prompt · Source text。AI Agent node User Message / Text field

    =Post Title: {{ $json.post_title }}
    Post Link: {{ $json.post_link }}
    Post Content: {{ $json.post_content.slice(0, 800) }}
    
    Generate platform-specific social media captions for this blog post now.

    Execution prompt · Source text。AI Agent node System Message / Options field

    # Role
    You are a professional social media content writer.
    You write platform-specific captions when a new blog 
    post is published on a WordPress website.
    
    # Your Job
    Read the post title, link, and content.
    Then write one caption for each platform below.
    Each caption must match that platform's style, 
    tone, length, and best practices.
    
    # Platform Guidelines
    
    TWITTER:
    - Max 220 characters including the link
    - One punchy insight or hook from the post
    - 1 to 2 relevant hashtags only
    - End with the post link
    - Tone: short, direct, conversational
    
    FACEBOOK:
    - Max 300 characters for the hook line
    - Start with a bold question or statement
    - 2 to 3 bullet points of what readers will learn
    - End with the post link
    - Tone: friendly, conversational
    - No more than 3 hashtags
    
    INSTAGRAM:
    - Start with a bold hook in the first 125 characters
    - 3 to 5 key takeaways as short bullet points
    - End with: Link in bio to read the full guide
    - Add 3 to 5 relevant hashtags at the bottom
    - Tone: engaging, direct, value-driven
    - Do NOT include the link in the caption body
    
    LINKEDIN:
    - Professional tone
    - Start with a bold insight or surprising statement
    - Write 3 to 4 short paragraphs:
      Paragraph 1: the hook or problem
      Paragraph 2: what the post covers
      Paragraph 3: key takeaway or insight
      Paragraph 4: call to action with the link
    - 2 to 3 professional hashtags at the end
    - Between 800 and 1200 characters total
    
    # Output Format
    Return ONLY a valid JSON object.
    No explanation. No markdown. No extra text.
    Just the raw JSON like this:
    
    {
      "twitter": "your twitter caption here",
      "facebook": "your facebook caption here",
      "instagram": "your instagram caption here",
      "linkedin": "your linkedin caption here"
    }
  5. Configure Structured Output Parser

    Connect the Structured Output Parser to the AI Agent. Set the JSON Schema example to {"twitter": "string", "facebook": "string", "instagram": "string", "linkedin": "string"} to enforce valid JSON output, ensuring downstream publishing nodes can reliably extract each platform's caption.

  6. Configure Social Media Publishing Nodes

    Configure four parallel publishing branches: **Twitter/X**: Create Tweet node, text set to {{ $json.output.twitter }}, connected to twitterOAuth2Api credentials. **Facebook**: HTTP Request node, POST to https://graph.facebook.com/v25.0/{{ $('Clean Data').item.json.facebook_page_id }}/photos, query parameters message={{ $json.output.facebook }} and url={{ $('Clean Data').item.json.post_thumbnail }}, using httpQueryAuth credentials (Facebook Page Access Token). **Instagram**: Two-step official Meta flow. Step one: Create Media Container, POST to /{{ instagram_id }}/media, parameters caption={{ $json.output.instagram }} and image_url={{ post_thumbnail }}. Step two: Post On IG, POST to /{{ instagram_id }}/media_publish, parameter creation_id={{ $json.id }} (from step one response). Both use the same httpQueryAuth credentials. **LinkedIn**: First add an HTTP Request node to download the post_thumbnail image as binary (LinkedIn requires binary image data, not a URL). Then the Create a post node, text set to {{ $json.output.linkedin }}, postAs=organization, organization replaced with your real URN (currently placeholder 'your_org_URN'), shareMediaCategory=IMAGE, connected to linkedInOAuth2Api credentials.

  7. Test and Verify Publishing

    Publish a test blog post on WordPress and check the n8n execution log to confirm: If node passes, HTML To Markdown succeeds, AI Agent returns valid JSON, and all four platforms receive content. If any platform fails, verify the corresponding credentials permissions, API rate limits, and that the image URL is publicly accessible.

Prompt you can copy

Setup guidance · Editorial suggestion。Give to setup assistant; confirm inputs and permissions before guiding step-by-step configuration

This block is the prompt. Ads are never placed here.

You are an n8n workflow setup assistant. The user wants to replicate a template that auto-syncs WordPress blogs to four social media platforms. First confirm the user has: WordPress admin access, WP Webhooks plugin, a publicly accessible n8n instance, an OpenRouter API key, and API credentials for all four social platforms. Then guide them to import or manually rebuild the workflow, with special attention to replacing the facebook_page_id, instagram_id, and LinkedIn organization URN in the Clean Data node with real values. Finally, remind them to test with a draft or private post first.

Replace all placeholder IDs and URNs before running; use a draft or private post for first test

Source

Create and post AI social captions from WordPress blogs to Facebook, Instagram, X, and LinkedIn with GPT-4o via OpenRouter · salmanmehboob · n8n.io · 2026-04-08

Comments & feedback

Tried this method? Share results, problems or improvements. Comments appear after moderation. Please avoid sensitive information.

Loading…

    Related