惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

MongoDB | Blog
MongoDB | Blog
B
Blog RSS Feed
MyScale Blog
MyScale Blog
M
MIT News - Artificial intelligence
H
Hackread – Cybersecurity News, Data Breaches, AI and More
J
Java Code Geeks
U
Unit 42
Blog — PlanetScale
Blog — PlanetScale
L
LangChain Blog
C
Check Point Blog
WordPress大学
WordPress大学
Last Week in AI
Last Week in AI
人人都是产品经理
人人都是产品经理
T
Tailwind CSS Blog
Vercel News
Vercel News
腾讯CDC
GbyAI
GbyAI
有赞技术团队
有赞技术团队
S
SegmentFault 最新的问题
H
Help Net Security
博客园 - 三生石上(FineUI控件)
D
DataBreaches.Net
Microsoft Security Blog
Microsoft Security Blog
小众软件
小众软件

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Write once, post everywhere: automate cross-posting to Tw...
Alex Kane · 2026-05-22 · via DEV Community

Every time I finished writing a post, I had the same 10-minute ritual:

  1. Open Twitter ― paste, trim to 280 chars, add hashtags
  2. Open LinkedIn ― paste, add professional hashtags, reformat
  3. Open Facebook ― paste, adjust tone
  4. Repeat until my soul left my body

For a 3-platform strategy, that's 30 minutes of copy-pasting per day. 3.5 hours a week. Completely mechanical work.

So I automated it with n8n. Here's the exact workflow I use — full JSON you can import right now.


What the workflow does

  1. Web form — you fill in your content and pick platforms (twitter, linkedin, facebook)
  2. Format per platform — trims Twitter to 280 chars, adds LinkedIn hashtags, keeps Facebook full
  3. Route & post — splits into parallel branches, hits each platform's API simultaneously
  4. Done — all 3 platforms posted in under 2 seconds

No more switching tabs. No more character count anxiety. Just write once.


The full n8n workflow JSON

Copy this, open n8n → Import from JSON:

{
  "name": "Social Media Cross-Poster",
  "nodes": [
    {
      "parameters": {
        "formTitle": "Create Social Post",
        "formFields": { "values": [
          { "fieldLabel": "Content", "fieldType": "textarea", "requiredField": true },
          { "fieldLabel": "Platforms", "fieldType": "text", "placeholder": "twitter,linkedin,facebook" }
        ]}
      },
      "id": "s1", "name": "Post Form", "type": "n8n-nodes-base.formTrigger", "typeVersion": 2.2, "position": [240, 300]
    },
    {
      "parameters": {
        "jsCode": "const content = $input.first().json.Content;\nconst platforms = ($input.first().json.Platforms || 'twitter,linkedin').split(',').map(p => p.trim().toLowerCase());\nconst posts = [];\nif (platforms.includes('twitter')) {\n  const t = content.length > 280 ? content.substring(0, 277) + '...' : content;\n  posts.push({ platform: 'twitter', text: t, charCount: t.length, maxChars: 280 });\n}\nif (platforms.includes('linkedin')) {\n  posts.push({ platform: 'linkedin', text: content + '\\n\\n#business #automation #productivity', charCount: content.length, maxChars: 3000 });\n}\nif (platforms.includes('facebook')) {\n  posts.push({ platform: 'facebook', text: content, charCount: content.length, maxChars: 63206 });\n}\nreturn posts.map(p => ({ json: p }));"
      },
      "id": "s2", "name": "Format Per Platform", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [480, 300]
    },
    {
      "parameters": {
        "conditions": { "conditions": [
          { "leftValue": "={{ $json.platform }}", "rightValue": "twitter", "operator": { "type": "string", "operation": "equals" } }
        ]}
      },
      "id": "s3", "name": "Route by Platform", "type": "n8n-nodes-base.switch", "typeVersion": 3.2, "position": [700, 300]
    },
    {
      "parameters": { "method": "POST", "url": "https://api.twitter.com/2/tweets", "sendBody": true, "bodyParameters": { "parameters": [{ "name": "text", "value": "={{ $json.text }}" }] } },
      "id": "s4", "name": "Post Twitter", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [920, 160]
    },
    {
      "parameters": { "method": "POST", "url": "https://api.linkedin.com/v2/ugcPosts", "sendBody": true, "bodyParameters": { "parameters": [{ "name": "text", "value": "={{ $json.text }}" }] } },
      "id": "s5", "name": "Post LinkedIn", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [920, 340]
    },
    {
      "parameters": { "method": "POST", "url": "https://graph.facebook.com/v18.0/me/feed", "sendBody": true, "bodyParameters": { "parameters": [{ "name": "message", "value": "={{ $json.text }}" }] } },
      "id": "s6", "name": "Post Facebook", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [920, 520]
    }
  ],
  "connections": {
    "Post Form": { "main": [[{ "node": "Format Per Platform", "type": "main", "index": 0 }]] },
    "Format Per Platform": { "main": [[{ "node": "Route by Platform", "type": "main", "index": 0 }]] },
    "Route by Platform": { "main": [[{ "node": "Post Twitter", "type": "main", "index": 0 }], [{ "node": "Post LinkedIn", "type": "main", "index": 0 }], [{ "node": "Post Facebook", "type": "main", "index": 0 }]] }
  },
  "settings": { "executionOrder": "v1" },
  "tags": [{ "name": "social-media" }]
}

