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
- 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
- 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!
Related Templates
Generate Product Ad Copy & CTAs with GPT-4 for Slack and Airtable
β‘ AI Copywriter Pro: Instant Ad Copy & CTA Generator Transform product details into compelling marketing copy in second...
Instagram Full Profile Scraper with Apify and Google Sheets
πΈ Instagram Full Profile Scraper with Apify and Google Sheets This n8n workflow automates the process of scraping ful...
Compare Lists and Identify Common Items & Differences Using Custom Keys
This workflow compares two lists of objects (List A and List B) using a user-specified key (e.g. email, id, domain) and ...
π Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments