Back to Catalog

AI agent for Instagram DM/inbox. Manychat + Open AI integration

Alex Hi no codeAlex Hi no code
44155 views
2/3/2026
Official Page

Automate Instagram DMs with OpenAI GPT and ManyChat

How It Works:

Once connected, GPT will automatically initiate conversations with messages from new recipients in Intagram.

Who Is This For?

This workflow is ideal for

  • marketers,
  • business owners
  • content creators

who want to automatically respond to Instagram direct messages using OpenAI GPT.

By integrating ManyChat, you can manage conversations, nurture leads, and provide instant replies at scale.

What This Workflow Does

  • Captures incoming Instagram DMs through ManyChat’s integration.
  • Processes messages with GPT to generate a relevant response.
  • Delivers instant replies back to Instagram users, creating efficient, AI-driven communication.

Setup

  1. Import the Template: Copy the n8n workflow into your workspace.
  2. OpenAI Credentials: Add your OpenAI API key in n8n so GPT can generate responses.
  3. ManyChat Account: Create (or log in to) your ManyChat account.
  4. Connect Instagram: Link your Instagram profile as a channel in ManyChat.
  5. ManyChat Custom Field: Create a custom field for storing user input or conversation context.
  6. Configure Default Reply: In ManyChat, set up the default Instagram reply flow to point to your n8n webhook.
  7. Add External Request: Create an external request step in ManyChat to send messages to n8n.
  8. Test the Flow: Send yourself a DM on Instagram to confirm the workflow triggers and GPT responds correctly.

Instructions and links:

Notion instruction

Register in ManyChat

# AI Agent for Instagram DM Inbox with OpenAI Integration

This n8n workflow provides a robust framework for building an AI agent capable of handling Instagram Direct Message (DM) inbox interactions, leveraging OpenAI's language models for intelligent responses. It's designed to be a starting point for automating customer service, engagement, or information retrieval directly within your Instagram DMs.

## What it does

This workflow sets up the foundational components for an AI agent:

1.  **Receives Webhook Input**: It listens for incoming data via a webhook, which would typically be triggered by a new Instagram DM or a message from a platform like ManyChat that forwards DM content.
2.  **Edits Fields (Set)**: Allows for initial data transformation or setting of variables based on the incoming webhook payload. This can be used to extract relevant message content, sender ID, or other metadata.
3.  **Initializes AI Agent**: Sets up an AI agent powered by LangChain, providing the core intelligence for processing messages and generating responses.
4.  **Configures OpenAI Chat Model**: Integrates with an OpenAI Chat Model (e.g., GPT-3.5, GPT-4) to understand the user's intent and generate human-like text responses.
5.  **Manages Simple Memory**: Incorporates a "Simple Memory" (Buffer Window Memory) to maintain context across a conversation, allowing the AI agent to remember previous turns in the dialogue.
6.  **Responds to Webhook**: Sends a response back to the originating system (e.g., ManyChat or Instagram API wrapper) to deliver the AI agent's generated message.

## Prerequisites/Requirements

To use this workflow, you will need:

*   **n8n Instance**: A running instance of n8n.
*   **OpenAI API Key**: An API key for OpenAI to access their chat models.
*   **Instagram Account**: An Instagram account (likely a Business or Creator account) that can receive DMs.
*   **Webhook Source**: A system capable of sending webhook requests to n8n when a new Instagram DM is received. This could be:
    *   **ManyChat**: If you're using ManyChat for Instagram automation.
    *   **Custom Integration**: A custom script or service that monitors Instagram DMs and sends data to n8n.
    *   **Instagram Graph API**: Direct integration with the Instagram Graph API (requires development).
*   **Understanding of LangChain Concepts**: Familiarity with LangChain agents and memory concepts will be beneficial for advanced customization.

## Setup/Usage

1.  **Import the Workflow**:
    *   Copy the provided JSON code.
    *   In your n8n instance, click "New" in the workflows section.
    *   Click the three dots menu (`...`) and select "Import from JSON".
    *   Paste the JSON code and click "Import".
2.  **Configure Webhook Trigger**:
    *   Open the "Webhook" node.
    *   Note down the "Webhook URL" generated by n8n. This URL will be used by your Instagram DM forwarding system (e.g., ManyChat) to send incoming messages to n8n.
    *   Set the "HTTP Method" to `POST` (or as required by your forwarding system).
3.  **Configure OpenAI Credentials**:
    *   Open the "OpenAI Chat Model" node.
    *   Select or create an OpenAI API credential. If creating a new one, you will need your OpenAI API Key.
4.  **Customize AI Agent Logic**:
    *   Open the "AI Agent" node.
    *   Configure the agent's "Tools" and "Agent Type" based on the specific tasks you want it to perform (e.g., answering FAQs, retrieving product info).
    *   Adjust the "System Message" to define the agent's persona and instructions.
5.  **Configure Simple Memory**:
    *   Open the "Simple Memory" node.
    *   Adjust the "K" value (window size) to control how many previous messages the agent remembers.
