AI Image Generation and Multi-Platform Publishing using Replicate Flux - n8n Workflow

Automate high-quality image generation via Replicate's Flux models (e.g., flux-1.1-pro) and instantly publish the results to WordPress and X (Twitter) using this powerful n8n workflow. Ideal for content marketers.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Content Marketing Teams needing automated visual asset creation.
Bloggers or publishers using WordPress who require prompt-to-publish image automation.
Developers looking for a robust example of a chain of Replicate and HTTP Request n8n nodes.
Users seeking advanced n8n templates for generative AI distribution.

Overview

Generating visual content for blogs and social media is time-consuming. This specific n8n workflow addresses this bottleneck by automating the entire process: from prompt input to simultaneous publication across multiple platforms.

It leverages Replicate, accessing high-performance models like Flux, to generate images based on dynamic input variables. After the image is generated, the workflow uses multiple HTTP Request n8n node instances to download the binary data, upload it to the WordPress media library, and publish it as a media asset on X (Twitter). This provides a significant efficiency gain, making this n8n template invaluable for high-volume content operations. The execution is typically handled by an external n8n trigger from another primary workflow, ensuring seamless integration.

How it Works

This advanced n8n workflow is designed to be executed via an external n8n trigger, passing necessary parameters like the image prompt, a descriptive slug, and the desired Replicate model (e.g., black-forest-labs/flux-1.1-pro).


  1. Input Configuration: The Code n8n node maps the input parameters (prompt, slug, model) to the specific JSON configuration required by the chosen Flux model on Replicate. This ensures optimal settings like aspect ratio and inference steps are used.

  2. Generation Request: An HTTP Request n8n node sends a non-blocking POST request to the Replicate API to initiate the image generation process.

  3. Image Retrieval: A subsequent HTTP Request n8n node downloads the actual binary image data using the resulting URL provided by the Replicate API response.

  4. Parallel Distribution: The workflow splits, using two specialized n8n nodes:

One HTTP Request n8n node uploads the image binary to the WordPress media library, utilizing the input slug for a clean filename.
A second HTTP Request n8n node, the Upload Media (X) node, handles the necessary OAuth authentication to upload the image to the X (Twitter) media endpoint.

  1. Final Output: The results from both upload streams are aggregated using Merge and Aggregate n8n nodes. A final Code n8n node structures the output, providing the public image URLs and confirming the data structures from both publishing platforms. This completes the full automated cycle driven by this powerful n8n workflow.

Installation Guide

To deploy this automated n8n workflow, follow these steps:


  1. Import the n8n Workflow: Copy the provided JSON data and paste it directly into your n8n instance using the 'Import from JSON' option.

  2. Replicate Credentials: Configure the credentials for the HTTP Request1 node (Replicate API Key). This usually involves setting up a generic HTTP Header Auth credential with your Replicate API token.

  3. WordPress Credentials: Set up a 'WordPress API' credential linked to the 'Upload image2' n8n node, ensuring it has permission to upload media.

  4. X (Twitter) Credentials: Set up a 'Twitter OAuth1 API' credential for the 'Upload Media (X)' n8n node, granting media upload permissions.

  5. Test: Use the 'When clicking ‘Execute workflow’' n8n trigger node to manually test the process, providing sample inputs for the prompt, slug, and model to ensure the image generation and subsequent uploads function correctly. This n8n template relies heavily on accurate credentials for external services.

Node Details

When Executed by Another Workflow (n8n trigger): The primary entry point. It requires external inputs: prompt, slug, and model to define the AI generation task.
Code1 (n8n node): Essential logic gate. It dynamically configures the request payload (modelconfig) based on the input model (e.g., setting aspectratio: "16:9" for the Flux models).
HTTP Request1 (Replicate Generation): Sends the generation request to Replicate. Uses header authentication and passes the configured JSON body from the previous n8n node.
HTTP Request2 (Image Retrieval): Downloads the resulting image file using the output URL provided by the Replicate generation job. This converts the external URL into binary data within the n8n workflow.
Upload image2 (WordPress HTTP Request n8n node): Uploads the binary image data to the specified WordPress media endpoint. Key configuration: Content-Disposition header dynamically sets the filename using the input slug (img-{{ $('Code1').item.json.slug }}.jpg).
Upload Media (X) (Twitter/X n8n node): Handles the simultaneous upload of the binary image to Twitter/X's media API using OAuth1 credentials.


  • Code (Final Output n8n node): Cleans and structures the final output, providing centralized links (publicimageurl) and specific platform response data for the calling workflow.

Related n8n Workflows

Free

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

AI and Automation developer. Im implementing n8n and ai tools to automate marketing and sales in companies

Featured*