AI-Powered Comment Generation for WordPress Articles - n8n Workflow

Automate WordPress blog engagement using this n8n workflow. It fetches articles, uses the OpenAI n8n node to generate relevant comments, and posts them back automatically.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Content managers and bloggers seeking automated engagement.

  • Marketing agencies managing multiple WordPress sites.

  • Users looking for advanced n8n templates utilizing AI and external APIs.

  • Developers testing the WordPress REST API functionalities within an n8n environment.

Overview

Maintaining active engagement on a blog is crucial for SEO and community building, but generating comments manually can be time-consuming. This powerful n8n workflow solves this problem by automating the entire process using generative AI.

This robust n8n automation template fetches recent articles from your WordPress site via the REST API. It then feeds the article content into an OpenAI n8n node (configured for GPT-5) with a highly specific prompt designed to elicit natural, conversational responses. Finally, it posts the comment back to the respective article using dynamic data (including randomly generated author details).

This is one of the most practical n8n templates available for streamlining content operations and leveraging AI for genuine engagement.

How it Works

The process begins with the "When clicking ‘Execute workflow’" manual n8n trigger, allowing the user to initiate the bulk comment generation on demand.


  1. Article Fetching: The first n8n node uses an HTTP Request to connect to the WordPress REST API (/wp/v2/posts) and retrieves a list of the 100 most recently published articles, fetching only essential fields like ID, title, and content.

  2. Prompt Construction: The "Build Article Comment Prompt" n8n node dynamically constructs a detailed prompt. It cleans the article content (stripping HTML) and instructs the AI to write a single, short, relevant, and conversational comment, maximizing the chances of receiving a high-quality output.

  3. AI Generation: The "Generate Article Comment (AI)" OpenAI n8n node receives the prompt. This n8n node is configured to use GPT-5 to generate the human-like comment based on the article summary.

  4. Data Extraction: A subsequent n8n node extracts the clean text of the generated comment from the AI response payload.

  5. Comment Posting: Finally, the "Post Comment to Article" HTTP Request n8n node performs a POST request back to the WordPress comments endpoint (/wp/v2/comments). This final step ensures the comment is published, using dynamic expressions to link the comment to the correct post ID, assign the AI-generated content, and provide randomized author details (name and email) for variety and realism.

Installation Guide

To deploy this n8n workflow, follow these steps:


  1. Import the n8n Workflow: Copy the provided JSON data and import it into your n8n instance via the 'New' menu -> 'Import from JSON'.

  2. Configure WordPress Credentials: This n8n workflow uses HTTP Basic Authentication for both fetching articles and posting comments. You must create and update the shared httpBasicAuth credentials with your WordPress application password and username.

  3. Set up OpenAI Credentials: Update the openAiApi credentials with your active OpenAI API key.

  4. Update URLs: Replace https://example.com in both HTTP Request n8n nodes with your actual WordPress site domain.

  5. Customize the Prompt (Optional): Review the prompt in the "Build Article Comment Prompt" n8n node to adjust the tone or required length of the AI-generated response.

  6. Execution: Once configured, click the "Execute Workflow" button to run the entire n8n workflow.

Node Details

This n8n template relies on several key n8n node configurations to function correctly:

When clicking ‘Execute workflow’ (Manual Trigger): This n8n trigger is used for development and manual runs, enabling quick execution of the n8n workflow.

Fetch Articles from WordPress (HTTP Request n8n node):
URL: Must be set to your site's REST API endpoint (e.g., /wp-json/wp/v2/posts).
Authentication: Uses HTTP Basic Auth to ensure the n8n node has permission to access published posts.
Fields: Configured to only retrieve necessary fields (id, title, excerpt, content, link, commentstatus) to optimize API response time.

Build Article Comment Prompt (Set n8n node):
Function: Cleans HTML from the article content/excerpt and dynamically inserts the title and summarized content into a highly specific AI instruction prompt. This ensures the AI generation is focused and relevant.

Generate Article Comment (AI) (OpenAI n8n node):
Model: Explicitly set to gpt-5 for high-quality, nuanced conversational output.
Input: Receives the meticulously built prompt from the previous n8n node.

Post Comment to Article (HTTP Request n8n node):
Method: POST to the WordPress comments API (/wp/v2/comments).
Authentication: Uses the same HTTP Basic Auth credentials.
Body Parameters: Dynamically constructs the comment payload, setting the post ID (retrieved from the initial fetch), the AI-generated content, and a random author
name and unique temporary author_email using custom JavaScript expressions within the n8n node.

Related n8n Workflows

Free

Nodes: 5 Nodes
Updated: December 26 2025
View all
Created by

Automation & SEO Specialist with years of experience building smart workflows, AI-powered content solutions, and marketing automations. Skilled in n8n, WordPress, and API integrations to help businesses save time and grow faster.

Featured*