Your cart is currently empty!
How to Publish Blog Posts to Medium, Dev.to, and Ghost with n8n: Automate Your Marketing Workflow
How to Publish Blog Posts to Medium, Dev.to, and Ghost with n8n: Automate Your Marketing Workflow
Publishing engaging blog posts consistently across multiple platforms is a cornerstone of effective marketing strategies. 🚀 However, manually posting content to Medium, Dev.to, and Ghost can quickly become tedious and error-prone, especially for fast-moving startups. In this guide, we’ll explore how to publish blog posts to Medium, Dev.to, and Ghost with n8n, showcasing practical automation workflows tailored for marketing teams, CTOs, and automation engineers.
We’ll dive into building a streamlined workflow integrating tools like Gmail, Google Sheets, Slack, and HubSpot, automating everything from content drafting, approval, to multi-platform publishing. By the end, you’ll have a reusable blueprint to scale your marketing content delivery without lifting a finger.
Why Automate Blog Publishing Across Medium, Dev.to, and Ghost?
Managing multiple blogging channels manually poses several challenges:
- Time-consuming tasks: Manually copying and formatting articles wastes valuable time.
- Human error: Copy-paste mistakes and format inconsistencies erode content quality.
- Lack of scalability: Rapid content growth demands automation to maintain consistency.
Marketing, operations, and engineering teams benefit significantly by automating this process:
- Marketers: Stay focused on crafting messages rather than distribution logistics.
- CTOs & Automation Engineers: Implement robust automated pipelines reducing manual interventions.
Our solution leverages n8n, an open-source workflow automation tool, allowing deep integration and customizable controls across popular services like Gmail, Google Sheets, Slack, and HubSpot.
Overview of the Automated Publishing Workflow
The end-to-end workflow comprises the following key phases:
- Trigger: A new blog draft entry is detected (e.g., in Google Sheets or received via Gmail).
- Approval: Content is sent for editorial review via Slack notifications or a HubSpot approval pipeline.
- Transformation: Content formatting and slug generation are prepared.
- Publishing: The post is then simultaneously published to Medium, Dev.to, and Ghost through their respective APIs.
- Notification & Logging: Confirmation messages are sent back through Slack and logs updated in Google Sheets or a database.
Prerequisites and Tools
- n8n instance: Self-hosted or n8n.cloud account.
- Medium Developer Token: From your Medium settings (integration tab).
- Dev.to API key: Found under your profile API keys.
- Ghost Admin API Key: Setup in Ghost Admin → Integrations.
- Gmail account: For email trigger and notifications.
- Google Sheets: Content repository and tracking.
- Slack workspace: For alerts and approval workflows.
- HubSpot account (optional): To integrate marketing CRM approvals.
Step-by-Step Guide to Automate Blog Publishing with n8n
1. Setting up the Trigger Node
Our workflow starts on a trigger — typically when a new blog draft is added.
Option A: Google Sheets Trigger
Use the Google Sheets Trigger node to monitor rows being added or updated in a specific spreadsheet containing blog drafts.
- Sheet ID: Your Google Sheets document ID.
- Worksheet: Name of the tab holding drafts, e.g., ‘Drafts’.
- Trigger event: On new row added.
Option B: Gmail Trigger
Alternatively, use Gmail Trigger to watch for incoming emails with posts attached or within a specific label.
2. Adding Content Approval via Slack or HubSpot
Once a draft is detected, the next step is editorial approval.
Slack Integration:
- Slack Post Node: Send the draft preview to a dedicated Slack channel with buttons or dropdown to approve/reject.
- Slack Events Node: Listens to message reactions or commands triggering approval event.
HubSpot Pipeline: Alternatively, create a HubSpot deal or ticket representing the draft, assigning approval stages and statuses.
3. Formatting the Content
n8n supports JavaScript expressions and Set nodes to transform data before publishing.
Key transformations:
- Convert markdown or rich text to HTML if necessary.
- Generate URL-friendly slugs from the blog title:
{{ $json.title.toLowerCase().replace(/\s+/g, '-').replace(/[^a-z0-9-]/g, '') }} - Sanitize scripts and HTML tags for API safety.
- Add tags, categories, featured images metadata.
4. Publishing to Medium
Medium API Endpoint: The node will POST the blog content to https://api.medium.com/v1/users/{{userId}}/posts.
Node Configuration:
- Authentication: Use OAuth2 or Bearer Token with your Medium Integration Token.
- Request Body:
{
"title": "{{$json["title"]}}",
"contentFormat": "html",
"content": "{{$json["contentHtml"]}}",
"tags": {{$json["tags"]}},
"publishStatus": "public",
"license": "all-rights-reserved"
}
5. Publishing to Dev.to
Dev.to API: You’ll POST to https://dev.to/api/articles with your API key in headers.
Headers: api-key: YOUR_DEV_TO_API_KEY
Request Body Example:
{
"article": {
"title": "{{$json["title"]}}",
"published": true,
"body_markdown": "{{$json["contentMarkdown"]}}",
"tags": {{$json["tags"]}},
"canonical_url": "{{$json["canonicalUrl"]}}"
}
}
6. Publishing to Ghost
Ghost requires authentication via an Admin API key and specific headers.
Endpoint: https://your-ghost-site.com/ghost/api/v3/admin/posts/
Node Setup:
- HTTP Request node with
POSTmethod. - Headers to include
Authorization: Ghost Admin API Key. - Content JSON body includes
title,htmlcontent,statusset to “published”.
{
"posts": [{
"title": "{{$json["title"]}}",
"html": "{{$json["contentHtml"]}}",
"status": "published",
"tags": {{$json["tags"]}}
}]
}
Handling Errors, Retries, and Logging
In any automation, error handling ensures reliability:
- Retries & Backoff: Configure n8n’s retry logic on HTTP Request nodes to handle transient API failures.
- Idempotency: Use unique identifiers from the content source (e.g., blog draft ID) to avoid duplicate posts on retry.
- Logging: Store success/failure statuses and response codes in Google Sheets or a logging database for audits.
- Slack Alerts: Notify marketing and engineering teams immediately upon errors for fast resolution.
Security Best Practices
- API Keys & Tokens: Store secrets in n8n’s credential manager, never hard-coded in workflows.
- Scopes: Limit OAuth tokens to minimum required permissions.
- PII Handling: Avoid sending personal user data unnecessarily through third-party APIs.
- Access Control: Restrict who can edit workflows in n8n, and audit access.
Scaling and Optimizing Performance
Using Webhooks vs Polling 🔄
Webhooks enable near real-time triggers from content sources (e.g., HubSpot form submission triggers webhook). Polling (e.g., Google Sheets node every 5 min) is easier to implement but less efficient at scale.
| Trigger Type | Latency | Complexity | Scalability |
|---|---|---|---|
| Webhook | Milliseconds to seconds | Medium (requires endpoints) | High, efficient for large scale |
| Polling | Minutes (configurable interval) | Low (node config) | Lower (inefficient API usage) |
Workflow Modularization and Versioning
Separate the publishing logic into sub-workflows or reusable functions (e.g., one workflow per platform). Use descriptive version names and comments for easier maintenance.
Comparison of Popular Automation Platforms
| Automation Tool | Cost | Pros | Cons |
|---|---|---|---|
| n8n (Self-hosted) | Free (open source), Paid cloud plans | Highly customizable, self-hosting control, many integrations | Requires DevOps resources if self-hosted |
| Make (Integromat) | Starts at $9/month | Visual editor, extensive app library, simple to start | Limits on operations, less flexible for complex logic |
| Zapier | Starts at $19.99/month | Extensive app support, easy UI, stable infrastructure | Pricing scales quickly, limited native control for parallelism |
Choosing Content Storage: Google Sheets vs Database
| Option | Ease of Setup | Scalability | Features |
|---|---|---|---|
| Google Sheets | Very easy – no code | Low to medium (limit API calls) | Basic row-based storage, collaboration tools |
| Database (e.g., PostgreSQL) | Requires setup, schema design | High; supports large data and advanced queries | Transactions, indexing, secure storage |
Monitoring and Testing Automation Workflows
Before going live:
- Use sandbox/test accounts on Medium, Dev.to, and Ghost.
- Enable run history tracking inside n8n to audit triggers and outputs.
- Set up alerts and notifications in Slack for failures.
- Validate data inputs and API responses with conditional checks.
Frequently Asked Questions (FAQ)
How do I publish blog posts to Medium, Dev.to, and Ghost with n8n?
You automate the publication process by building an n8n workflow that triggers on new content, then uses API calls to Medium, Dev.to, and Ghost to publish posts with the proper authentication and data formatting.
What are the benefits of automating blog publishing using n8n?
Automation reduces manual effort, minimizes errors, ensures consistent multi-platform publishing, and helps marketing teams publish scalable content faster, improving workflow efficiency.
Which services can I integrate with n8n for marketing automation?
Common integrations include Gmail for email triggers, Google Sheets for content management, Slack for notifications, and HubSpot for CRM and approval pipelines, among many others.
How can I handle errors and retries in my publishing workflow?
Use n8n’s built-in retry settings on API requests with exponential backoff. Implement idempotency keys to avoid duplicated posts and send failure alerts via Slack to monitor issues promptly.
Is it secure to store API tokens in n8n for blog publishing?
Yes, n8n securely encrypts credentials stored in its credential manager. Ensure to only assign minimal required scopes to API tokens and restrict access to your workflows to trusted users.
Conclusion: Take Your Marketing Automation to the Next Level
Automating how to publish blog posts to Medium, Dev.to, and Ghost with n8n empowers your marketing and engineering teams to focus on creating value instead of manual content distribution. By integrating Gmail, Google Sheets, Slack, and HubSpot, you streamline approvals, content transformation, and multi-platform publishing with high reliability and security.
Start by setting up your trigger node and gradually build out approval and publishing steps. Remember to implement robust error handling and monitor your workflows closely to ensure smooth operation.
Ready to empower your marketing automation? Deploy this workflow today and watch your content flow effortlessly across your favorite blogging platforms!