How to Publish Blog Posts to Medium, Dev.to, and Ghost with n8n: A Step-by-Step Automation Guide

admin1234 Avatar

How to Publish Blog Posts to Medium, Dev.to, and Ghost with n8n: A Step-by-Step Automation Guide

🚀 Publishing quality content efficiently is a top priority for marketing departments aiming to boost brand awareness and engagement. Automating your blog publishing workflow can save countless hours and minimize human error. In this article, you’ll learn how to publish blog posts to Medium, Dev.to, and Ghost with n8n, a powerful workflow automation tool.

We will explore the entire automation setup from trigger events in Gmail or Google Sheets to posting across multiple blogging platforms and notifying your Slack teams. Whether you are a startup CTO, automation engineer, or operations specialist, this step-by-step guide will help you build scalable, robust workflows that integrate Gmail, Google Sheets, Slack, and HubSpot seamlessly.

By the end of this article, you will have practical knowledge on designing and deploying automated blog publishing pipelines, including best practices for error handling, security, and performance optimization.

Understanding the Problem Automation Solves and Who Benefits

Manually publishing blog posts across multiple platforms is tedious and prone to inconsistencies. Marketing teams often face:

  • Repetitive copy-pasting of content across Medium, Dev.to, and Ghost
  • Lack of content synchronization leading to outdated or incomplete posts
  • Delayed publication due to manual review and process bottlenecks
  • Absence of automatic notification for stakeholders upon publish

Automation workflows with n8n solve these problems by automating blog post creation, formatting, publishing, and notification — all from a single unified interface. Marketing teams, CTOs, operations, and automation engineers benefit through improved efficiency, reduced errors, and faster time-to-market for content.

The Tools and Services We Will Integrate

This workflow leverages several popular services to capture, transform, and distribute blog posts:

  • n8n: Open-source automation platform to build workflows
  • Gmail: To receive blog post drafts or notifications
  • Google Sheets: To store and manage blog post metadata and content
  • Slack: To notify teams about published posts
  • HubSpot: To manage contacts and trigger posts based on marketing activities
  • Medium API: To publish articles to Medium
  • Dev.to API: To post content on Dev.to
  • Ghost Admin API: To publish posts on your Ghost blog

Overview: How the Blog Post Publishing Workflow Works (Trigger to Output)

The automation follows this sequence:

  1. Trigger: New blog post added in Google Sheets or email received in Gmail
  2. Data Extraction: Parse and format the post content and metadata
  3. Publishing: Send the formatted blog post via APIs to Medium, Dev.to, and Ghost
  4. Notification: Post a confirmation message to Slack channels
  5. Logging and Error Handling: Errors logged to HubSpot or a DB for auditing

Step-by-Step Breakdown of the Automation Workflow

1. Trigger Node: Detecting New Blog Posts 📨

We start with either a Google Sheets Trigger or Gmail Trigger node in n8n:

  • Google Sheets Trigger: Watches for new rows added in the sheet representing new blog posts.
  • Gmail Trigger: Monitors a dedicated label or inbox folder for incoming blog post drafts.

Exact fields for Google Sheets Trigger:
Sheet ID: Your blog posts spreadsheet ID
Watch: New rows only
Fields: Title, Content, Tags, Excerpt, Author

For Gmail Trigger:
Label: “Blog Drafts”
Filters: Subject includes “New Post”

2. Data Transformation: Parsing and Formatting Content

After triggering, a Function Node transforms raw input into platform-specific formats:

  • Strip unwanted HTML tags and sanitize markdown
  • Generate excerpt if missing using substring
  • Map tags and categories to each platform’s requirements
  • Format publication dates in ISO format

Example JavaScript snippet for generating excerpt:

items[0].json.excerpt = items[0].json.content.substring(0, 160) + '...';return items;

3. Publishing Nodes: Medium, Dev.to, and Ghost

Each platform requires a dedicated HTTP Request Node configured with authentication and payload:

  • Medium Publishing:

Configure HTTP Request Node:

  • Method: POST
  • URL: https://api.medium.com/v1/users/{{ $json.userId }}/posts
  • Authentication: Bearer Token (use credentials stored securely)
  • Headers: Content-Type: application/json, Authorization: Bearer <token>
  • Body (JSON):
{
  "title": "{{$json.title}}",
  "contentFormat": "html",
  "content": "{{$json.content}}",
  "tags": {{$json.tags}},
  "publishStatus": "public"
}
  • Dev.to Publishing:

Dev.to API requires an article post with markdown content:

  • URL: https://dev.to/api/articles
  • Method: POST
  • Headers: api-key from your Dev.to account settings
  • Body JSON:
{
  "article": {
    "title": "{{$json.title}}",
    "published": true,
    "body_markdown": "{{$json.contentMarkdown}}",
    "tags": {{$json.tags}}
  }
}
  • Ghost Publishing:

Use Ghost Admin API (v3+) with API key and slug:

  • URL: https://yourghostdomain.com/ghost/api/v3/admin/posts/
  • Method: POST
  • Headers: Authorization: Ghost API Admin Key, Content-Type: application/json
  • Body JSON:
{
  "posts": [{
    "title": "{{$json.title}}",
    "html": "{{$json.content}}",
    "status": "published",
    "tags": {{$json.tags}}
  }]
}

