Create Publish Instagram Carousel Posts with GPT 4 1 mini Img
Create & Publish Instagram Carousel Posts with GPT-4.1-mini, Imgur & Graph API Version: 2.0.0 n8n Version: 1.88.0+ Author: Unknown License: MIT Description A...
🔌 Nodes & Integrations Used (10)
📖 Implementation & Setup Guide
Create & Publish Instagram Carousel Posts with GPT-4.1-mini, Imgur & Graph API
**Version**: 2.0.0 **n8n Version**: 1.88.0+ **Author**: Unknown **License**: MIT
Description
An intelligent and modular workflow that **automatically generates**, **manages**, and **publishes** Instagram **carousel** posts, using AI for both content and images. It includes semantic memory to ensure uniqueness across posts and a scalable architecture for brand growth.
Key Features
* 🤖 **Advanced AI Carousel Content**: Generates unique multi-slide post content—titles, captions, hashtags, and strategic CTAs for each card in the carousel. * 🎨 **Automated Image Generation**: Creates high-quality visuals for every slide using OpenAI's DALL·E API. * 🧠 **Semantic Memory Search**: Checks each theme against a local vector database using OpenAI Embeddings to avoid content repetition. * 📊 **Publication Database**: Logs all generated carousel posts into Google Sheets for tracking, analytics, and audits. * 📱 **Instagram Direct Publishing**: Publishes carousel media and captions automatically through the Instagram Graph API. * 🗓️ **Scheduled & Manual Runs**: Trigger manually or schedule every 12 hours. * 🔐 **Secure Credential Management**: Uses n8n credential fields—no hardcoded API keys or tokens. * 🚀 **Flexible Prompting System**: Dynamically adapts style templates for different brands and industries.
Use Cases
- **E‑commerce Launches**: Showcase product features across multiple slides with tailored benefits and CTAs.
- **Fitness & Wellness Tips**: Educate followers with step-by-step workouts or nutrition advice in a carousel format.
- **Educational Infographics**: Present multi-part tutorials, stats, or course highlights.
- **SaaS Feature Demos**: Demonstrate software workflows or new features slide by slide.
- **Event Announcements**: Build excitement for webinars, conferences, or local meetups.
Customization Examples
* **Retail/E‑commerce**: Adjust the **Theme Generator Code Node** to include product category, price point, and seasonal focus as vector inputs. * **Health & Fitness**: Tweak the **AI Prompt Templates** to match your brand voice—e.g., friendly coach tone with bullet‑pointed workout steps. * **Education/Training**: Modify the **Semantic Memory Embeddings Node** thresholds to deepen topic variety across tutorial series. * **Tech/SaaS**: Customize the **Image Hosting HTTP Request Node** to use your company’s CDN instead of Imgur by swapping the endpoint and credential field.
Workflow Overview
#### 1. Theme Generation (Generate Theme Code Node)
* Combines random vectors (topic starter + focus + benefit) to create unique carousel themes.
#### 2. Content Creation (AI Agent Code Node)
* Sends themed prompts to OpenAI, generating slide-by-slide titles, captions, and CTAs in structured JSON.
#### 3. Semantic Memory Check (OpenAI Embeddings Node)
* Runs embeddings against past themes stored in a Postgres vector database (pgvector) to ensure novelty. * If similarity > threshold, regenerates theme.
#### 4. JSON Validation (Parse & Validate Code Node)
* Parses AI response, validates JSON schema, and handles errors gracefully to prevent workflow failures.
#### 5. Content Storage (Google Sheets Node)
* Writes carousel metadata (titles, captions, hashtags, slide count, scheduled date) to a Google Sheets spreadsheet.
#### 6. Image Generation (DALL·E Image Generation Node)
* Generates one graphic per slide at 1024×1024 resolution.
#### 7. Image Hosting (Imgur Upload HTTP Request Node)
* Uses an HTTP Request node with Imgur credential field to upload each image and retrieve public URLs.
#### 8. Instagram Publishing (Instagram Graph API Nodes)
* **Create Media Containers**: Sends batch media creation request. * **Publish Carousel**: Publishes the carousel using the list of container IDs and caption.
#### 9. Scheduling & Triggers
* **Manual Trigger**: For testing and one‑off posts. * **Cron Trigger**: Scheduled trigger every 12 hours (configurable).
Security
All sensitive values (OpenAI API key, Imgur Client ID/Secret, Instagram Access Token, Google Sheets OAuth2) must be stored in n8n’s **Credentials** panel. **Do not** hardcode keys or tokens in HTTP Request or Code nodes. Instead, reference credential fields:
* In HTTP Request nodes: select the corresponding credential under **Authentication**. * In Code nodes: access `this.getCredentials('openAI')`, `this.getCredentials('imgur')`, etc.
Instructions
- **Import the Workflow**: In n8n, go to **Workflows > Import from File** and upload the JSON.
- **Configure Credentials**:
* OpenAI API – set up in **Credentials > OpenAI API**. * Google Sheets OAuth2 – set up in **Credentials > Google Sheets OAuth2**. * Imgur – set up in **Credentials > Imgur**. * Instagram Graph API – set up in **Credentials > Instagram Graph API**. 3. **Set Placeholders**:
* Google Sheets Document ID * Instagram User ID 4. **Customize Prompts & Vectors**: Tweak Code node inputs and prompt templates as needed. 5. **Test & Activate**: Run a manual trigger, verify outputs, then enable the cron schedule.
Tags
`Social Media` `Instagram Carousel` `AI Content Generation` `OpenAI` `n8n` `Marketing Automation` `Vector Search` `Content Scheduling`
Technical Notes
* Uses pgvector in Postgres for efficient semantic similarity. * Supports extensible platforms—duplicate the publishing steps to add LinkedIn or Facebook. * Error handling ensures invalid JSON never reaches the publishing nodes.
License
This workflow is released under the MIT License.
⚡ How to import this workflow into n8n:
- Click the Direct Download JSON button above to save
Create_Publish_Instagram_Carousel_Posts_with_GPT_4_1_mini_Img.json. - Log in to your n8n Cloud or self-hosted n8n instance.
- In your workflow canvas, click the menu in top-right and select Import from File (or paste the JSON directly).
- Configure your credentials (e.g. API keys, database URLs) in the corresponding node settings.
- Click Execute Workflow to test and switch to Active!
Related AI Agents Workflows
View All in AI Agents →5 ways to process images PDFs with Gemini AI in n8n
How it works Many users have asked in the support forum about different methods to analyze images and PDF documents with Google Gemini AI in n8n. This workfl...
7 AI Sales Assistant
Production-ready n8n automation template for 7 AI Sales Assistant built by AhiXLight. Seamlessly connects Airtop Tool, Slack, Airtop with 24 configured nodes.
AAVE portfolio professional AI agent Telegram Email GPT 4o
A next-generation AI-powered DeFi health monitor that tracks wallet positions across Aave V3 using GPT-4o and LangChain. It delivers human-readable reports v...
Access control for AI agents RBAC using Airtable and Telegram
Purpose This workflow allows granular control over the access to tools connected to AI Agents (including Multi-Agent setups) using Role Based Access Control....