Automated AI Content Generator for LinkedIn (Gemini Integration) - n8n Workflow

Use this powerful n8n workflow to automatically generate high-quality text and image content using Gemini AI and schedule posts to LinkedIn directly from a Google Sheet. Maximize content velocity.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Marketing Managers: Looking to scale their content production on professional platforms like LinkedIn.

  • Content Creators & Agencies: Needing reliable n8n templates for scheduling AI-generated social content.

  • Automation Specialists: Seeking advanced examples of using the n8n AI Agent node with structured output.

  • Solopreneurs: Who want to maintain a consistent, high-quality presence on LinkedIn without manual effort.

Overview

Maintaining a steady, high-quality stream of content on LinkedIn is crucial for professional visibility, but it often consumes significant time. This n8n workflow solves this by fully automating the creation and publishing process. By simply adding titles to a Google Sheet, this automation leverages the power of the Google Gemini large language model to craft professional, engaging text posts and simultaneously generate a relevant, custom image.

The entire process, from content drafting to final publication and status tracking, is managed by a single n8n workflow. This is one of the most effective n8n templates available for scaling social media engagement and proves the versatility of the n8n node ecosystem for AI-driven tasks.

How it Works

This comprehensive n8n workflow operates on a scheduled polling mechanism:


  1. Trigger & Filter: The process starts with the Google Sheets Trigger n8n trigger, which monitors a specified spreadsheet for new rows. The subsequent If n8n node filters for entries where the Status column is marked 'pending'.

  2. AI Content Generation: The core content creation is handled by the AI Agent n8n node, configured with the Google Gemini Chat Model. It receives a post title and, following strict instructions, generates a complete LinkedIn post (including hook, body, and hashtags) formatted as a JSON object.

  3. Data Preparation: A Code n8n node sanitizes the AI-generated text, escaping newlines (\n) for compatibility with the LinkedIn API payload.

  4. Image Creation: The Generate Image with Gemini n8n node takes the newly created post text and uses it to generate a visually engaging 16:9 image asset suitable for LinkedIn.

  5. Temporary Storage: The generated image is uploaded to Google Drive, shared publicly, and the public URL is recorded back into the Google Sheet via an Update row in sheet1 n8n node.

  6. LinkedIn API Sequence: The n8n workflow fetches the user's LinkedIn ID via an HTTP Request n8n node, registers the image upload with LinkedIn using the public URL (downloaded by the Download file n8n node), and uploads the binary data to LinkedIn's servers.

  7. Publication: Finally, a second HTTP Request n8n node (titled HTTP Request2) publishes the full user-generated content (UGC), combining the AI text and the uploaded image asset ID.

  8. Completion Tracking: The final Update row in sheet n8n node marks the original row as 'posted', preventing the n8n trigger from reprocessing it.

Installation Guide

To deploy and utilize this n8n workflow, follow these steps:


  1. Import the n8n Workflow: Copy the provided JSON code and paste it into your n8n instance via the 'Import from JSON' option.

  2. Google Sheets Setup: You must have a Google Sheet set up with columns like 'ID', 'LinkedIn Post Title', and 'Status'.

  3. Credential Configuration (Google Sheets): Set up credentials for both the Google Sheets Trigger and the regular Google Sheets n8n node, linking them to the spreadsheet containing your post schedule.

  4. Credential Configuration (Gemini/AI): Configure the Google Gemini (or PaLM) API credential for the Google Gemini Chat Model and Generate Image with Gemini n8n node.

  5. Credential Configuration (LinkedIn): Set up a generic HTTP Header Auth credential for LinkedIn. This usually involves obtaining a permanent access token and configuring the authorization header for the LinkedIn API requests within the relevant HTTP Request n8n nodes.

  6. Google Drive Credential: Configure Google Drive credentials and ensure the specified destination folder for image uploads exists and is accessible.

  7. Activate: Save the n8n workflow and set the main switch to 'Active'. The Google Sheets n8n trigger will begin polling immediately.

Node Details

Google Sheets Trigger: The initial n8n trigger, configured to poll the 'Posts' sheet for new content every minute.
AI Agent (Gemini Powered): Utilizes the Google Gemini Chat Model for advanced natural language generation. It runs a complex prompt to ensure the output is tailored specifically for the LinkedIn platform, requiring a structured JSON response to keep data clean.
Code: A crucial n8n node that handles data transformation, specifically replacing standard newlines with escaped newlines (\n to \\n) to ensure the post content is correctly embedded within the JSON payload sent to the LinkedIn API.
Generate Image with Gemini: An n8n node dedicated to generating high-quality image binaries based on the generated post text, configured for a professional 16:9 aspect ratio, suitable for visual engagement.
Upload file & Share file (Google Drive): These n8n nodes temporarily store the binary image data and make it publicly accessible via a direct URL, bridging the gap between Gemini image generation and the LinkedIn upload mechanism.
HTTP Request (LinkedIn API): Multiple HTTP Request n8n nodes manage the interaction with LinkedIn's complex API endpoints, handling user ID retrieval, registering the media asset, uploading the binary file, and finally publishing the complete UGC (User Generated Content) post.

Related n8n Workflows

Free

Nodes: 11 Nodes
Updated: December 26 2025
View all

Featured*