🔓 Unlock all 10,000+ workflows & prompts free Join Newsletter →
✅ Full access unlocked — explore all 10,000 AI workflow and prompt templates Browse Templates →
Home n8n Workflow
January 22, 2026

Google Gemini to LinkedIn, posts with images ready

Lisa Granqvist Partner Workflow Automation Expert

You sit down to “just post on LinkedIn,” and suddenly it’s 45 minutes later. The idea was there, but the writing, formatting, image creation, and upload steps turned into a mini project.

This hits marketing managers hard, because consistency is part of the job. founders feel it when the week gets busy. And if you run a small agency, it’s one more thing that slips when client work piles up. With Gemini LinkedIn automation, one topic becomes a publish-ready post plus a matching image.

Below, you’ll see how the workflow runs in n8n, what you need to connect, and what kind of time you get back once the boring parts are automated.

How This Automation Works

The full n8n workflow, from trigger to final output:

n8n Workflow Template: Google Gemini to LinkedIn, posts with images ready

The Problem: LinkedIn Posting Becomes a Multi-Step Chore

Writing a decent LinkedIn post is only part of the work. You also have to turn rough notes into something structured, clean up formatting that looks fine in a doc but weird on LinkedIn, come up with an image that doesn’t feel like stock-photo filler, and then go through the upload process without breaking line spacing or losing hashtags. On a busy week, the “I’ll post later” delay is what kills consistency. And when you do rush it, mistakes show up in public.

The friction compounds. Not because any one step is impossible, but because there are too many of them.

  • Drafting from scratch for every post makes you second-guess tone, length, and structure.
  • Manual formatting often turns bullet points and spacing into a messy wall of text.
  • Finding or designing a relevant image can take about 30 minutes on its own.
  • Uploading the image, waiting for processing, and publishing becomes a repetitive checklist you repeat every time.

The Solution: Generate the Post and Image, Then Publish Automatically

This workflow turns a single topic submission into a finished LinkedIn post with a custom AI-generated image, then publishes it for you. It starts with a simple form where you drop the topic you want to write about. From there, Google Gemini generates two things in one go: the LinkedIn post copy (with a coherent structure and hashtags) and a separate image prompt that matches the theme. The workflow then calls Google Imagen 4 to create a square, LinkedIn-friendly image, registers an upload session with LinkedIn, converts the image data into the right format, and uploads it. Finally, it adapts the text into LinkedIn-safe formatting, waits briefly so the asset is ready, and publishes the post with the image attached.

The workflow kicks off from your form submission. Gemini produces post text plus an image description, then Imagen 4 creates the visual. LinkedIn’s API handles upload registration, the image is attached, and the post goes live after a short wait.

What You Get: Automation vs. Results

Example: What This Looks Like

Say you publish three LinkedIn posts per week. Manually, a reasonable routine is about 30 minutes to write, 20 minutes to clean up formatting and hashtags, and another 20 minutes to create or find an image, so roughly 70 minutes per post (about 3.5 hours a week). With this workflow, you submit a topic in about 2 minutes, then wait while Gemini and Imagen run (image generation is usually 10–30 seconds, plus upload time). You still may review the output, but the “blank page + design task” part is gone.

What You’ll Need

  • n8n instance (try n8n Cloud free)
  • Self-hosting option if you prefer (Hostinger works well)
  • LinkedIn Developer App for OAuth and posting permissions.
  • Google Gemini API to generate the post and image prompt.
  • Google Cloud access token (get it from Google Cloud SDK via gcloud auth print-access-token)

Skill level: Intermediate. You’ll be connecting OAuth credentials and pasting API tokens, plus minor prompt edits if you want a specific brand voice.

Don’t want to set this up yourself? Talk to an automation expert (free 15-minute consultation).

How It Works

A topic submission triggers everything. You fill out a form with one topic (for example, “3 mistakes teams make with onboarding emails”). n8n captures it and maps the input into the format the AI agent expects.

Gemini writes the post and plans the image. The content agent asks Google Gemini for structured output, which includes LinkedIn post text plus an image prompt description. A formatting step cleans the response, so you are not stuck fixing JSON quirks or odd line breaks.

