Google Gemini to LinkedIn and X, posts ready to ship
Posting on LinkedIn and X sounds simple until you do it every day. You write one version, rewrite it for the other platform, hunt for decent hashtags, then still worry you pasted the wrong draft or forgot to hit publish.
This is the kind of headache social media managers complain about, but founders and marketing consultants feel it too. With Gemini post automation, you hand over one topic and get two platform-ready posts published for you, plus a clear success confirmation so you’re not guessing.
Below you’ll see how the workflow runs, what it automates end-to-end, and what you need to set it up without turning this into a “weekend project.”
How This Automation Works
The full n8n workflow, from trigger to final output:
n8n Workflow Template: Google Gemini to LinkedIn and X, posts ready to ship
flowchart LR
subgraph sg0["Receive Post Title Flow"]
direction LR
n0@{ icon: "mdi:brain", form: "rounded", label: "Google Gemini Chat Model", pos: "b", h: 48 }
n1["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/form.svg' width='40' height='40' /></div><br/>Receive Post Title"]
n2@{ icon: "mdi:robot", form: "rounded", label: "Generate AI Content", pos: "b", h: 48 }
n3@{ icon: "mdi:robot", form: "rounded", label: "Format AI Output", pos: "b", h: 48 }
n4["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/x.dark.svg' width='40' height='40' /></div><br/>Post to X"]
n5["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/linkedin.svg' width='40' height='40' /></div><br/>Post to LinkedIn"]
n6["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/merge.svg' width='40' height='40' /></div><br/>Append Linkedin And X Publis.."]
n7["<div style='background:#f5f5f5;padding:10px;border-radius:8px;display:inline-block;border:1px solid #e0e0e0'><img src='https://flowpast.com/wp-content/uploads/n8n-workflow-icons/form.svg' width='40' height='40' /></div><br/>Show Confirmation"]
n4 --> n6
n3 -.-> n2
n5 --> n6
n1 --> n2
n2 --> n4
n2 --> n5
n0 -.-> n2
n6 --> n7
end
%% Styling
classDef trigger fill:#e8f5e9,stroke:#388e3c,stroke-width:2px
classDef ai fill:#e3f2fd,stroke:#1976d2,stroke-width:2px
classDef aiModel fill:#e8eaf6,stroke:#3f51b5,stroke-width:2px
classDef decision fill:#fff8e1,stroke:#f9a825,stroke-width:2px
classDef database fill:#fce4ec,stroke:#c2185b,stroke-width:2px
classDef api fill:#fff3e0,stroke:#e65100,stroke-width:2px
classDef code fill:#f3e5f5,stroke:#7b1fa2,stroke-width:2px
classDef disabled stroke-dasharray: 5 5,opacity: 0.5
class n1 trigger
class n2,n3 ai
class n0 aiModel
classDef customIcon fill:none,stroke:none
class n1,n4,n5,n6,n7 customIcon
The Problem: Posting Twice Becomes Twice the Work
LinkedIn and X reward different writing styles, character limits, and pacing. So you end up doing the same work in two formats: draft the idea, rewrite it, shorten it, add hashtags, add a CTA, then publish in two separate places. It’s not hard work. It’s grindy work, which makes it easy to procrastinate or rush. And when you rush, you ship inconsistent messaging, miss a hashtag you always use, or post to one platform and forget the other until tomorrow (when the topic already feels stale).
None of these alone is the problem. Together, they are.
- Two separate publishing flows means you’re constantly context switching between tools and formats.
- Manual copy-paste creates tiny mistakes that look unprofessional, like broken spacing or cut-off sentences.
- Hashtags and CTAs get inconsistent, which means your “brand voice” starts drifting post to post.
- You don’t get a clean “done” moment, so you double-check, refresh, and waste more time.
The Solution: One Topic In, Two Posts Published
This n8n workflow turns a single topic submission into finished posts for LinkedIn and X, then publishes both automatically. It starts when you submit a simple form with the post title or topic (protected with basic authentication, so random people can’t spam your workflow). From there, Google Gemini generates copy tailored to each platform, including hashtags and a call-to-action for LinkedIn, plus a character limit check for X so you don’t get surprise truncation. The workflow then parses the AI output into a structured JSON format, which keeps the final posts consistent and predictable. Finally, n8n publishes to X and LinkedIn through OAuth2 (secure, permission-based access), merges the responses, and shows a success confirmation so you know it actually shipped.
The workflow begins with your topic and ends with two live posts. Gemini handles the writing, n8n handles the routing and publishing, and you get a clear confirmation step that closes the loop.
What You Get: Automation vs. Results
| What This Workflow Automates | Results You’ll Get |
|---|---|
|
|
Example: What This Looks Like
Say you publish 5 times a week. Manually, it’s easy to spend about 15 minutes writing a LinkedIn version, another 10 minutes rewriting for X, then about 5 minutes total to publish both and double-check they went live, so roughly 30 minutes per day. With this workflow, you submit the topic in about 2 minutes, wait a few minutes for generation and posting, then you get a confirmation form. That’s roughly 2–5 minutes of your time instead of half an hour, which adds up to a couple hours back every week.
What You’ll Need
- n8n instance (try n8n Cloud free)
- Self-hosting option if you prefer (Hostinger works well)
- Google Gemini API for generating platform-specific post drafts
- X (Twitter) developer account to publish via OAuth2
- LinkedIn developer app to publish via OAuth2
- Gemini API key (get it from Google AI Studio)
Skill level: Intermediate. You’ll connect OAuth accounts and paste API credentials, but you won’t be writing code.
Don’t want to set this up yourself? Talk to an automation expert (free 15-minute consultation).
How It Works
A form submission kicks it off. You submit a post topic (usually a title or prompt) through the “Collect Post Topic” form. Basic authentication protects the endpoint, which means your workflow isn’t open to the internet.
Gemini generates two versions of the content. The workflow sends your topic into the Gemini chat model through an AI agent, which drafts one post for LinkedIn and another for X, plus hashtags and a LinkedIn CTA. It also checks the X character limit so the final copy is actually usable.
The output gets structured before publishing. A structured output parser turns the AI response into a predictable JSON object, so n8n can reliably pull the LinkedIn text, the X text, and the hashtags without you constantly “fixing the format.” Honestly, this is what makes it feel dependable instead of random.
Two posts go live, then you get confirmation. n8n posts to X and LinkedIn using OAuth2, merges the publish responses, and displays a success notice in a final form screen so you know both actions worked.
You can easily modify the writing prompt to match your brand voice or swap the trigger form for another input method based on your needs. See the full implementation guide below for customization options.
Step-by-Step Implementation Guide
Step 1: Configure the Form Trigger
Set up the form trigger to collect the post topic and secure access with Basic Auth.
- Add the Collect Post Topic node as your trigger.
- Set Form Title to
postand Form Description topost. - Under Form Fields, add a field with Field Label set to
post title. - Set Authentication to
basicAuth. - Credential Required: Connect your httpBasicAuth credentials in Collect Post Topic.
Step 2: Connect the Gemini Model
Configure the language model used by the AI agent to draft platform-specific content.
- Open Gemini Conversation Model.
- Set Model Name to
models/gemini-2.0-flash. - Credential Required: Connect your googlePalmApi credentials in Gemini Conversation Model.
Step 3: Set Up the AI Drafting and Output Structure
Use the AI agent to generate copy and the structured parser to format the response for publishing.
- Open Draft Social Copy and set Text to
= write min 50 word about this topic '{{ $json["post title"] }}' for Linkedin and X platform separately. - Ensure Prompt Type is set to
defineand Has Output Parser is enabled. - Open Structure AI Result and set Schema Type to
manual. - Paste the provided JSON schema into Input Schema exactly as defined in the workflow.
- Confirm Gemini Conversation Model is connected to Draft Social Copy as the AI language model.
- Confirm Structure AI Result is connected to Draft Social Copy as the output parser.
- Note: Structure AI Result is a sub-node; credentials (if needed) are handled on Gemini Conversation Model, not the parser itself.
Draft Social Copy outputs to both Publish to X Network and Share to LinkedIn Feed in parallel.
Step 4: Configure Social Publishing and Success Output
Publish the AI-generated posts to X and LinkedIn, merge results, and show a completion message.
- Open Publish to X Network and set Text to
={{ $json.output.platform_posts.Twitter.post }}. - Credential Required: Connect your twitterOAuth2Api credentials in Publish to X Network.
- Open Share to LinkedIn Feed and set Text to
={{ $json.output.platform_posts.LinkedIn.post }}. - Set Person to
[YOUR_ID]. - Credential Required: Connect your linkedInOAuth2Api credentials in Share to LinkedIn Feed.
- Open Combine Publish Outcomes and set Mode to
combineand Combine By tocombineAll. - Open Display Success Notice and set Operation to
completion. - Set Completion Title to
Your post has been successfully sharedand Completion Message to=🔗 View your posts: X (Twitter): [https://x.com/x/status/{{ $json.id }}] LinkedIn: [https://www.linkedin.com/feed/update/{{ $json.urn }}].
Publish to X Network and Share to LinkedIn Feed both feed into Combine Publish Outcomes before reaching Display Success Notice.
⚠️ Common Pitfall: Replace [YOUR_ID] in Share to LinkedIn Feed with your actual LinkedIn person ID, or the post will fail.
Step 5: Test and Activate Your Workflow
Run a manual test to verify the AI output and publishing flow, then activate the workflow for production use.
- Click Test Workflow and submit the Collect Post Topic form with a sample topic.
- Verify Draft Social Copy returns structured content with LinkedIn and Twitter posts.
- Confirm posts are published in both social accounts and Display Success Notice shows working URLs.
- When satisfied, toggle the workflow to Active for live use.
Common Gotchas
- LinkedIn credentials can expire or need specific permissions. If things break, check your LinkedIn app settings and the OAuth connection in n8n’s Credentials first.
- If you’re using Wait nodes or external rendering, processing times vary. Bump up the wait duration if downstream nodes fail on empty responses.
- Gemini prompts that are too generic create bland posts. Add a short “brand voice” instruction in the Draft Social Copy node or you will end up editing every output.
Frequently Asked Questions
About 30–60 minutes if your developer accounts are ready.
No. You’ll connect accounts, paste keys, and adjust a prompt. If you can follow a checklist, you’re fine.
Yes. n8n has a free self-hosted option and a free trial on n8n Cloud. Cloud plans start at $20/month for higher volume. You’ll also need to factor in Gemini API usage costs (usually small for short posts).
Two options: n8n Cloud (managed, easiest setup) or self-hosting on a VPS. For self-hosting, Hostinger VPS is affordable and handles n8n well. Self-hosting gives you unlimited executions but requires basic server management.
Yes, and you should. Update the instructions inside the Draft Social Copy (AI agent) node to include tone, forbidden phrases, formatting rules, and a couple example posts. Common customizations include adding your preferred hashtag style, changing the CTA template, and forcing a specific post structure (hook, value, close). If you want even tighter control, adjust the structured output parser schema so Gemini must return exactly the fields you expect.
Usually it’s expired OAuth credentials or missing LinkedIn app permissions. Reconnect the LinkedIn credential in n8n, then confirm your LinkedIn developer app is approved for the posting scopes you’re trying to use. It can also fail if you’re attempting to post to a Company Page without the right admin access.
Plenty for a normal posting schedule.
It depends on how picky you are about structure and control. This workflow benefits from n8n’s stronger logic and the structured output parsing approach, so the “AI part” behaves more reliably. n8n also gives you a self-hosted path, which is handy if you post a lot or run multiple brands. Zapier and Make can be faster to start for very simple “generate text then post” setups, but you’ll often hit limits when you want branching, validation, or a real confirmation step. If you’re unsure, Talk to an automation expert and you’ll get a straight recommendation.
Once this is running, your “posting workflow” becomes a two-minute habit, not a daily chore. The automation handles the repetitive parts so your attention stays on the ideas.
Need Help Setting This Up?
Our automation experts can build and customize this workflow for your specific needs. Free 15-minute consultation—no commitment required.