Enter fullscreen mode Exit fullscreen mode


Setup in 5 minutes

Step 1: Get your API credentials

  • Twitter/X: Create an app at developer.twitter.com. You need OAuth 1.0a credentials (Consumer Key, Consumer Secret, Access Token, Access Secret). Add them as n8n credentials under "Twitter OAuth1 API".
  • LinkedIn: Go to linkedin.com/developers, create an app, request "Share on LinkedIn" permission. You'll get a Client ID and Secret for OAuth2. Add as n8n "LinkedIn OAuth2 API" credentials.
  • Facebook: Create a Facebook App, get a Page Access Token with pages_manage_posts permission. Swap the URL in the Facebook node to https://graph.facebook.com/v18.0/{YOUR_PAGE_ID}/feed.

Step 2: Connect credentials to nodes

In n8n, click each HTTP Request node (Post Twitter, Post LinkedIn, Post Facebook) and set the "Authentication" dropdown to your stored credentials.

Step 3: Activate and test

  1. Click "Activate" to enable the form trigger
  2. Visit the form URL (n8n shows it after activation)
  3. Type "This is a test post" — select twitter, linkedin
  4. Submit and check your profiles

Pro tips I use in production

1. Add scheduling support

Replace the Form Trigger with a Schedule Trigger + a Google Sheets node to read pre-written posts from a spreadsheet. Set the cron to run every day at 9am. One spreadsheet column per platform.

2. Customize hashtags per topic

Add a second Code node before the formatter. Read the post content, extract keywords, look up a hashtag map object in the code. Auto-inject topic-specific hashtags.

3. Engagement tracking

After each platform post, add a Google Sheets append row. Store: post text, platform, timestamp, and the post ID returned by the API. Later you can fetch engagement metrics by ID.

4. Add Instagram

Instagram requires a Facebook Business account and uses the Graph API differently (need to create a media container first, then publish). I left it out of the base version to keep setup simple — but the extra 2 nodes are well-documented in Meta's API docs.

5. Handle rate limits

Add a Wait node (1-2 seconds) between platform posts if you're posting at volume. Twitter's free tier is 1,300 tweets/month — more than enough for one account.


What's next

This workflow is part of a bigger collection I've been building: 15 ready-to-use n8n workflow templates covering email automation, CRM integration, invoice generation, AI support bots, and more.

If you want all 15 workflows pre-built and ready to import (plus setup guides for each), they're at straipeai.gumrawd.com — each template also sold individually if you only need one.

The cross-poster is $19 standalone. Or grab the complete bundle and get all 15 for $97.


Questions? Drop a comment — happy to help with API setup or customizing the formatter.