Imagen creates the visual and LinkedIn accepts the upload. n8n sends the prompt to Google Imagen 4 (square aspect ratio), then registers an upload with LinkedIn. The workflow converts the returned base64 image into a binary payload and uploads it as an asset.

The post is curated and published. Another formatting step adapts the text into LinkedIn-friendly formatting (so markdown doesn’t show up like raw symbols). After a short wait to ensure the asset is processed, the workflow publishes the post with the image attached.

You can easily modify the tone and formatting rules to match your brand, then publish as a draft-review flow instead of auto-posting based on your needs. See the full implementation guide below for customization options.

Step-by-Step Implementation Guide

Step 1: Configure the Form Trigger

This workflow starts with a form that captures a LinkedIn post topic and maps it into the AI prompt pipeline.

  1. Add and open Form Submission Trigger.
  2. Set Form Title to LinkedIn Post Generator .
  3. In Form Fields, keep the Topic field as required with placeholder Enter prompt here.....
  4. Connect Form Submission Trigger to Map Input Fields to pass the form data downstream.
Tip: The Flowpast Branding sticky note is informational and does not affect execution.

Step 2: Connect Primary Services (AI + LinkedIn)

Set credentials for the AI model and LinkedIn API requests used in the workflow.

  1. Open Gemini Chat Engine and set Model Name to models/gemini-2.5-pro.
  2. Credential Required: Connect your googlePalmApi credentials in Gemini Chat Engine.
  3. Open Generate Image Prompt and verify URL is https://us-central1-aiplatform.googleapis.com/v1/projects/[YOUR_ID]/locations/us-central1/publishers/google/models/imagen-4.0-generate-preview-06-06:predict.
  4. Credential Required: Connect your httpBearerAuth credentials in Generate Image Prompt.
  5. Open Initiate Image Upload and Publish LinkedIn Post.
  6. Credential Required: Connect your httpBearerAuth and linkedInOAuth2Api credentials in both Initiate Image Upload and Publish LinkedIn Post.
⚠️ Common Pitfall: Replace every [YOUR_ID] placeholder in LinkedIn and Vertex AI URLs with your actual project/person IDs, or the API calls will fail.

Step 3: Set Up the AI Content Strategy Chain

The workflow maps the form topic into a structured prompt, then uses the AI agent to generate post content and an image prompt.

  1. In Map Input Fields, add an assignment with Name chatInput and Value ={{ $json.Topic }}.
  2. Open Content Strategy Agent and keep the System Message expression that starts with =I need help creating a professional LinkedIn post for the topic: "{{ $json.chatInput }}".
  3. Ensure Gemini Chat Engine is connected as the language model for Content Strategy Agent (credentials are set on Gemini Chat Engine, not the agent).
  4. Connect Content Strategy Agent to Format Output Data to parse the JSON response into post_content and image_prompt.
Tip: If the AI response includes code fences, Format Output Data strips ```json and ``` before parsing.

Step 4: Configure Image Generation and LinkedIn Asset Upload

This stage generates the image, registers a LinkedIn upload, builds a binary payload, and uploads the asset.

  1. In Generate Image Prompt, set Method to POST and Content Type to raw.
  2. Set Body to the JSON expression that includes "prompt": "{{ $json.image_prompt }}" and "aspectRatio": "1:1".
  3. In Initiate Image Upload, keep URL as https://api.linkedin.com/v2/assets?action=registerUpload and ensure the header X-Restli-Protocol-Version is set to 2.0.0.
  4. Open Build Binary Payload and keep the code that reads from Generate Image Prompt and Format Output Data (no changes required).
  5. In Upload Image Asset, set URL to ={{ $('Initiate Image Upload').item.json.value.uploadMechanism['com.linkedin.digitalmedia.uploading.MediaUploadHttpRequest'].uploadUrl }} and Content Type to binaryData.
  6. In Upload Image Asset, set headers Authorization to Bearer [CONFIGURE_YOUR_TOKEN] and Content-Type to image/png.
⚠️ Common Pitfall: Upload Image Asset does not use credentials—ensure the Authorization header contains a valid LinkedIn token.

Step 5: Adapt Post Text and Publish to LinkedIn

