This commit is contained in:
nusquama
2025-11-12 16:55:22 +01:00
parent 8d01c578fa
commit 809de0c86d
@@ -0,0 +1,505 @@
Automated Blog Content Creator for WordPress with GPT Image 1 & Perplexity
https://n8nworkflows.xyz/workflows/automated-blog-content-creator-for-wordpress-with-gpt-image-1---perplexity-3974
# Automated Blog Content Creator for WordPress with GPT Image 1 & Perplexity
### 1. Workflow Overview
This n8n workflow automates the entire blog content creation and publishing process for WordPress, leveraging AI technologies and integrations to produce SEO-optimized, research-backed articles with context-specific featured images. It targets content creators, solopreneurs, and teams seeking a fully autonomous blogging system that minimizes manual effort and reduces costs while maximizing organic traffic.
The workflow is logically divided into these main functional blocks:
- **1.1 Trigger and Initialization**: Manual or scheduled start triggers the workflow and loads the brand brief from a sub-workflow.
- **1.2 Topic Ideation and Uniqueness Check**: Generates a unique blog topic idea, verifies it against Google Sheets history, and processes category rewriting.
- **1.3 Research Phase**: Uses Perplexity AI to research the approved topic and cleans the research data.
- **1.4 Content Generation**: Writes a full blog post with SEO-optimized headings and converts it to clean HTML.
- **1.5 Featured Image Creation and Upload**: Generates an image prompt, creates the image via GPT Image 1, uploads it to imgbb, downloads it, and uploads it to WordPress as the featured image.
- **1.6 Post-Publication Actions**: Publishes the post on WordPress, creates an excerpt, updates Google Sheets logs, and updates Notion with publication data.
---
### 2. Block-by-Block Analysis
---
#### 1.1 Trigger and Initialization
- **Overview:**
Starts the workflow manually or on a schedule and retrieves the brand brief to serve as the foundational context for subsequent AI processes.
- **Nodes Involved:**
- Schedule Trigger
- Manual Trigger ("When clicking Test workflow")
- Brand Brief Sub-Workflow ("get brand brief")
- Simple Memory
- **Node Details:**
- **Schedule Trigger**
- Type: Schedule Trigger
- Role: Automatically triggers the workflow on a preset schedule to run autonomously.
- Configuration: Default scheduling (user-configurable).
- Inputs: None (trigger node)
- Outputs: Triggers "Idea creator" node.
- Edge Cases: Scheduling misconfigurations or disabled schedules prevent execution.
- **Manual Trigger ("When clicking Test workflow")**
- Type: Manual Trigger
- Role: Allows manual execution for testing or immediate runs.
- Inputs: None (trigger node)
- Outputs: Triggers "Idea creator" node.
- Edge Cases: None; manual user action required.
- **get brand brief**
- Type: Sub-workflow tool node
- Role: Retrieves the stored brand brief which guides the tone, style, and branding of the blog content.
- Configuration: Calls a sub-workflow that holds brand-specific data.
- Inputs: Trigger from "Idea creator" node.
- Outputs: Brand brief data passed to "Idea creator".
- Edge Cases: Failure to fetch brand brief due to sub-workflow errors or missing data.
- **Simple Memory**
- Type: LangChain memory buffer window
- Role: Maintains conversational or contextual memory to keep idea generation coherent and consistent.
- Inputs: Connected to "Idea creator" for AI memory context.
- Outputs: Supplies memory context to "Idea creator".
- Edge Cases: Memory overflow or loss could impact AI output consistency.
---
#### 1.2 Topic Ideation and Uniqueness Check
- **Overview:**
Generates a unique blog topic idea based on the brand brief, rewrites the category, and checks Google Sheets history to avoid duplicate topics.
- **Nodes Involved:**
- Idea creator (LangChain agent)
- OpenAI 4.1 mini3 (LLM)
- Category rewrite (Code)
- Structured Output Parser
- Check History (Google Sheets tool)
- **Node Details:**
- **Idea creator**
- Type: LangChain Agent
- Role: Core AI agent that ideates blog topics using inputs from brand brief and memory.
- Configuration: Uses prompts, memory, and AI tools (OpenAI).
- Inputs: Brand brief (via sub-workflow), memory, category rewrite output, and history check results.
- Outputs: Proposed blog topic with structured output.
- Edge Cases: AI model failures, malformed outputs, or connectivity issues.
- **OpenAI 4.1 mini3**
- Type: LangChain OpenAI chat LLM
- Role: Language model used by the Idea creator for generating content ideas.
- Configuration: OpenAI API key configured in credentials.
- Inputs: Prompts from "Idea creator".
- Outputs: Text completions for idea generation.
- Edge Cases: API rate limits, authentication errors.
- **Category rewrite**
- Type: Code node
- Role: Rewrites or normalizes blog post categories for consistency and SEO.
- Configuration: Custom JavaScript code to process category text.
- Inputs: Idea creator output.
- Outputs: Cleaned category string.
- Edge Cases: Code runtime errors or unexpected input data.
- **Structured Output Parser**
- Type: LangChain structured output parser
- Role: Parses AI-generated structured data for consistency in downstream nodes.
- Inputs: AI output from Idea creator.
- Outputs: Parsed structured data.
- Edge Cases: Parsing failures or invalid data structure.
- **Check History**
- Type: Google Sheets Tool
- Role: Checks if the blog topic already exists in the Google Sheets log to prevent duplication.
- Inputs: Proposed topic from Idea creator.
- Outputs: Boolean or data indicating topic uniqueness.
- Edge Cases: Google Sheets API failures, permission issues, or inconsistent data.
---
#### 1.3 Research Phase
- **Overview:**
Performs detailed research on the approved blog topic using Perplexity AI, cleans research data for content writing.
- **Nodes Involved:**
- Perplexity Research (HTTP Request)
- Cleanup Links (Set)
- **Node Details:**
- **Perplexity Research**
- Type: HTTP Request
- Role: Queries Perplexity AI API to collect relevant research data on the topic.
- Configuration: HTTP POST with topic query and API key.
- Inputs: Category rewrite output (topic).
- Outputs: Raw research data.
- Edge Cases: API limits, network timeouts, malformed requests.
- **Cleanup Links**
- Type: Set node
- Role: Cleans and formats research data, especially hyperlinks, for safe inclusion in content.
- Configuration: Data transformation expressions to sanitize URLs and text.
- Inputs: Perplexity Research output.
- Outputs: Cleaned research content.
- Edge Cases: Unexpected data formats causing expression failure.
---
#### 1.4 Content Generation
- **Overview:**
Generates a full-length SEO-optimized blog post, converts it to HTML, and prepares an excerpt.
- **Nodes Involved:**
- Content writer (LangChain chain LLM)
- OpenAI 4.1 mini (LLM)
- Cleanup HTML (Set)
- Wordpress (WordPress node)
- Excerpt creator (LangChain chain LLM)
- OpenAI 4.1 mini2 (LLM)
- WordPress excerpt add (HTTP Request)
- Markdown (Markdown node)
- **Node Details:**
- **Content writer**
- Type: LangChain chain LLM
- Role: Writes the main blog article (2000-3000 words) using cleaned research and brand brief.
- Configuration: Custom prompt with SEO and tone instructions; uses OpenAI 4.1 mini model.
- Inputs: Cleaned research data.
- Outputs: Blog post text.
- Edge Cases: Model output truncation or API errors.
- **OpenAI 4.1 mini**
- Type: LangChain OpenAI chat LLM
- Role: Provides language model processing for content writer node.
- Inputs: Prompts from Content writer.
- Outputs: Text completions.
- Edge Cases: Same as other OpenAI nodes.
- **Cleanup HTML**
- Type: Set node
- Role: Cleans and formats generated blog content to valid HTML for WordPress.
- Configuration: Expression-based HTML sanitization and formatting.
- Inputs: Content writer output.
- Outputs: Clean HTML content.
- Edge Cases: HTML malformation or expression failures.
- **Wordpress**
- Type: WordPress node
- Role: Publishes the blog post on the target WordPress site.
- Configuration: Uses WordPress credentials and API to create post with content, category, and metadata.
- Inputs: Clean HTML content.
- Outputs: Post creation confirmation and post ID.
- Edge Cases: WordPress API errors, authentication failures.
- **Excerpt creator**
- Type: LangChain chain LLM
- Role: Generates a concise excerpt or summary for the published post.
- Inputs: Published post content or metadata.
- Outputs: Excerpt text.
- Edge Cases: API errors, output formatting issues.
- **OpenAI 4.1 mini2**
- Type: LangChain OpenAI chat LLM
- Role: Supports excerpt creation with language model completions.
- Inputs: Excerpt creator prompts.
- Outputs: Excerpt text.
- Edge Cases: Same as other OpenAI nodes.
- **WordPress excerpt add**
- Type: HTTP Request
- Role: Updates the WordPress post with the generated excerpt via REST API.
- Inputs: Excerpt text and post ID.
- Outputs: API response confirmation.
- Edge Cases: API permission errors or network issues.
- **Markdown**
- Type: Markdown node
- Role: Converts excerpts or other text to Markdown format for logging or display if needed.
- Inputs: Excerpt creator output.
- Outputs: Markdown-formatted text.
- Edge Cases: Markdown formatting issues.
---
#### 1.5 Featured Image Creation and Upload
- **Overview:**
Creates a context-specific featured image using AI, uploads it to imgbb, downloads it, then uploads and assigns it to the WordPress post.
- **Nodes Involved:**
- Write prompt to create image (LangChain chain LLM)
- OpenAI 4.1 mini4 (LLM)
- Create image open AI (HTTP Request)
- Upload to imgbb (HTTP Request)
- Download image (HTTP Request)
- Upload Image to Wordpress1 (HTTP Request)
- Set Image on Wordpress Post1 (HTTP Request)
- **Node Details:**
- **Write prompt to create image**
- Type: LangChain chain LLM
- Role: Generates an AI prompt for GPT Image 1 to create a visually relevant image aligned with the blog topic.
- Inputs: Blog post content and metadata.
- Outputs: Image prompt text.
- Edge Cases: API failures or poor prompt generation.
- **OpenAI 4.1 mini4**
- Type: LangChain OpenAI chat LLM
- Role: Supports image prompt generation with AI completions.
- Inputs: Prompt generation requests.
- Outputs: Prompt text.
- Edge Cases: API limits.
- **Create image open AI**
- Type: HTTP Request
- Role: Calls GPT Image 1 API to generate the image from the prompt.
- Inputs: Image prompt.
- Outputs: Image URL or binary data.
- Edge Cases: API timeouts or generation failures.
- **Upload to imgbb**
- Type: HTTP Request
- Role: Uploads the generated image to imgbb image hosting service for persistent storage and access.
- Inputs: Image data from GPT Image 1.
- Outputs: Hosted image URL.
- Edge Cases: Upload failures, imgbb API limits.
- **Download image**
- Type: HTTP Request
- Role: Downloads the hosted image from imgbb to prepare for WordPress upload.
- Inputs: Hosted image URL.
- Outputs: Binary image data.
- Edge Cases: Network errors or broken URLs.
- **Upload Image to Wordpress1**
- Type: HTTP Request
- Role: Uploads the image to WordPress media library via REST API.
- Inputs: Binary image data.
- Outputs: Media ID for the image on WordPress.
- Edge Cases: API permission errors, upload failures.
- **Set Image on Wordpress Post1**
- Type: HTTP Request
- Role: Assigns the uploaded image as the featured image of the published blog post.
- Inputs: WordPress post ID and media ID.
- Outputs: Update confirmation.
- Edge Cases: API errors or ID mismatches.
---
#### 1.6 Post-Publication Actions
- **Overview:**
Updates Google Sheets logs with the new blog topic and publication data, and updates Notion for content tracking and analytics.
- **Nodes Involved:**
- Update list of blog post (Google Sheets)
- Update base post (Google Sheets)
- Notion
- Aggregate
- Edit Fields
- When Executed by Another Workflow (Execute Workflow Trigger)
- **Node Details:**
- **Update list of blog post**
- Type: Google Sheets node
- Role: Adds the new blog topic to the topics list sheet for future uniqueness checks.
- Inputs: Published post data.
- Outputs: Confirmation or updated sheet data.
- Edge Cases: API permission issues or sheet locking.
- **Update base post**
- Type: Google Sheets node
- Role: Logs detailed publication history including dates and metadata.
- Inputs: Post data from WordPress.
- Outputs: Confirmation.
- Edge Cases: Same as above.
- **Notion**
- Type: Notion node
- Role: Adds or updates the blog post record in a Notion database for content management.
- Inputs: Aggregated post data.
- Outputs: Confirmation.
- Edge Cases: Notion API limits or authentication errors.
- **Aggregate**
- Type: Aggregate node
- Role: Aggregates data from Notion before updating or inserting.
- Inputs: Notion node data.
- Outputs: Aggregated results.
- Edge Cases: Data aggregation failures.
- **Edit Fields**
- Type: Set node
- Role: Adjusts or sets additional fields before final Notion update.
- Inputs: Aggregated data.
- Outputs: Edited data.
- Edge Cases: Expression errors.
- **When Executed by Another Workflow**
- Type: Execute Workflow Trigger
- Role: Allows this workflow to be triggered and fed data by external workflows.
- Inputs: External workflow trigger.
- Outputs: Starts Notion update process.
- Edge Cases: Trigger data format mismatches.
---
### 3. Summary Table
| Node Name | Node Type | Functional Role | Input Node(s) | Output Node(s) | Sticky Note |
|-------------------------|--------------------------------|----------------------------------------------|---------------------------------------|-------------------------------------|-----------------------------------------|
| Schedule Trigger | Schedule Trigger | Scheduled start trigger | None | Idea creator | |
| When clicking Test workflow | Manual Trigger | Manual start trigger | None | Idea creator | |
| get brand brief | Sub-workflow Tool | Retrieves brand brief | Idea creator | Idea creator | |
| Simple Memory | LangChain Memory Buffer | Provides AI memory context | Idea creator | Idea creator | |
| Idea creator | LangChain Agent | Generates blog topic idea | Schedule Trigger, Manual Trigger, Brand Brief, Memory, History Check | Category rewrite, Structured Output Parser | |
| OpenAI 4.1 mini3 | LangChain OpenAI Chat LLM | Supports idea generation | Idea creator | Idea creator | |
| Category rewrite | Code | Cleans and normalizes category text | Idea creator | Perplexity Research | |
| Structured Output Parser| LangChain Output Parser | Parses AI structured data | Idea creator | Idea creator | |
| Check History | Google Sheets Tool | Checks topic uniqueness | Idea creator | Idea creator | |
| Perplexity Research | HTTP Request | Researches topic via Perplexity AI | Category rewrite | Cleanup Links | |
| Cleanup Links | Set | Cleans research data | Perplexity Research | Content writer | |
| Content writer | LangChain Chain LLM | Writes full blog post | Cleanup Links | Cleanup HTML | |
| OpenAI 4.1 mini | LangChain OpenAI Chat LLM | Supports content writing | Content writer | Content writer | |
| Cleanup HTML | Set | Cleans and formats blog post HTML | Content writer | Wordpress | |
| Wordpress | WordPress Node | Publishes blog post | Cleanup HTML | Write prompt to create image | |
| Write prompt to create image | LangChain Chain LLM | Generates prompt for image creation | Wordpress | Create image open AI | |
| OpenAI 4.1 mini4 | LangChain OpenAI Chat LLM | Supports image prompt creation | Write prompt to create image | Write prompt to create image | |
| Create image open AI | HTTP Request | Calls GPT Image 1 to create image | Write prompt to create image | Upload to imgbb | |
| Upload to imgbb | HTTP Request | Uploads image to imgbb hosting | Create image open AI | Download image | |
| Download image | HTTP Request | Downloads image from imgbb | Upload to imgbb | Upload Image to Wordpress1 | |
| Upload Image to Wordpress1 | HTTP Request | Uploads image to WordPress media library | Download image | Set Image on Wordpress Post1 | |
| Set Image on Wordpress Post1 | HTTP Request | Assigns featured image to WordPress post | Upload Image to Wordpress1 | Excerpt creator | |
| Excerpt creator | LangChain Chain LLM | Creates excerpt for blog post | Set Image on Wordpress Post1 | WordPress excerpt add | |
| OpenAI 4.1 mini2 | LangChain OpenAI Chat LLM | Supports excerpt creation | Excerpt creator | Excerpt creator | |
| WordPress excerpt add | HTTP Request | Adds excerpt to WordPress post | Excerpt creator | Markdown | |
| Markdown | Markdown Node | Converts excerpt to Markdown | WordPress excerpt add | Update list of blog post | |
| Update list of blog post | Google Sheets | Adds new topic to topics list | Markdown | Update base post | |
| Update base post | Google Sheets | Updates publication history | Update list of blog post | None | |
| Notion | Notion Node | Updates Notion content tracking | When Executed by Another Workflow | Aggregate | |
| Aggregate | Aggregate Node | Aggregates data before Notion update | Notion | Edit Fields | |
| Edit Fields | Set | Prepares data fields for Notion update | Aggregate | Notion | |
| When Executed by Another Workflow | Execute Workflow Trigger | Allows triggering from another workflow | External trigger | Notion | |
---
### 4. Reproducing the Workflow from Scratch
1. **Create Trigger Nodes**
- Add a **Schedule Trigger** node to automate runs; configure your desired schedule.
- Add a **Manual Trigger** node for manual testing.
2. **Set Up Brand Brief Retrieval**
- Create or import a sub-workflow containing your brand brief data.
- Add a **Tool Workflow** node configured to run that sub-workflow (“get brand brief”).
3. **Add AI Memory Node**
- Add a **LangChain Memory Buffer Window** node (“Simple Memory”) to hold context for AI agent.
4. **Configure Idea Creator Agent**
- Add a **LangChain Agent** node (“Idea creator”).
- Connect triggers and brand brief inputs to this node.
- Attach the AI memory node as the memory input.
- Set up OpenAI credentials for the connected LLM nodes.
5. **Add OpenAI Model Nodes**
- Add **LangChain OpenAI Chat** nodes for different roles: idea generation, content writing, excerpt creation, and image prompt generation:
- OpenAI 4.1 mini3 (Idea generation)
- OpenAI 4.1 mini (Content writing)
- OpenAI 4.1 mini2 (Excerpt)
- OpenAI 4.1 mini4 (Image prompt)
6. **Add Category Rewrite Code Node**
- Create a **Code** node ("Category rewrite") with JavaScript to clean or normalize categories.
7. **Add Structured Output Parser**
- Include a **LangChain Output Parser Structured** node to parse AI-generated structured responses.
8. **Add Google Sheets History Check**
- Configure a **Google Sheets Tool** node (“Check History”) for verifying topic uniqueness.
- Connect outputs from the Idea creator to this node.
9. **Add Perplexity Research HTTP Request**
- Create an **HTTP Request** node ("Perplexity Research") calling the Perplexity AI API with the topic.
- Configure authentication and parameters as per API docs.
10. **Add Cleanup Links Set Node**
- Add a **Set** node to clean hyperlinks and research data formatting.
11. **Add Content Writer Chain LLM Node**
- Use a **LangChain Chain LLM** node (“Content writer”) to generate the full blog post using cleaned research data.
12. **Add Cleanup HTML Node**
- Add a **Set** node (“Cleanup HTML”) to sanitize and prepare the blog post for WordPress.
13. **Add WordPress Node**
- Insert a **WordPress** node configured with your WordPress credentials to create new posts.
14. **Add Image Prompt Generation Chain LLM**
- Add a **LangChain Chain LLM** node (“Write prompt to create image”) to generate image prompts.
15. **Add HTTP Request Nodes for Image Creation and Upload**
- Create HTTP Request nodes for:
- Calling GPT Image 1 API ("Create image open AI")
- Uploading image to imgbb ("Upload to imgbb")
- Downloading the imgbb image ("Download image")
- Uploading image to WordPress media library ("Upload Image to Wordpress1")
- Setting featured image on WordPress post ("Set Image on Wordpress Post1")
16. **Add Excerpt Creation and Posting Nodes**
- Use a **LangChain Chain LLM** for excerpt creation ("Excerpt creator") with OpenAI 4.1 mini2.
- Add an **HTTP Request** node ("WordPress excerpt add") to update the post excerpt.
- Add a **Markdown** node if needed for formatting.
17. **Add Google Sheets Update Nodes**
- Add two **Google Sheets** nodes to update:
- Topic list ("Update list of blog post")
- Publication history ("Update base post")
18. **Add Notion Integration Nodes**
- Add a **Notion** node to update content management database.
- Include **Aggregate** and **Set** nodes to prepare data for Notion.
- Use an **Execute Workflow Trigger** node to allow external workflows to trigger Notion updates.
19. **Connect All Nodes in Logical Order**
- Connect triggers → brand brief → idea creator → category rewrite → history check → research → cleanup → content writing → HTML cleanup → WordPress post → image prompt → image generation & upload → featured image set → excerpt creation → excerpt posting → Google Sheets & Notion updates.
20. **Configure Credentials**
- Setup all required credentials for OpenAI, WordPress (OAuth2 or application password), Perplexity API, imgbb, Google Sheets, and Notion.
21. **Test Workflow**
- Use manual trigger to test full flow, watch for errors, and adjust node configurations accordingly.
---
### 5. General Notes & Resources
| Note Content | Context or Link |
|-----------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------|
| This workflow uses GPT Image 1 for image generation, noted as the most reliable current image generator. | Branding and image quality assurance |
| Automated blog publishing reduces manual writing and publishing time drastically, ideal for busy creators and solopreneurs. | Workflow purpose |
| Includes a sub-workflow for storing and retrieving brand brief data to maintain consistent article tone and style. | Sub-workflow integration |
| The workflow updates two Google Sheets documents: one for topic history to prevent duplication and one for publication tracking. | Data integrity and logging |
| Supports both scheduled runs and manual testing via triggers. | Flexibility in workflow execution |
| Uses Perplexity AI API for research, ensuring articles are fact-based and SEO optimized. | Research quality |
| OpenAI API credentials are required with proper scopes and rate limits considered for stable operation. | Integration requirements |
| WordPress requires REST API access with credentials that allow content creation and media upload. | WordPress integration |
| imgbb is used as an image hosting service for reliable image storage and CDN delivery. | Image hosting |
| Notion integration supports content management and analytics, facilitating editorial workflows and performance tracking. | Content management |
| For detailed setup instructions and API key configuration, refer to the included quick-start PDF guide provided with the workflow package. | User onboarding |
---
This comprehensive reference document captures the entire structure, logic, and configuration details of the "Automated Blog Content Creator for WordPress with GPT Image 1 & Perplexity" workflow. It enables deep understanding, error anticipation, and full reproducibility for developers and automation agents alike.