6.  **Customize "Edit Fields" (Set) Node**:
    *   Modify this node to extract and format the necessary information from the incoming webhook payload (e.g., `{{ $json.body.message.text }}`, `{{ $json.body.sender.id }}`).
7.  **Configure "Respond to Webhook" Node**:
    *   Ensure this node is configured to send the AI agent's response back in the format expected by your Instagram DM forwarding system. You'll likely map the AI agent's output to a field like `{{ $json.response }}`.
8.  **Activate the Workflow**:
    *   Once configured, activate the workflow by toggling the "Active" switch in the top right corner of the n8n editor.
9.  **Test the Integration**:
    *   Send a test DM to your Instagram account to ensure the webhook triggers correctly and the AI agent responds as expected.

This workflow provides a flexible foundation. You can expand it by adding more nodes for:
*   Conditional logic (e.g., if message contains keywords).
*   Integration with other services (e.g., Google Sheets for data lookup, CRM systems).
*   Advanced LangChain tools (e.g., search, API calls) to enhance the AI agent's capabilities.

Related Templates

Track competitor SEO keywords with Decodo + GPT-4.1-mini + Google Sheets

This workflow automates competitor keyword research using OpenAI LLM and Decodo for intelligent web scraping. Who this is for SEO specialists, content strategists, and growth marketers who want to automate keyword research and competitive intelligence. Marketing analysts managing multiple clients or websites who need consistent SEO tracking without manual data pulls. Agencies or automation engineers using Google Sheets as an SEO data dashboard for keyword monitoring and reporting. What problem this workflow solves Tracking competitor keywords manually is slow and inconsistent. Most SEO tools provide limited API access or lack contextual keyword analysis. This workflow solves that by: Automatically scraping any competitor’s webpage with Decodo. Using OpenAI GPT-4.1-mini to interpret keyword intent, density, and semantic focus. Storing structured keyword insights directly in Google Sheets for ongoing tracking and trend analysis. What this workflow does Trigger — Manually start the workflow or schedule it to run periodically. Input Setup — Define the website URL and target country (e.g., https://dev.to, france). Data Scraping (Decodo) — Fetch competitor web content and metadata. Keyword Analysis (OpenAI GPT-4.1-mini) Extract primary and secondary keywords. Identify focus topics and semantic entities. Generate a keyword density summary and SEO strength score. Recommend optimization and internal linking opportunities. Data Structuring — Clean and convert GPT output into JSON format. Data Storage (Google Sheets) — Append structured keyword data to a Google Sheet for long-term tracking. Setup Prerequisites If you are new to Decode, please signup on this link visit.decodo.com n8n account with workflow editor access Decodo API credentials OpenAI API key Google Sheets account connected via OAuth2 Make sure to install the Decodo Community node. Create a Google Sheet Add columns for: primarykeywords, seostrengthscore, keyworddensity_summary, etc. Share with your n8n Google account. Connect Credentials Add credentials for: Decodo API credentials - You need to register, login and obtain the Basic Authentication Token via Decodo Dashboard OpenAI API (for GPT-4o-mini) Google Sheets OAuth2 Configure Input Fields Edit the “Set Input Fields” node to set your target site and region. Run the Workflow Click Execute Workflow in n8n. View structured results in your connected Google Sheet. How to customize this workflow Track Multiple Competitors → Use a Google Sheet or CSV list of URLs; loop through them using the Split In Batches node. Add Language Detection → Add a Gemini or GPT node before keyword analysis to detect content language and adjust prompts. Enhance the SEO Report → Expand the GPT prompt to include backlink insights, metadata optimization, or readability checks. Integrate Visualization → Connect your Google Sheet to Looker Studio for SEO performance dashboards. Schedule Auto-Runs → Use the Cron Node to run weekly or monthly for competitor keyword refreshes. Summary This workflow automates competitor keyword research using: Decodo for intelligent web scraping OpenAI GPT-4.1-mini for keyword and SEO analysis Google Sheets for live tracking and reporting It’s a complete AI-powered SEO intelligence pipeline ideal for teams that want actionable insights on keyword gaps, optimization opportunities, and content focus trends, without relying on expensive SEO SaaS tools.

Ranjan DailataBy Ranjan Dailata
161

AI multi-agent executive team for entrepreneurs with Gemini, Perplexity and WhatsApp

This workflow is an AI-powered multi-agent system built for startup founders and small business owners who want to automate decision-making, accountability, research, and communication, all through WhatsApp. The “virtual executive team,” is designed to help small teams to work smarter. This workflow sends you market analysis, market and sales tips, It can also monitor what your competitors are doing using perplexity (Research agent) and help you stay a head, or make better decisions. And when you feeling stuck with your start-up accountability director is creative enough to break the barrier 🎯 Core Features 🧑‍💼 1. President (Super Agent) Acts as the main controller that coordinates all sub-agents. Routes messages, assigns tasks, and ensures workflow synchronization between the AI Directors. 📊 2. Sales & Marketing Director Uses SerpAPI to search for market opportunities, leads, and trends. Suggests marketing campaigns, keywords, or outreach ideas. Can analyze current engagement metrics to adjust content strategy. 🕵️‍♀️ 3. Business Research Director Powered by Perplexity AI for competitive and market analysis. Monitors competitor moves, social media engagement, and product changes. Provides concise insights to help the founder adapt and stay ahead. ⏰ 4. Accountability Director Keeps the founder and executive team on track. Sends motivational nudges, task reminders, and progress reports. Promotes consistency and discipline — key traits for early-stage success. 🗓️ 5. Executive Secretary Handles scheduling, email drafting, and reminders. Connects with Google Calendar, Gmail, and Sheets through OAuth. Automates follow-ups, meeting summaries, and notifications directly via WhatsApp. 💬 WhatsApp as the Main Interface Interact naturally with your AI team through WhatsApp Business API. All responses, updates, and summaries are delivered to your chat. Ideal for founders who want to manage operations on the go. ⚙️ How It Works Trigger: The workflow starts from a WhatsApp Trigger node (via Meta Developer Account). Routing: The President agent analyzes the incoming message and determines which Director should handle it. Processing: Marketing or sales queries go to the Sales & Marketing Director. Research questions are handled by the Business Research Director. Accountability tasks are assigned to the Accountability Director. Scheduling or communication requests are managed by the Secretary. Collaboration: Each sub-agent returns results to the President, who summarizes and sends the reply back via WhatsApp. Memory: Context is maintained between sessions, ensuring personalized and coherent communication. 🧩 Integrations Required Gemini API – for general intelligence and task reasoning Supabase- for RAG and postgres persistent memory Perplexity API – for business and competitor analysis SerpAPI – for market research and opportunity scouting Google OAuth – to connect Sheets, Calendar, and Gmail WhatsApp Business API – for message triggers and responses 🚀 Benefits Acts like a team of tireless employees available 24/7. Saves time by automating research, reminders, and communication. Enhances accountability and strategy consistency for founders. Keeps operations centralized in a simple WhatsApp interface. 🧰 Setup Steps Create API credentials for: WhatsApp (via Meta Developer Account) Gemini, Perplexity, and SerpAPI Google OAuth (Sheets, Calendar, Gmail) Create a supabase account at supabase Add the credentials in the corresponding n8n nodes. Customize the system prompts for each Director based on your startup’s needs. Activate and start interacting with your virtual executive team on WhatsApp. Use Case You are a small organisation or start-up that can not afford hiring; marketing department, research department and secretar office, then this workflow is for you 💡 Need Customization? Want to tailor it for your startup or integrate with CRM tools like Notion or HubSpot? You can easily extend the workflow or contact the creator for personalized support. Consider adjusting the system prompt to suite your business

ShadrackBy Shadrack
331

Auto-reply & create Linear tickets from Gmail with GPT-5, gotoHuman & human review

This workflow automatically classifies every new email from your linked mailbox, drafts a personalized reply, and creates Linear tickets for bugs or feature requests. It uses a human-in-the-loop with gotoHuman and continuously improves itself by learning from approved examples. How it works The workflow triggers on every new email from your linked mailbox. Self-learning Email Classifier: an AI model categorizes the email into defined categories (e.g., Bug Report, Feature Request, Sales Opportunity, etc.). It fetches previously approved classification examples from gotoHuman to refine decisions. Self-learning Email Writer: the AI drafts a reply to the email. It learns over time by using previously approved replies from gotoHuman, with per-classification context to tailor tone and style (e.g., different style for sales vs. bug reports). Human Review in gotoHuman: review the classification and the drafted reply. Drafts can be edited or retried. Approved values are used to train the self-learning agents. Send approved Reply: the approved response is sent as a reply to the email thread. Create ticket: if the classification is Bug or Feature Request, a ticket is created by another AI agent in Linear. Human Review in gotoHuman: How to set up Most importantly, install the gotoHuman node before importing this template! (Just add the node to a blank canvas before importing) Set up credentials for gotoHuman, OpenAI, your email provider (e.g. Gmail), and Linear. In gotoHuman, select and create the pre-built review template "Support email agent" or import the ID: 6fzuCJlFYJtlu9mGYcVT. Select this template in the gotoHuman node. In the "gotoHuman: Fetch approved examples" http nodes you need to add your formId. It is the ID of the review template that you just created/imported in gotoHuman. Requirements gotoHuman (human supervision, memory for self-learning) OpenAI (classification, drafting) Gmail or your preferred email provider (for email trigger+replies) Linear (ticketing) How to customize Expand or refine the categories used by the classifier. Update the prompt to reflect your own taxonomy. Filter fetched training data from gotoHuman by reviewer so the writer adapts to their personalized tone and preferences. Add more context to the AI email writer (calendar events, FAQs, product docs) to improve reply quality.

gotoHumanBy gotoHuman
353