Opening Problem Statement
Meet Sarah, a content manager who runs a popular WordPress blog at mailsafi.com. Every week, Sarah wants to republish her blog posts on Medium to reach a broader audience and boost her readership. However, manually copying each post, extracting the right content, formatting it, and then publishing it on Medium wastes hours weekly. Plus, the repetitive manual work increases the risk of errors like missing images or broken links. Her time could be better spent creating new content, not duplicating efforts.
This is exactly the challenge that the presented n8n workflow addresses. It fully automates the process of detecting new blog posts on a WordPress site, extracting essential content like titles and introduction paragraphs, and automatically publishing polished posts to Medium without any manual intervention.
What This Automation Does
When you trigger this workflow, here’s what happens step-by-step:
- Fetch the WordPress blog homepage: A HTTP Request node loads the blog’s main page (e.g., https://mailsafi.com/blog/).
- Extract all blog post titles and URLs: The first HTML node parses the HTML to pull out the titles and read-more links of available posts.
- List and filter posts: Using item list nodes, it organizes and optionally limits the posts to a manageable batch for processing.
- Iterate through each post URL: A batch-splitting node loops over each post URL to handle them individually.
- Load each individual post page: Another HTTP Request node fetches the full HTML content for each post URL.
- Extract detailed content: The second HTML extraction gets the title, introduction paragraph, and the main header content in HTML format from each post.
- Publish to Medium: Using the Medium node, the extracted content is posted live with relevant tags and settings configured.
By automating these steps, Sarah saves hours each week and eliminates the tedious manual copy-paste errors. This workflow keeps her Medium audience updated instantly whenever new posts appear on the WordPress blog.
Prerequisites ⚙️
- n8n account (cloud or self-hosted) 🔌
- Medium account with API credentials 🔑
- Public WordPress blog URL (e.g., https://mailsafi.com/blog/) 📁
Step-by-Step Guide
Step 1: Add a Manual Trigger Node
Navigate to Triggers in n8n and select Manual Trigger. This node allows you to start the workflow manually for testing or scheduled automation. You should see a node named When clicking “Execute Workflow”. No inputs needed here.
Step 2: Configure HTTP Request to Fetch Blog Homepage
Add a HTTP Request node after the trigger. Set the URL to your WordPress blog homepage, e.g., https://mailsafi.com/blog/. Ensure the method is GET (default). Upon executing, you’ll get the full HTML content of the blog listing page.
Step 3: Extract Titles and Links with HTML Node
Attach an HTML node to the HTTP Request node. Configure it with the operation extractHtmlContent and add extraction values to:
- Extract all post titles using CSS selector
.entry-title > a, key it aspost. - Extract all post links using CSS selector
.lae-read-more > aand attributehref, key it asLink.
Run the node to verify that it lists arrays of post names and URLs.
Step 4: Use Item Lists to Split Titles and Links
Add an Item Lists node configured to split the fields post , Link. This prepares the array of blog posts for processing individually.
Step 5: Limit the Number of Posts Processed
Attach another Item Lists node to limit the items to a manageable number, such as maximum 5 posts. This avoids overwhelming the Medium API or your workflow with too many posts.
Step 6: Loop Over Each Post URL
Use a Split In Batches node named Loop Over Items to iterate over each blog post one by one. Connect this after the limited item list node.
Step 7: Fetch Individual Post Content
Add a second HTTP Request node configured dynamically. Set the request URL as {{ $json.Link }} from the current item in the loop. This fetches the detailed HTML of the individual blog post page.
Step 8: Extract Detailed Blog Content
Add another HTML node after fetching the post content. Configure it to extract:
- Title: The
h2.single-post-titlefor the main blog post title. - Introduction: The first paragraph inside
.kiwi-highlighter-content-area > p:nth-child(1). - Full Header Content: The HTML inside
div.kiwi-highlighter-content-areaas HTML.
Step 9: Publish Blog Post on Medium
Finally, add a Medium node. Set the title field to {{ $json.Title }} extracted previously, the content field to {{ $json.Header }}, and specify contentFormat as html. Add appropriate tags like “Email Hosting, Email, Email Marketing” and set publish status to “public”.
Run the workflow to test. Your posts from WordPress should now appear as Medium posts automatically.
Customizations ✏️
- Change Posting Frequency: Integrate a trigger like the Cron node to automate on schedule instead of manual execution.
- Filter Posts by Date: Add a Code node or conditional logic to process only recent posts based on extracted date fields.
- Modify Medium Tags: In the Medium node, customize the tags parameter to fit your blog’s niche or SEO strategy.
- Extract Additional Content: Use the HTML node’s CSS selectors to pull images, authorship, or metadata for richer Medium posts.
Troubleshooting 🔧
- Problem: HTML nodes fail to extract content.
Cause: Incorrect CSS selectors or changes in blog HTML structure.
Solution: Inspect the blog page source and update selectors in the HTML extraction nodes. - Problem: Medium node API authentication errors.
Cause: Invalid or expired Medium API key.
Solution: Reconfigure Medium node credentials and verify keys in Medium developer settings.
Pre-Production Checklist ✅
- Confirm the WordPress blog URL is accessible and publicly viewable.
- Verify all CSS selectors match current blog HTML structure.
- Test Medium API credentials by manually creating a post using the Medium node in n8n.
- Run workflow in manual mode with a small number of posts to check for correct content extraction and posting.
Deployment Guide
After testing, activate the workflow in n8n. If desired, add a Cron trigger node to schedule this workflow daily or weekly to keep Medium blog updated automatically. Monitor workflow runs for any failures and review logs in n8n to ensure continued smooth operation.
FAQs
- Can I use this workflow with other blogging platforms? Potentially, yes — by adjusting the HTTP requests and HTML extractor selectors to match the other blog’s structure.
- Does this workflow consume Medium API quota? Yes, each post creation counts against your Medium API usage limits.
- Is my data safe? This workflow processes data within n8n, so ensure your n8n instance is secure and uses encrypted credentials.
- Can this handle hundreds of posts at once? It can, but consider adding rate limits and batching to avoid API limits or timeouts.
Conclusion
By following this guide, you’ve automated a previously tedious process: republishing WordPress posts to Medium. Sarah’s time savings translate into hours freed each week and fewer manual copy-paste errors. With this workflow, you keep your Medium followers instantly updated with fresh content without lifting a finger.
Next, consider expanding this automation to include social media sharing, email newsletter creation, or SEO metadata enhancements for your blogs—each a logical step to boost your content’s reach with n8n automation.