Use this comprehensive n8n workflow to automate content generation with the jfirma1/test_model on Replicate. This n8n template includes a custom polling loop for reliable results.
Download this n8n workflow template and start using it instantly.
AI Developers & Integrators: Users who need to incorporate long-running, asynchronous AI models (like those hosted on Replicate) into their standard business processes.
n8n Power Users: Individuals looking for advanced examples of using the Code n8n node and flow control structures (If and Wait) to handle external APIs.
Content Automation Specialists: Anyone seeking reliable n8n templates for generating creative content based on prompts.
Technical Automators: Users needing a robust n8n trigger mechanism to start complex compute jobs.
Generating complex content often requires running jobs asynchronously, meaning the initial request immediately returns a status but the final output is delayed. This robust n8n workflow solves this by implementing a custom, non-blocking polling sequence tailored for the Replicate API.
Unlike simpler integrations, this n8n template ensures reliability by initiating the prediction, extracting the job ID, and then continuously checking the status every two seconds until the job succeeds. The use of the httpRequest n8n node, combined with data manipulation in the Code n8n node, provides a powerful and reusable framework for integrating any asynchronous service into your n8n environment. This structure is essential for building mission-critical automations using n8n.
This powerful n8n workflow starts with a manual n8n trigger:
Code n8n node parses this response, storing the prediction ID and the URL needed for polling.httpRequest n8n node then queries the previously extracted prediction URL to retrieve the current status of the AI job.If n8n node evaluates the status. If the status equals 'succeeded' (True branch), the job is done, and the n8n workflow proceeds to process the result. If the status is anything else (False branch), the connection loops back to the 'Wait' n8n node, restarting the polling process until completion.Code n8n node extracts the final generated content (often a URL to the asset) and formats it neatly for downstream use in your n8n workflow.To use this n8n workflow template, follow these steps:
YOURREPLICATEAPI_KEY with your actual API key from Replicate.prompt value and any other input parameters (like width, height, etc.) to match your desired generation requirements. Ensure the model version in the JSON body is correct. On clicking 'execute' (Manual Trigger): Serves as the starting n8n trigger for the entire n8n workflow, allowing manual execution for testing and configuration.
Set API Key (Set): A critical n8n node used to securely define the Replicate API key, making it accessible as an expression ($($Set API Key).item.json.replicateapikey) throughout the rest of the n8n workflow.
Create Prediction (HTTP Request): Sends the initial asynchronous POST request to the Replicate API, starting the AI generation job. It includes custom headers for authorization using the API key defined earlier.
Extract Prediction ID (Code): A custom Code n8n node crucial for reading the response from the initial prediction request. It extracts the unique predictionId and constructs the necessary polling URL for subsequent requests in the n8n workflow.
Wait (Wait): Manages flow control by pausing the n8n workflow for a set duration (2 seconds), preventing rapid-fire API requests during the polling loop.
Check Prediction Status (HTTP Request): Performs a GET request using the extracted prediction URL to check the status of the running AI job. This is the core polling step in this n8n template.
Check If Complete (If): A flow control n8n node that directs the n8n workflow logic. If the status is 'succeeded', it proceeds to the result handler; otherwise, it returns to the 'Wait' n8n node to continue polling.
Process Result (Code): The final Code n8n node that executes only upon success. It structures and extracts the finalized output, including metrics and the generated asset URL, cleaning the data for the next steps in your larger n8n workflow.
Automate content creation for social media posts using this n8n workflow. It generates images via Nano Banana, crafts tweet text with OpenAI, seeks Telegram approval, and posts to X.

Use this advanced n8n workflow to automatically source trending news, generate AI avatar videos using HeyGen, and seamlessly publish them to Instagram and TikTok using the Blotato integration.

Use this efficient n8n workflow to automatically convert RSS feed summaries into compelling video content using the HeyGen API and a virtual avatar. Explore powerful n8n templates for AI video creation.

Automate PDF invoice creation directly from Google Sheets data using this powerful n8n workflow. Perfect for small businesses needing reliable, automated PDF generation.

Generate professional, custom PDF invoices instantly using a powerful n8n workflow triggered by a webhook. Learn how this n8n template uses custom code and PDF tools for billing automation.

Building AI Agents and Automations | Growth Marketer | Entrepreneur | Book Author & Podcast Host If you need any help with Automations, feel free to reach out via linkedin: https://www.linkedin.com/in/yaronbeen/ And check out my Youtube channel: https://www.youtube.com/@YaronBeen/videos







































