Automated AI Content Creation for Daily Instagram Posts - n8n Workflow

A sophisticated n8n workflow leveraging GPT and Gemini to generate unique daily inspirational quotes, captions, hashtags, and corresponding images, delivered via email for Instagram publishing.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?


  • Social media managers and content creators needing daily content.

  • Users looking for advanced examples of how to combine multiple AI models (GPT and Gemini) within a single n8n workflow.

  • Developers interested in n8n templates for file handling and duplicate content prevention.

  • Anyone seeking a turnkey solution for generating motivational quotes automatically.

Overview

Generating consistent, high-quality content for platforms like Instagram can be time-consuming. This powerful n8n workflow solves this by fully automating the creation of daily inspirational posts. The automation ensures content uniqueness by tracking previously generated quotes in a local file. Using a combination of the OpenAI Chat Model for text generation and the Gemini model for image creation, this n8n template delivers a ready-to-post package. Every component, from the initial n8n trigger to the final email action, demonstrates how complex multi-step content pipelines can be streamlined using a single n8n node structure.

How it Works

This efficient n8n workflow operates on a scheduled basis, ensuring a new post is generated precisely when needed.


  1. Schedule Trigger: The process starts with the Schedule Trigger n8n node, running the workflow periodically based on the user's defined interval.

  2. History Check: The workflow uses the 'Read Text Files from Disk' n8n node to retrieve all previously generated quotes from a local file (/home/node/instagram_posts.txt). This history is vital for the next step.

  3. AI Text Generation: A 'Basic LLM Chain' (utilizing the powerful OpenAI Chat Model) is executed. It receives the history of previous posts and is prompted to create a new, unique inspirational quote, a suggested Instagram caption, and relevant hashtags, avoiding any duplicates listed in the input history.

  4. Data Parsing: The 'Code-Split-LangChain' n8n node uses custom JavaScript to meticulously parse the raw text output from the AI into structured JSON fields (quote, caption, hashtags).

  5. History Update: The new quote is converted to a text file using the 'Convert Quote to File' n8n node and then appended to the local history file using the 'Write Text Files from Disk' n8n node, preventing its regeneration in future runs.

  6. AI Image Generation: The 'Generate an image' n8n node, powered by the Google Gemini model, takes the newly created quote and generates a visual asset, embedding the quote text directly onto the image.

  7. Delivery: Finally, the 'Send email' n8n node compiles the final Instagram post package, attaching the generated image and including the quote, caption, and hashtags in the email body, ready for immediate use.

Installation Guide

To deploy this specialized n8n workflow template, follow these steps:


  1. Import: Copy the provided JSON and import it directly into your n8n instance.

  2. Credentials: Configure the necessary credentials:

OpenAI API: Set up your OpenAI Chat Model credentials for the text generation n8n node.
Google Gemini (PaLM) API: Configure credentials for the image generation n8n node.
* SMTP: Set up your SMTP credentials for the 'Send email' n8n node.

  1. File Setup: Create the history file on your n8n installation path, typically at /home/node/instagram_posts.txt, ensuring n8n has write permissions.

  2. Configuration: Customize the user prompt in the 'Basic LLM Chain' n8n node to adjust the content theme (e.g., self-growth) and modify the image generation prompt in the 'Generate an image' n8n node to suit your visual style.

  3. Activate: Set the desired schedule in the 'Schedule Trigger' n8n node and activate the n8n workflow.

Node Details

Schedule Trigger (n8n trigger):
Function: Starts the n8n workflow periodically.
Key Configuration: Configured to run based on a user-defined interval.
Read Text Files from Disk:
Function: Retrieves the content of the history file (/home/node/instagramposts.txt) to feed previously used quotes into the AI prompt.
Extract from Text File:
Function: Converts the raw text history into a usable JSON format, accessible as posthistory for the LLM n8n node.
OpenAI Chat Model (n8n node):
Function: Provides the language model backend (e.g., GPT-4.1-mini) for the text generation chain.
Basic LLM Chain:
Function: Executes the core AI logic, taking the post history and generating a new quote, caption, and hashtags. It uses a detailed prompt to ensure the output is structured and unique.
Code-Split-LangChain (Code n8n node):
Function: Transforms the multi-line text output from the AI into separate, structured data properties: quote, caption, and hashtags.
Convert Quote to File & Write Text Files from Disk:
Function: These sequential n8n nodes ensure the newly generated quote is saved back to the history file, maintaining the list of used content.
Generate an image (Gemini n8n node):
Function: Uses a dynamic prompt based on the newly created quote ({{ $('Code-Split-LangChain').item.json.quote}}) to generate a corresponding visual asset.
Send email:
* Function: The final action in this n8n workflow, compiling the quote, caption, hashtags, and the attached image binary into a professional email package.

Related n8n Workflows

Free

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

Passionate AI Automation, Visualization and Data Fabric Consultant | Helping to Shape the Future of Business through Innovation

Featured*