Animated data flow diagram

AI Agent for WordPress Post Summarization & Content Enrichment

Version: 1.0.0 | Last Updated: 2025-05-16

Integrates with:

OpenAI WordPress Google Sheets Slack

Overview

Unlock Enhanced Readability & SEO with this AI Agent

Supercharge your WordPress content strategy with this n8n AI Agent. It intelligently fetches your latest (or all) WordPress posts, uses OpenAI (specifically models like GPT-4o-mini) to generate a well-formatted HTML summary block, and seamlessly inserts it at the top of your articles. This not only enhances readability for your audience but can also contribute to better SEO by providing quick, digestible content snippets. The agent is designed to be robust, preventing duplicate summaries by checking existing post content and a Google Sheets log. It also keeps your team in the loop with Slack notifications and maintains a record of all summarized posts.

Key Features & Benefits

  • AI-Powered Summarization: Leverages OpenAI's advanced language models to create high-quality, context-aware summaries for your WordPress posts.
  • Automated Content Updates: Directly inserts a customizable HTML summary block (e.g., "✨ AI Summary") into your WordPress posts, saving you manual effort.
  • Smart Duplicate Prevention: Intelligently checks if a summary already exists in the post content (using an AI text classifier) or if the post has been logged in Google Sheets, avoiding redundant work.
  • WordPress Integration: Fetches posts and updates them using the WordPress REST API, ensuring compatibility and preserving original post excerpts.
  • Google Sheets Logging: Keeps a comprehensive log of all summarized posts, including IDs, links, and summarization dates, for easy tracking and auditing.
  • Slack Notifications: Instantly notifies your team via a designated Slack channel whenever a new post is updated with an AI summary.
  • Flexible Triggers: Can be run manually for testing, on a schedule (e.g., every few minutes to catch new posts), or via a webhook for real-time processing upon post publication.
  • Customizable Prompts & Output: Easily tailor the OpenAI system prompt to match your content's theme, language, and desired summary style. The HTML output is also customizable to fit your WordPress theme.

Use Cases

  • Automatically adding 'AI Summary' or 'TL;DR' sections to WordPress blog posts.
  • Improving user engagement and reducing bounce rates by providing quick content overviews.
  • Enhancing on-page SEO with concise, keyword-rich summaries.
  • Streamlining content publishing workflows for individual bloggers, content teams, and agencies.
  • Maintaining an automated log of content enhancements for audit and review purposes.
  • Keeping stakeholders or team members informed about new content summaries via Slack.

Prerequisites

  • An n8n instance (Cloud or self-hosted).
  • OpenAI API Key with access to a suitable model (e.g., gpt-4o-mini or gpt-4 is recommended).
  • WordPress site with the REST API enabled. You'll need credentials for WordPress nodes (e.g., Application Password) and for the HTTP Request node updating posts (which also uses an Application Password or similar authentication if your site is secured).
  • Google Cloud Project with Google Sheets API enabled and Service Account credentials (JSON key file). You'll also need a Google Sheet set up; a template link is provided in the workflow's sticky notes (https://docs.google.com/spreadsheets/d/1uO0zaNc5UrLhtdcvETFcZGln_qij-nqpYP06n9GxJUk/).
  • Slack workspace and API credentials (OAuth2 recommended) for sending notifications to a specific channel.

Setup Instructions

  1. Download the n8n workflow JSON file.
  2. Import the workflow into your n8n instance.
  3. Configure Triggers: Choose and enable your preferred trigger:
    • Manual Test: Use 'When clicking ‘Test workflow’' with the 'WordPress - Get All Posts' node. It's pre-configured to fetch a limited number of posts (default 5) for initial testing. Adjust as needed.
    • Schedule: Enable 'Schedule Trigger'. Configure its interval. The 'Date & Time - Substract' and 'WordPress - Get Last Posts' nodes will fetch posts published since the last run. Ensure the 'WordPress - Get Last Posts' node is configured with your credentials.
    • Webhook: Enable 'Webhook'. Copy the webhook URL. Configure your WordPress site (e.g., via a PHP function or a reliable plugin) to send a POST request with post_id to this URL upon new post publication. Ensure the 'Set fields - From Webhook input' and 'WordPress - Get Post1' nodes are correctly set up.
  4. WordPress Credentials & URLs:
    • Configure all WordPress nodes ('WordPress - Get All Posts', 'WordPress - Get Last Posts', 'WordPress - Get Post1', 'WordPress - Get Post2') with your WordPress site URL and credentials.
    • In the 'Wordpress - Update Post' (HTTP Request) node, set your WordPress credentials and update the URL: https://<your-domain.com>/wp-json/wp/v2/posts/... replacing <your-domain.com>.
  5. OpenAI Configuration:
    • Configure the 'OpenAI Chat Model' node (used by the 'Text Classifier') with your OpenAI API Key.
    • Configure the main 'OpenAI' node (for summarization) with your OpenAI API Key and select your preferred model (default gpt-4o-mini).
    • In the 'OpenAI' node, customize the system message: adapt the website's theme (default is electric vehicles), update the 'Good'/'Bad' output examples, and adjust the HTML structure/styling if needed to match your site.
  6. Google Sheets Configuration:
    • Make a copy of the Google Sheets template (File → Make a copy).
    • Configure the 'Google Sheets - Get rows' and 'Google Sheets - Add Row' nodes with your Google Sheets API credentials (Service Account recommended), the Document ID of your copied sheet, and the Sheet Name (default 'AI-Summarized Posts').
  7. Slack Configuration: Configure the 'Slack - Notify Channel' node with your Slack API credentials and choose the channel for notifications.
  8. Update Domain in Set Node: In the 'Set fields - Prepare data for Gsheets & Slack' node, update the edit_link expression by replacing <your-domain.com> with your actual WordPress domain for the admin edit link.
  9. Review Sticky Notes: The workflow contains detailed Sticky Notes explaining each section. Read them carefully for deeper insights and troubleshooting.
  10. Test Thoroughly: Run tests with a few non-critical posts to ensure everything works as expected before activating for all posts or on a frequent schedule.
  11. Activate the workflow.

Tags:

AI AgentContent AutomationWordPressOpenAISEOBloggingGoogle SheetsSlackProductivitySolopreneur ToolStartup AutomationContent GenerationLLM

Want your own unique AI agent?

Talk to us - we know how to build custom AI agents for your specific needs.

Schedule a Consultation