4. Notification Node: Alerting Your Marketing Team in Slack 🔔

Once all platforms confirm successful publishing, notify your Slack channel using Slack Node:

  • Channel: #marketing-updates
  • Message: “New blog post titled ‘{{ $json.title }}’ has been published on Medium, Dev.to, and Ghost.”

5. Logging and Error Handling

Configure If Nodes to check for errors at each publishing step. On error:

  • Retry with exponential backoff up to 3 times
  • Log error details into a dedicated Google Sheet or HubSpot CRM
  • Send alert to #devops Slack channel

Use n8n’s built-in Execution Status and Error Trigger nodes for robustness.

Performance, Scaling, and Robustness Tips

Webhooks vs Polling: What’s Best? ⚡

Webhooks are preferable for real-time triggers (e.g., webhook from HubSpot when a blog post is ready). However, if unavailable, polling Google Sheets or Gmail every 5 minutes is acceptable for low-to-moderate volume.

Benefits of Webhooks:

  • Lower latency
  • Reduced API calls and costs
  • Scalable during traffic spikes

Polling adds delay and increased API consumption, potentially hitting rate limits.

Idempotency and Duplicate Handling

Implement idempotency by storing unique post IDs (e.g., generated UUID or email Message-ID) in a database (Google Sheets or n8n internal storage) before publishing. Check this ID before attempting to publish to avoid duplicates.

Concurrency and Queues

Use n8n’s SplitInBatches node to process multiple blog posts sequentially or in small parallel batches to control API rate limits.

Security and Compliance Considerations 🔐

Ensure API keys and tokens are stored securely in n8n credentials with least privilege:

  • Use OAuth scopes limiting to read/write required endpoints
  • Restrict access to credentials to authorized team members
  • Mask sensitive PII in logs and notifications
  • Use HTTPS for all API calls
  • Regularly rotate tokens and keys

Comparing Popular Automation Platforms

Platform Cost Pros Cons
n8n Free self-hosted; Cloud starts at $20/m Highly customizable; Open-source; Supports complex workflows and custom code Setup complexity; Requires hosting or paid cloud
Make (Integromat) Free tier, paid plans from $9/month Intuitive visual builder; Large app ecosystem; Good scheduling Limited complex logic compared to n8n
Zapier Free limited tier; paid from $19.99/m Easy to use; Many app integrations; Reliable Pricing scales quickly; Less flexible for complex workflows

Webhook vs Polling for Blog Post Automation

Method Latency API Calls Use Case
Webhook Near real-time Minimal Event-based triggers (HubSpot, custom)
Polling 5-15 mins delay Higher (depending on frequency) No webhook support; Google Sheets, Gmail checks

Google Sheets vs Database for Blog Metadata Storage

Storage Setup Complexity Scalability Use Cases
Google Sheets Low Limited (up to 5K rows performance drop) Small teams; simple metadata storage
SQL/NoSQL DB Medium to High High, supports concurrency High volume; complex queries; integrations

Testing and Monitoring Your Workflow

Before deploying:

  • Use sandbox Gmail/Google Sheets accounts with test data
  • Run workflows manually in n8n to verify each step’s output
  • Check API responses and debug errors in execution logs
  • Set up alerts in Slack or email for workflow failures using Error Trigger Nodes
  • Regularly review run history and optimize based on data

Common Errors and How to Handle Them

Some frequent issues include:

  • API rate limits: Implement queues and retries with exponential backoff
  • Authentication failures: Ensure tokens have correct scopes and are not expired
  • Data format errors: Validate and sanitize inputs before API calls
  • Duplicate posts: Use idempotency keys and check existing post IDs
  • Network issues: Use n8n retry node and error handling for transient failures

Summary and Next Steps

With n8n, marketing teams can automate blog post publishing to Medium, Dev.to, and Ghost easily. This guide covered everything from triggers through publishing and notifications, with strong emphasis on error handling, security, and scaling.

Next, start by setting up your Google Sheets or Gmail triggers, secure the required API keys, and build your own customized workflow by following the step-by-step instructions. Automate, monitor, and continuously improve your content publishing pipelines to save time and increase marketing impact!

What is the primary benefit of using n8n to publish blog posts?

Using n8n to publish blog posts automates repetitive tasks, ensures consistency across platforms like Medium, Dev.to, and Ghost, and accelerates content delivery without manual intervention.

How can I trigger the blog publishing workflow in n8n?

You can trigger the workflow via new entries in Google Sheets, incoming Gmail messages with a specific label, or webhooks from marketing platforms like HubSpot.

What security measures should I consider when automating blog publishing?

Secure API keys using n8n credential storage, limit scopes to necessary permissions, encrypt sensitive data, and ensure compliance with privacy laws when handling PII.

Can this automation handle publishing errors gracefully?

Yes, by implementing error handling nodes that log failures, perform retries with backoff, and send alerts to Slack or email for prompt action.

How do I scale the blog post automation for high volume?

Use batch processing, queues, and concurrency controls within n8n while leveraging webhooks for real-time triggers to efficiently handle large volumes without hitting rate limits.