AI-Powered Social Content Generation and Multi-Platform Publishing - n8n Workflow

Automate your marketing with this powerful n8n workflow. Use Google Gemini and Kie.ai to generate optimized content and publish it instantly via Late API across Facebook, Instagram, LinkedIn, and TikTok.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Marketing professionals and teams needing scalable content production.
Small businesses looking for advanced social media automation solutions using n8n.
Agencies leveraging AI models (Gemini, Kie.ai) for multi-channel content delivery.
Users seeking comprehensive n8n templates for complex publishing logic.

Overview

This sophisticated n8n workflow solves the challenge of creating platform-optimized content and media efficiently. Instead of manually drafting content for four separate channels, this solution leverages Google Gemini 2.5 to craft tailored captions for Facebook, Instagram, LinkedIn, and TikTok from a single prompt. Simultaneously, the Kie.ai image generation service creates a corresponding visual asset. The n8n workflow handles the technical complexities of media uploading (including handling large files > 4MB) via the Late API before conditionally publishing the posts to the enabled social media accounts. This entire n8n workflow significantly reduces the time spent on content creation and distribution, making it an essential tool for high-volume social media management.

How it Works


  1. Start and Configuration: The n8n trigger starts the process (manual execution). The Default Settings n8n node defines the business type, content topic, and enables/disables specific platforms (Facebook, Instagram, LinkedIn, TikTok).

  2. Content Generation (AI Text): The Gemini - Generate Content n8n node uses the input variables to prompt Google Gemini 2.5 Flash, generating optimized text and relevant hashtags for all four target platforms in a structured JSON output.

  3. Image Generation (AI Image): The workflow initiates an image creation task with Kie.ai using the Seedream model. After a Wait 30s period to allow processing, the next n8n node retrieves the CDN URL of the completed image.

  4. Media Upload Logic: The system checks the image file size using an HTTP Request for content-length headers. An IF n8n node determines the upload path: files ≤ 4MB are uploaded directly to the Late API; larger files follow a multipart flow, involving initialization with Late API, binary download, and a final PUT request to a dedicated upload URL.

  5. Publishing: The generated text content and the uploaded media URL are combined. The workflow then routes the execution through conditional branches (using IF n8n nodes) to ensure posts are only created for platforms that were explicitly enabled.

  6. Post Creation: The respective Late Create Post n8n node sends the content, hashtags, and Late API media URL for immediate publication on the chosen social media account.

  7. Final Logging: The Merge n8n node collects all successful post responses, and the Success Notification & Logging code prepares a structured message detailing the results.

Installation Guide

To deploy this powerful n8n templates solution, follow these steps:


  1. Import the n8n workflow: Copy the provided JSON data and paste it directly into your n8n instance's workflow designer using the 'New' -> 'Import from JSON' option.

  2. Configure Credentials: This n8n workflow requires three main credentials:

Google Gemini (PaLM/Bearer): Used in the Gemini - Generate Content n8n node for text generation.
Kie.ai (HTTP Bearer): Used in the Kie.ai n8n nodes for image generation.
Late API (HTTP Bearer): Used across all LATE n8n nodes for media handling and posting.

  1. Set Defaults: Update the Default Settings n8n node with your specific BUSINESSTYPE and CONTENTTOPIC. Crucially, insert the correct ACCOUNTID values for the platforms you have enabled (Facebook, Instagram, LinkedIn, TikTok). These IDs are obtained from your Late API dashboard.

  2. Test: Click the "Execute Workflow" n8n trigger to run a test and verify successful content generation and posting.

Node Details

Manual Trigger: The starting n8n trigger point for the execution of this n8n workflow.
Default Settings (Set): Defines workflow constants, including the content topic, business type, and the booleans used by the Check Enabled Platforms n8n node to control flow.
Gemini - Generate Content (HTTP Request): A key n8n node that calls the Google Gemini API (gemini-2.5-flash) to generate platform-specific, optimized captions and relevant hashtags.
Parse & Filter Platforms (Code): Custom JavaScript n8n node that safely parses the complex JSON output from Gemini and filters the data to only include enabled social channels.
Kie.ai - Generate Image (HTTP Request): Sends a prompt derived from the content topic to Kie.ai to initiate the generation of a square image.
IF – „Is Large?” (If): A critical flow control n8n node that branches the media upload based on the file's Content-Length header (4MB threshold) to manage file size limits imposed by Late API.
LATE – Init Upload files > 4MB (HTTP Request): Initiates the multipart upload sequence for large files, obtaining a necessary signed storage URL.
Late Create Post (HTTP Request): Multiple instances of this core n8n node handle the final publication step, using the Late API to publish the combined content and the media URL immediately to the selected social platform.


  • Success Notification & Logging (Code): Collects all successful post responses via the preceding Merge n8n node and formats them into a structured success message, ready for downstream notifications.

Related n8n Workflows

Free

Nodes: 9 Nodes
Updated: December 26 2025
View all
Created by

Founder @RoboMarketing I help businesses automate communication with chatbots and AI. Focused on WhatsApp, Messenger, Instagram, and website automation. Writing about practical automation strategies, AI tools, and conversational design. Passionate about building smart systems that save time and increase efficiency.

Featured*