AI-Generated Summary Block for WordPress Posts - with OpenAI, WordPress, Google Sheets & Slack n8n Workflow Template

n8n workflow template · 20 nodes · OpenAI

AI-Generated Summary Block for WordPress Posts - with OpenAI, WordPress, Google Sheets & Slack is a free n8n workflow template that starts when its webhook receives an HTTP request and works with OpenAI, Google Sheets, Slack and WordPress. It has 20 nodes, 3 of them AI nodes (Text Classifier, OpenAI Chat Model and OpenAI). The notes inside the workflow say: “This node is used for the initial/test run. In production, you should use the WordPress node that follows the Scheduled Trigger or Webhook Trigger instead.” To run it, you add your own credentials for Google Service Account, HTTP Header Auth, OpenAI API, Slack OAuth2 and WordPress API.

At a glance

Trigger
Webhook (Webhook)
Nodes
20
Apps
OpenAI, Google Sheets, Slack and WordPress
AI nodes
3
Credentials
5 types
Category
Content, SEO and social media

Apps and integrations

  • OpenAI
  • Google Sheets
  • Slack
  • WordPress

Node types used

  • Manual Trigger
  • Text Classifier
  • OpenAI Chat Model
  • Loop Over Items
  • If
  • Webhook
  • Schedule Trigger
  • HTTP Request
  • Google Sheets
  • Markdown
  • OpenAI
  • Slack
  • Edit Fields (Set)
  • Date & Time
  • WordPress

How it works

The text below comes from the sticky notes inside the workflow. We removed links, code samples and anything that looks like a key or token.

WordPress - Get All Posts

This node is used for the initial/test run. In production, you should use the WordPress node that follows the Scheduled Trigger or Webhook Trigger instead.

It retrieves all existing WordPress posts to generate an AI Summary.

Considerations

  • In this template, the query is limited to 5 posts to prevent accidental large-scale execution. This makes it easier to fix any issues.
  • You can add filters (category, tag, date, etc.) to target only the posts for which you want an AI Summary.
  • You can enable the "Get All Posts" option in the node if you want summaries for all posts—but make sure this is intentional.
  • The more posts you process, the higher the cost in OpenAI API usage.

Loop Over Items

Since multiple posts may be retrieved from the previous step, a "Loop Over Items" node is used to process each post individually, optimizing the execution of subsequent nodes.

In Production - Using the "Schedule Trigger"

You can continue using the "Loop Over Items" approach in production. Depending on your publication frequency and the schedule interval you've chosen, multiple posts could be retrieved in a single execution. This ensures each post is processed sequentially.

In Production - Using the "Webhook Trigger"

With a Webhook Trigger, the workflow typically runs for one post at a time, meaning the "Loop Over Items" node is not strictly necessary.

  • You can remove it for a slightly more efficient workflow.
  • However, keeping it won’t cause any issues—it will simply loop over one item instead of multiple.

Google Sheets - Get Rows & IF Nodes

This step is used to check whether a post already has an AI Summary.

For the Google Sheets node, you can make a copy of this Google Sheets template by going to File → Make a copy.

How It Works

  1. On the first execution, posts retrieved from WordPress and processed for AI summarization are added to a Google Sheet.
  2. On subsequent executions, when the workflow retrieves new posts, it checks if the post_id is already recorded in Google Sheets.

IF Node Logic

  • If a row exists for the post_id → The post already has an AI Summary. The workflow skips processing and moves to the "Loop Over Items" node.
  • If no row exists for the post_id → The post does not have an AI Summary, so the workflow continues along the execution path that leads to AI Summary generation.

WordPress - Get Post & HTML to Markdown Nodes

This step retrieves the WordPress post data using the post_id and converts the HTML content to Markdown. This ensures that the text is formatted in a clean and structured way before being sent to the Text Classifier node (which works with AI). More details about this step are provided in the next sticky note.

WordPress - Get Post

  • The context=edit option is enabled to retrieve the raw post data.
  • This is necessary because the post content will be updated later in the workflow.

HTML to Markdown

  • Converts the retrieved HTML content into Markdown format.
  • This makes the text easier to process for the LLM (Large Language Model) in the next step.
  • Markdown ensures that the AI better understands the structure and formatting of the content.

Text Classifier

This step classifies posts into categories

  • not_summarized → If the post does not have a summary, the following nodes execute the AI summary generation.
  • summarized → If the post already has a summary, the workflow skips processing
  • The workflow moves to "Loop Over Items".
  • The "Done" branch goes to the "Do Nothing" node.

The LLM model used is gpt-4o-mini—it's efficient and cost-effective, but you can choose another model if needed.

Why Use a Text Classifier?

The previous node already filters posts based on Google Sheets, but adding this classification step makes the workflow even more robust

  • Extra validation: If a post already has an AI Summary but, for some reason, is not listed in Google Sheets, this step prevents duplicate summaries.
  • Avoids redundancy: If a post already contains a manual or pre-existing summary at the top (not necessarily AI-generated), this step prevents adding an AI Summary that would be redundant.

WordPress - Update Post

This API call updates the WordPress post and its excerpt.

https:// /wp-json/wp/v2/posts/

What It Does

  • Adds the AI Summary at the top of the post.
  • Updates the post excerpt using data retrieved from the WordPress - Get Post2 node
  • If a manual excerpt exists, it is preserved.
  • If the excerpt was simply the beginning of the article, it remains unchanged.
  • This prevents the AI Summary from replacing the excerpt, ensuring a better user experience on your blog’s article listing page.

Setup notes

The text below comes from the sticky notes inside the workflow. We removed links, code samples and anything that looks like a key or token.

AI-Generated Summary Block for WordPress Posts

What is this workflow?

This n8n template automates the process of adding an AI-generated summary at the top of your WordPress posts. It retrieves, processes, and updates your posts dynamically, ensuring efficiency and flexibility without relying on a heavy WordPress plugin.

Example of AI Summary Section

How It Works

  1. Triggers → Runs on a scheduled interval or via a webhook when a new post is published.
  2. Retrieves posts → Fetches content from WordPress and converts HTML to Markdown for AI processing.
  3. AI Summary Generation → Uses OpenAI to create a concise summary.
  4. Post Update → Inserts the summary at the top of the post while keeping the original excerpt intact.
  5. Data Logging & Notifications → Saves processed posts to Google Sheets and notifies a Slack channel.

Why use this workflow?

No need for a WordPress plugin → Keeps your site lightweight. Highly flexible → Easily connect with Google Sheets, Slack, or other services. Customizable → Adapt AI prompts, formatting, and integrations to your needs. Smart filtering → Ensures posts are not reprocessed unnecessarily.

Check the detailed sticky notes for setup instructions and customization options!

Trigger - Two Options

To use this workflow, you have two trigger options.

The default trigger is "When clicking 'Test workflow'", allowing you to manually test the scenario.

If you want to use this workflow in production, you can choose one of the following triggers. You'll need to select the one you prefer and enable it.

Schedule Trigger

This trigger checks at regular intervals (e.g., every 5 minutes) if a new post has been published on your WordPress blog and triggers the workflow accordingly.

Easy to set up Automates AI summaries without manual intervention

If you run the workflow manually once, the AI-generated summaries will be added to Google Sheets and processed in later steps to prevent duplication.

Recommended follow-up nodes: If you choose this trigger, the following nodes are suggested in the template

  • Date & Time - Subtract: Subtracts the scheduled interval from the current execution timestamp. For example, if the workflow runs every 5 minutes, it subtracts 5 minutes from the execution time.
  • WordPress - Get Posts: Uses the output of the Date & Time - Subtract node as a filter to retrieve only posts published after the last execution.

Webhook Trigger

If you're familiar with webhooks, you can set up a webhook that triggers when a new post is published.

Faster than scheduled triggers More event-driven

You can implement this using either

  • A Webhook plugin on WordPress (not recommended due to plugin dependency).
  • A PHP function that triggers the webhook with authentication for security.

Be cautious with how the webhook is triggered—you may not want it to fire on every post edit.

Recommended follow-up nodes for this option

  • Set Fields - From Webhook Input: Configures the fields based on the data sent to the webhook.
  • WordPress - Get Post: Retrieves the post using the post_id received from the webhook, ensuring higher accuracy than the schedule trigger approach.

OpenAI - Message a Model

This step sends the Markdown-formatted post to GPT-4o-mini, using a System Prompt to instruct the LLM to generate an AI Summary. You can review and modify the System Prompt directly within this node.

Customization Required

To ensure optimal results, you should

  • Specify your website's theme in the system prompt. The default example uses electric mobility, but you can replace it with a more relevant theme (e.g., "sustainable mobility", "urban transport," etc.).
  • Modify the "Good" and "Bad" output examples—since the template is pre-configured for electric mobility, make sure to adapt the examples to match your content.

Output Format