The post text is converted to LinkedIn-friendly formatting, then a short pause allows the asset upload to finalize before publishing.

  1. In Adapt LinkedIn Text, keep the code that converts markdown to LinkedIn-compatible text and outputs linkedin_content.
  2. In Pause for Upload, set Amount to 60 seconds to allow asset processing time.
  3. In Publish LinkedIn Post, keep URL as https://api.linkedin.com/v2/ugcPosts.
  4. Set the Body field to the existing JSON expression, including "text": {{ $json.linkedin_content ? JSON.stringify($json.linkedin_content) : "\"\"" }} and "media": "{{ $('Initiate Image Upload').item.json.value.asset }}".
  5. Confirm the execution flow is linear: Upload Image AssetAdapt LinkedIn TextPause for UploadPublish LinkedIn Post.

Step 6: Test and Activate Your Workflow

Run a manual test to confirm the form input produces a LinkedIn post with an image.

  1. Click Execute Workflow and submit the Form Submission Trigger with a test Topic.
  2. Verify Format Output Data returns post_content and image_prompt without JSON parsing errors.
  3. Confirm Upload Image Asset succeeds and Adapt LinkedIn Text outputs linkedin_content.
  4. Check LinkedIn for a new published post with the generated image after Pause for Upload completes.
  5. Toggle the workflow Active to enable it for production form submissions.
🔒

Unlock Full Step-by-Step Guide

Get the complete implementation guide + downloadable template

Common Gotchas

  • LinkedIn credentials can expire or need specific permissions. If things break, check your LinkedIn Developer App token and the w_member_social scope 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.
  • Default prompts in AI nodes are generic. Add your brand voice early or you’ll be editing outputs forever.

Frequently Asked Questions

How long does it take to set up this Gemini LinkedIn automation?

About an hour if you already have your LinkedIn and Google credentials ready.

Do I need coding skills to automate Gemini LinkedIn automation?

No. You will mostly connect accounts and paste tokens into n8n. The only “code” parts are already in the workflow and usually don’t need changes.

Is n8n free to use for this Gemini LinkedIn automation workflow?

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 Google Gemini and Google Imagen 4 usage from your Google accounts.

Where can I host n8n to run this automation?

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.

Can I customize this Gemini LinkedIn automation workflow for draft approval instead of auto-posting?

Yes, but you’ll change one key behavior. Keep the Gemini generation steps the same, then replace the “Publish LinkedIn Post” HTTP request with a draft-saving step (for example, write the final text and asset URL to Google Sheets) and add an approval workflow before publishing. Common tweaks include adjusting the agent prompt for your brand voice, changing the hashtags style, and increasing the Wait duration if LinkedIn assets aren’t ready in time.

Why is my LinkedIn connection failing in this workflow?

Usually it’s expired credentials or missing scopes on your LinkedIn app. Regenerate the token, confirm you included w_member_social, then update the credentials used by the HTTP Request nodes that register the upload and publish the post. If it works sometimes and fails in batches, you may also be hitting LinkedIn rate limits, so spacing out executions helps.

How many posts can this Gemini LinkedIn automation handle?

A lot.

Is this Gemini LinkedIn automation better than using Zapier or Make?

For this use case, n8n is typically a better fit because you’re doing multi-step API work (image generation, upload registration, binary conversion, then publishing). Zapier and Make can do it, but you often end up paying more as the steps and volume grow, and handling binary file uploads can get finicky. n8n also gives you a self-hosting route, which matters if you want unlimited runs without counting every task. If you just want “topic in, draft out” with minimal logic, Zapier or Make can be simpler. If you’re unsure, Talk to an automation expert and we’ll point you to the cleanest option.

Once this is running, LinkedIn stops being a weekly scramble. The workflow handles the repeatable parts, so you can focus on ideas and results.

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.

Lisa Granqvist

Workflow Automation Expert

Expert in workflow automation and no-code tools.

×

Use template

Get instant access to this n8n workflow Json file

💬
Get a free quote today!
Get a free quote today!

Tell us what you need and we'll get back to you within one working day.

Get a free quote today!
Get a free quote today!

Tell us what you need and we'll get back to you within one working day.

Launch login modal Launch register modal