Generate LinkedIn Posts with Gemini Content & Imagen Images for Instant Publishing

πŸš€ AI-Powered LinkedIn Post Generator with Automated Image Creation

πŸ“‹ Overview

Transform any topic into professional LinkedIn posts with AI-generated content and custom images! This workflow automates the entire process from topic input to published LinkedIn post, including professional image generation using Google's Imagen 4 API.

✨ Key Features

πŸ€– AI Content Generation: Uses Google Gemini to create engaging LinkedIn posts 🎨 Professional Image Creation: Automatically generates images using Google Imagen 4 πŸ“± Direct LinkedIn Publishing: Posts content and images directly to your LinkedIn feed πŸ”„ Form-Based Input: Simple web form to submit topics πŸ“ Content Formatting: Converts markdown to LinkedIn-friendly format

πŸ”§ What This Workflow Does

πŸ“ Form Submission: User submits a topic through a web form πŸ—ΊοΈ Data Mapping: Maps the topic for AI processing 🧠 AI Content Generation: Google Gemini creates post content and image prompt 🎯 Content Normalization: Cleans and formats the AI output πŸ–ΌοΈ Image Generation: Creates professional images using Google Imagen 4 πŸ“€ LinkedIn Registration: Registers image upload with LinkedIn API πŸ”„ Binary Conversion: Converts base64 image to binary buffer ⬆️ Image Upload: Uploads image to LinkedIn πŸ“‹ Content Curation: Converts markdown to LinkedIn format ⏳ Processing Wait: Ensures image is fully processed πŸš€ Post Publishing: Publishes the complete post to LinkedIn

πŸ› οΈ Prerequisites & Setup

πŸ”‘ Required Credentials

  1. LinkedIn OAuth 2.0 Setup πŸ”—

You'll need to create a LinkedIn app with the following OAuth 2.0 scopes:

βœ… openid - Use your name and photo βœ… profile - Use your name and photo
βœ… w_member_social - Create, modify, and delete posts, comments, and reactions on your behalf βœ… email - Use the primary email address associated with your LinkedIn account

Steps to get LinkedIn credentials: Go to LinkedIn Developer Portal Create a new app or use existing one Configure OAuth 2.0 settings with the scopes above Get your access token from the authentication flow

  1. Google Cloud Platform Setup ☁️

Required GCP Services to Enable: 🎯 Vertex AI API - For Imagen 4 image generation πŸ” Cloud Resource Manager API - For project management πŸ›‘οΈ IAM Service Account Credentials API - For authentication

Steps to get GCP token: Install Google Cloud SDK Authenticate: gcloud auth login Set project: gcloud config set project YOUR_PROJECT_ID Get access token: gcloud auth print-access-token

> πŸ’‘ Note: The access token expires after 1 hour. For production use, consider using service account credentials.

πŸ”§ n8n Node Credentials Setup

LinkedIn OAuth2 API: Configure with your LinkedIn app credentials HTTP Bearer Auth (LinkedIn): Use your LinkedIn access token HTTP Bearer Auth (Google Cloud): Use your GCP access token Google Gemini API: Configure with your Google AI API key

πŸ“Š Workflow Structure

graph LR A[πŸ“ Form Trigger] --> B[πŸ—ΊοΈ Mapper] B --> C[πŸ€– AI Agent] C --> D[🎯 Normalizer] D --> E[πŸ–ΌοΈ Text to Image] E --> F[πŸ“€ Register Upload] F --> G[πŸ”„ Binary Converter] G --> H[⬆️ Upload Image] H --> I[πŸ“‹ Content Curator] I --> J[⏳ Wait] J --> K[πŸš€ Publish to LinkedIn]

🎨 Image Generation Details

The workflow uses Google Imagen 4 with these parameters: πŸ“ Aspect Ratio: 1:1 (perfect for LinkedIn) 🎯 Sample Count: 1 options generated πŸ›‘οΈ Safety Setting: Block few (content filtering) πŸ’§ Watermark: Enabled 🌍 Language: Auto-detect

πŸ“ Content Processing

The AI generates content in this JSON structure: { "post_content": { "text": "Your engaging LinkedIn post content with hashtags" }, "image_prompt": { "description": "Professional image generation prompt" } }

πŸ”„ LinkedIn API Integration

Image Upload Process: Register Upload: Creates upload session with LinkedIn Binary Upload: Uploads image as binary data Post Creation: Creates post with text and image reference

API Endpoints Used: πŸ“€ POST /v2/assets?action=registerUpload - Register image upload πŸ“ POST /v2/ugcPosts - Create LinkedIn post

⚠️ Important Notes

πŸ• Rate Limits: LinkedIn has API rate limits - monitor your usage ⏱️ Processing Time: Image generation can take 10-30 seconds πŸ”„ Token Refresh: GCP tokens expire hourly in development πŸ“ Content Length: LinkedIn posts have character limits πŸ–ΌοΈ Image Size: Generated images are optimized for LinkedIn

πŸš€ Getting Started

Import the workflow into your n8n instance Configure all credentials as described above Enable required GCP services in your project Test the form trigger with a sample topic Monitor the execution for any errors Adjust the AI prompt if needed for your content style

πŸ› οΈ Customization Options

🎨 Modify image style in the system prompt πŸ“ Adjust content tone in the AI agent configuration
πŸ”„ Change wait time between upload and publish 🎯 Add content filters for brand compliance πŸ“Š Include analytics tracking for post performance

πŸ’‘ Tips for Best Results

🎯 Be specific with your topic inputs 🏒 Use professional language for business content πŸ” Review generated content before publishing πŸ“ˆ Monitor engagement to refine your prompts πŸ”„ Test thoroughly before production use

πŸ› Troubleshooting

Common Issues: ❌ "Invalid credentials": Check token expiration ❌ "Image upload failed": Verify LinkedIn API permissions ❌ "Content generation error": Check Gemini API quota ❌ "Post creation failed": Ensure proper wait time after image upload

πŸ“š Additional Resources

πŸ“– LinkedIn Marketing API Documentation πŸ€– Google Vertex AI Imagen Documentation πŸ”§ n8n Documentation πŸš€ Google Gemini API Guide

πŸ’¬ Need Help? Join the n8n community forum or check the troubleshooting section above!

🌟 Found this useful? Give it a star and share your improvements with the community!

0
Downloads
1
Views
8.21
Quality Score
beginner
Complexity
Author:Naitik Joshi(View Original β†’)
Created:8/13/2025
Updated:11/17/2025

πŸ”’ Please log in to import templates to n8n and favorite templates

Workflow Visualization

Loading...

Preparing workflow renderer

Comments (0)

Login to post comments