The model is instructed to return the summary in HTML format, which will be used to update the WordPress post.

Customization Tip: You may want to adjust the HTML styling to better match your WordPress theme. Consider modifying the following elements

  • Background color, text color, and font weight
  • Section title (e.g., rename "AI Summary")
  • Padding, margins, and border styling
  • Removing or customizing the separator

Default Generated HTML

[Key point 1] [Key point 2] [Key point 3] [Key point 4]

Set Fields - Prepare Data for Google Sheets & Slack

This node sets fields that will be used in Google Sheets and Slack. You can add or modify fields as needed to fit your specific use case.

Default Fields in This Template

The following fields are pre-configured

  • post_id → The WordPress post ID
  • title → The rendered title of the post
  • post_link → The direct URL to the post
  • edit_link → A direct link to edit the post in WordPress (https:// /wp-admin/post.php?post=&action=edit)
  • summary → The AI-generated summary from the OpenAI node
  • summary_date → The date and time when the AI Summary was generated and added to the post.
  • You can add additional fields if you want to include more data (e.g., post category, author name, publication date).
  • This step ensures that the necessary information is properly structured before sending it to Google Sheets and Slack.

Google Sheets - Add Row & Slack - Notify

This step logs the post with an AI Summary into Google Sheets and sends a notification to Slack.

For the Google Sheets node, you can make a copy of this Google Sheets template by going to File → Make a copy.

Google Sheets - Add Row

This node automatically maps the columns in Google Sheets, meaning you don't need to manually define each field.

Configuration Details

  • Google Sheets Document → AI Summary WordPress
  • Sheet Name → AI Summarized Posts
  • Mapping Mode → Auto-map columns based on field names
  • Automatically added fields (examples, based on your setup)
  • post_id
  • post_link
  • edit_link
  • summary_date

Since columns are mapped automatically, ensure the column names in Google Sheets match the field names in n8n.

Slack - Notify

This node sends a message to Slack when a post has been updated with an AI Summary.

Configuration Details

  • Channel → wp-posts-ai (you can choose another channel)
  • Message Format → Simple Text Message
  • Notification Text -> Configured inside the node (check the "Message Text" field)
  • On the first execution, consider deactivating this node if you have many posts to avoid excessive notifications.
  • Consider creating a dedicated Slack channel for this workflow to keep AI summary updates separate from other discussions.

Nodes in this workflow

The 20 nodes in file order (sticky notes excluded). Branches and connections determine execution order in n8n:

  1. When clicking ‘Test workflow’ (Manual Trigger)
  2. Text Classifier (Text Classifier)
  3. OpenAI Chat Model (OpenAI Chat Model)
  4. Loop Over Items (Loop Over Items)
  5. If (If)
  6. Webhook (Webhook)
  7. Schedule Trigger (Schedule Trigger)
  8. Wordpress - Update Post (HTTP Request)
  9. Google Sheets - Get rows (Google Sheets)
  10. HTML to Markdown (Markdown)
  11. OpenAI (OpenAI)
  12. Google Sheets - Add Row (Google Sheets)
  13. Slack - Notify Channel (Slack)
  14. Set fields - From Webhook input (Edit Fields (Set))
  15. Date & Time - Substract (Date & Time)
  16. Set fields - Prepare data for Gsheets & Slack (Edit Fields (Set))
  17. WordPress - Get Post2 (WordPress)
  18. WordPress - Get Last Posts (WordPress)
  19. WordPress - Get Post1 (WordPress)
  20. WordPress - Get All Posts (WordPress)

Credentials you need

  • Google Service Account – used by Google Sheets - Add Row and Google Sheets - Get rows
  • HTTP Header Auth – used by Webhook
  • OpenAI API – used by OpenAI and OpenAI Chat Model
  • Slack OAuth2 – used by Slack - Notify Channel
  • WordPress API – used by WordPress - Get All Posts, WordPress - Get Last Posts, WordPress - Get Post1 and WordPress - Get Post2 and others

Configure your own credentials after importing. Create each credential in n8n, then select it in the node.

How to import into n8n

  1. Download the JSON file with the button above.
  2. In n8n, open a new workflow, select the ... menu and choose Import from File. You can also paste the JSON straight into the editor canvas.
  3. Open each node that shows a warning and select or create its credential.
  4. Read the notes on the canvas, test the workflow with sample data, then activate it.

Do you need somewhere to run it? Read our guide to self-hosted n8n.

Need this customised?

We can adapt this workflow to your apps, data and process, then deploy and support it.

Contact Us