Instagram AI Chatbot with ManyChat and ChatGPT
This workflow turns your Instagram into an AI-powered customer support or engagement bot. It receives incoming messages from your Instagram page via the ManyChat no-code platform, processes each message through OpenAI’s ChatGPT with a customized system prompt, and sends the AI-generated reply back to ManyChat—which then posts it as a direct message on Instagram. The chatbot also maintains a short-term conversation memory (last 20 messages) to keep responses context-aware. This is ideal for automating common Q&A, providing instant replies, or giving a brand a unique personality on Instagram without needing to code a full backend.
Node Breakdown
- Getting message from Instagram (Webhook) — No auth. Listens for POST requests on the path
instagram_chat. Configured to use theresponseNodemoode, meaning the workflow will send a responce using the Send respond node. - Set your system promt for AI (Set) — No auth. Extracts
session_idandtextfrom the incoming webhook body and stores a hardcoded system prompt (persona, context, style rules) in thepromptvariable. - AI Agent (LangChain Agent) — No auth. Takes the
chatInput(user message) and the system prompt. It uses the connected ChatGPT language model and the memory node to generate a reply. - ChatGPT model (OpenAI Chat Model) — API Key auth. Requires an OpenAI API key configured in n8n credentials. Sends the conversation to OpenAI’s chat completion endpoint.
- Local n8n memory (Buffer Window Memory) — No auth. Injects a conversation history into the AI Agent using the
sessionKeyfrom the Set node. Current window is 20 messages. - Send respond (Respond to Webhook) — No auth. Takes the output of the AI Agent and sends it as the HTTP response back to ManyChat.
- Sticky Notes – Informational. No configuration needed.
Setup Instructions
To use this workflow you need:
- A ManyChat account (free plan works). ManyChat will send Instagram message data to the webhook URL.
- An OpenAI API key. Add it in n8n as a credential (type “OpenAI”).
- n8n (self-hosted or cloud).
Steps:
- Import this workflow into your n8n instance.
- Configure the ChatGPT model node: select your OpenAI credential.
- Copy the webhook URL from the Getting message from Instagram node (e.g.,
https://your-n8n-domain/webhook/instagram_chat). - In ManyChat, create a Custom Action that triggers on an incoming Instagram message. Paste the webhook URL as the endpoint, method POST. ManyChat will send the user’s message and session ID in the body.
- (Optional) Edit the system prompt inside the Set your system promt for AI node to match your brand voice.
- Activate the workflow.
Use Cases & Variations
- Customer Support FAQ – Replace the system prompt with a knowledge base instructing ChatGPT to answer only from provided FAQ.
- Lead Capture – Modify the workflow to log questions to a Google Sheet before replying.
- Multi-Language Support – Instruct the bot to detect language and reply in the same language.
- Different AI Models – Swap the ChatGPT node for another LangChain model (e.g., Anthropic, Google Gemini) by changing the credentials.
- Extended Memory – Increase
contextWindowLengthin the memory node to keep longer conversations.
This template is a lightweight entry point for building a custom Instagram chatbot with AI smarts.
Workflow JSON
{
"id": "qww129cm4TM9N8Ru",
"meta": {
"instanceId": "038da3428bba4563b42be267feeca21b4922693db254331ac640a5c56ee7cadf",
"templateCredsSetupCompleted": true
},
"name": "InstaTest",
"tags": [
{
"id": "8PlqXsDyqVlHJ7RC",
"name": "AI",
"createdAt": "2024-07-10T14:12:10.657Z",
"updatedAt": "2024-07-10T14:12:10.657Z"
}
],
"nodes": [
{
"id": "51dcaa84-d1f9-4abc-aebc-24a06801e42d",
"name": "Set your system promt for AI",
"type": "n8n-nodes-base.set",
"notes": "In this node in \"prompt\" variable you can set your system prompt",
"position": [
1120,
620
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "0b3c3d71-5627-4b8c-91f0-ac44eaedf196",
"name": "prompt",
"type": "string",
"value": "=Persona: You are a instagram influencer.\nContext: You receive a messages from your subscribers\nTask: Answer questions in your writing style and patterns according to your previous posts text. Use your post only for style and patterns reference.\nStyle rules:\nsimple answers"
},
{
"id": "c2a9e272-5c0d-4685-ad0e-ce6995f92a1c",
"name": "sessionId",
"type": "string",
"value": "={{ $json.body.session_id }}"
},
{
"id": "b3c20ee3-07a1-4584-b0d9-7310a2c6b723",
"name": "chatInput",
"type": "string",
"value": "={{ $json.body.text }}"
}
]
}
},
// ... truncated (copy to see full JSON)How to Import This Workflow
- 1Copy the workflow JSON above using the Copy Workflow JSON button.
- 2Open your n8n instance and go to Workflows.
- 3Click Import from JSON and paste the copied workflow.
Don't have an n8n instance? Start your free trial at n8nautomation.cloud
Related Templates
AI Viral Video Creator from Telegram with Voice & Multi-Platform Posting
🚀 Automatically Generate and Publish Viral TikTok-Style Videos from a Simple Telegram Message This workflow transforms a single Telegram message containing a photo and a theme (caption) into a fully-produced, AI-generated talking-head video optimized for viral social media content. It leverages Perplexity for trend research, OpenAI GPT-4 for script and caption generation, ElevenLabs for realistic voice synthesis, and FAL.ai's VEED Fabric model to create a lip-synced avatar video from the photo. The final video, along with an engaging caption and relevant hashtags, is saved to Google Sheets for tracking and then automatically published to up to nine social media platforms—TikTok, YouTube, Instagram, LinkedIn, Facebook, Twitter (X), Threads, Pinterest, and Bluesky—via the Blotato integration. This is an end-to-end content creation pipeline perfect for creators, marketers, and businesses who want to maintain a consistent, high-frequency posting schedule without manual video editing. It reduces the time from idea to published video to under 5 minutes. 📋 Node-by-Node Breakdown Telegram Trigger (Telegram Bot Token) — Listens for incoming messages containing a photo and caption. The trigger activates on updates. No additional filtering is applied; every photo with a caption will start the workflow. Workflow Configuration (No auth) — A static Set node that stores API keys and configuration values (ElevenLabs API key, voice ID, FAL API key, and the Perplexity model name) as workflow variables for easy maintenance. Extract Photo and Theme (No auth) — Extracts the largest photo file ID from the Telegram message and the caption (or text) as the theme. Falls back to "viral content" if no caption is provided. Get Photo File from Telegram (Telegram Bot Token) — Uses the Telegram Bot API to download the photo file specified by the file ID extracted in the previous step. Build Public Image URL (No auth) — Uploads the downloaded photo to to obtain a publicly accessible URL. This URL is later used by FAL.ai's VEED Fabric model. Search Trends with Perplexity (Perplexity API key) — Sends a query to Perplexity AI asking for the top 3 current viral trends related to the user's theme. The model is configured dynamically from the workflow configuration node. Generate Script with GPT-4 (OpenAI API key) — Uses OpenAI GPT-4o-mini to generate a 30-second TikTok script based on the trends found by Perplexity and the original theme. The prompt enforces a hook in the first 2 seconds and conversational tone. ElevenLabs Voice Synthesis (API key in header) — Sends the generated script to ElevenLabs' text-to-speech API with the configured voice ID, producing an MP3 audio file. Uses header for authentication. Convert .mpga to .mp3 (No auth) — A JavaScript Code node that renames the binary audio file from to and sets the correct MIME type, ensuring compatibility with downstream nodes. Upload Audio to Public URL (No auth) — Uploads the MP3 audio to to make it publicly accessible for FAL.ai. FAL.ai Video Generation (API key in header) — Sends a request to FAL.ai's VEED Fabric 1.0 endpoint with the public image URL and audio URL to generate a talking-head lip-sync video at 480p resolution. Authentication uses the header with the FAL API key. Wait for VEED (No auth) — A Wait node that pauses execution for 10 minutes to allow the video generation to complete. The node uses polling via webhook (not active here) but is configured as a timed wait. Download VEED Video (API key in header) — Periodically queries the FAL.ai request status endpoint (using the request ID from the generation response) to retrieve the completed video URL. Generate Caption with GPT-4 (OpenAI API key) — A second OpenAI node that creates an engaging TikTok caption with trending hashtags based on the same theme and trends. Outputs only the caption text. Save to Google Sheets (Google Sheets OAuth2) — Appends a new row to a Google Sheet with columns: IDEA (original theme), CAPTION, AUDIO URL, IMAGE URL, VIDEO URL. The sheet and document ID are expected to be configured via resource locator or expression. Send a video (Telegram Bot Token) — Sends the generated video back to the original Telegram chat as a confirmation. Upload Video to BLOTATO (Blotato API key) — Uploads the video file to Blotato's media storage, obtaining a hosted URL for distribution. TikTok / YouTube / LinkedIn / Facebook / Instagram / Twitter (X) / Threads / Bluesky / Pinterest (Blotato API key) — Nine parallel Blotato nodes that each publish the video to their respective social media accounts. Each node uses pre-configured account IDs (list mode) and the generated caption. YouTube optionally sets the video to "private" and disables subscriber notifications. Merge1 (No auth) — A Choose Branch merge node that waits for all nine social media publishing branches to complete before continuing. Update Status to "DONE" (Google Sheets OAuth2) — Updates the corresponding row in the Google Sheet (matched by video URL) to set the STATUS column to "DONE". 🔧 Setup Instructions To use this workflow, you'll need the following accounts and API keys: Telegram — Create a bot via @BotFather and get the bot token. Use it in the Telegram Trigger and Telegram nodes. ElevenLabs — Sign up at elevenlabs.io, generate an API key, and clone or select a voice. Note the Voice ID. FAL.ai — Sign up at fal.ai, create an API key from the dashboard. The workflow uses the VEED Fabric 1.0 model – no separate VEED subscription is needed. Perplexity AI — Sign up at perplexity.ai, get an API key from settings. OpenAI — Sign up at platform.openai.com, create an API key with access to GPT-4o-mini. Google Sheets — Create a Google Sheet with the required columns (IDEA, URL IMAGE, URL AUDIO, URL VIDEO, CAPTION, STATUS). Set up Google Sheets OAuth2 credentials in n8n. Blotato — Sign up at blotato.com, get an API key from settings. Install the community node in n8n (Settings → Community Nodes). Connect each social media account within Blotato to obtain account IDs. tmpfiles.org — No account required; the service is used for temporary file hosting. After obtaining all keys, update the Workflow Configuration node with your values and configure credentials for each API node (Telegram, Perplexity, OpenAI, Google Sheets, Blotato). The sticky notes in the canvas provide step-by-step visual guidance. 💡 Use Cases & Variations Content Repurposing: The workflow can be adapted to repurpose a blog post or article into a short video by feeding the text as a theme. Brand Voice: Customize the ElevenLabs voice to match your brand's tone. Trend-Driven Campaigns: Use Perplexity with different prompts to focus on niche topics (e.g., "tech startups", "healthy recipes"). Platform-Specific Formatting: Modify the caption generation prompt to include platform-specific elements (e.g., LinkedIn professional tone, Twitter character limit). Scheduling: Add a Schedule Trigger to run the workflow periodically with pre-defined themes from a spreadsheet instead of Telegram. Analytics: Extend the Google Sheet with additional columns for engagement metrics by integrating with social media analytics APIs. This workflow is fully modular; you can remove any of the Blotato publishing nodes if you only need specific platforms.
AI-Powered Social Media Post Automation from Google Trends
AI-Powered Social Media Post Automation from Google Trends This workflow automatically generates and publishes social media posts based on trending Google search queries. It combines Google Trends data, AI content generation, and multi-platform publishing to keep your social channels active with relevant, engaging content without manual effort. The workflow runs twice daily (at 6 AM and 6 PM) and follows a pipeline: fetch trending keywords → select the best topic → generate a human-like post using Perplexity AI → publish to X (Twitter), Facebook, and LinkedIn → log the activity in Google Sheets. This is ideal for marketers, social media managers, and content creators who want to maintain a consistent posting schedule with minimal intervention. How It Works Schedule Trigger — Runs the workflow twice daily at 6 AM and 6 PM (no auth required). Google Trends (HTTP Request) — Fetches related queries from Google Trends via SerpAPI. Uses API Key auth (the parameter is passed as a query parameter). It retrieves rising queries for the keyword "ai agents" in the US over the last 3 days. 2 Most Trending (Set) — Extracts the top two rising queries from the Google Trends response and structures them into a clean JSON object with and keys. High search volume keywords (Code) — Filters the top related queries to include only those with an extracted value (search volume increase) greater than 30, and joins them into a comma-separated string. Choosing Topic (OpenAI) — Uses GPT-3.5-turbo to select the most relevant keyword from the two trending options, based on the client's SEO goals and trendiness. Requires OpenAI API key. Research Topic- Perplexity (HTTP Request) — Sends the chosen topic to Perplexity's API (sonar-pro model) to generate a complete LinkedIn post. Uses Header Auth (HTTP Header Auth) with your Perplexity API key. The prompt instructs the AI to write a human-like, engaging post with Unicode formatting, bullet points, and a call-to-action. Wait — Pauses for 10 seconds to ensure the AI generation is complete and to avoid rate limits. Split Out — Splits the AI-generated content from the Perplexity response into separate items for each social platform. X1 (Twitter) — Publishes the post to X (Twitter) using OAuth2 authentication. Facebook Graph API1 — Publishes the post to a Facebook Page using OAuth2 authentication. LinkedIn1 — Publishes the post to LinkedIn using Community Management authentication (OAuth2). Google Sheets2 — Appends or updates a row in Google Sheets with the topic, AI output, status, and date posted. Uses OAuth2 authentication. Setup Instructions To use this workflow, you'll need accounts and credentials for the following services: SerpAPI — Sign up at serpapi.com and get an API key. Replace in the Google Trends node. OpenAI — Create an API key at platform.openai.com. Add it as a credential in n8n. Perplexity — Get an API key from perplexity.ai and set it as an HTTP Header Auth credential. X (Twitter) — Create a Twitter app and obtain OAuth2 credentials. Facebook — Create a Facebook app and get a Page Access Token with permission. LinkedIn — Create a LinkedIn app and get a Community Management token. Google Sheets — Create a Google Cloud project, enable Sheets API, and set up OAuth2 credentials. Replace the document ID and sheet name in the Google Sheets node. After setting up credentials, update the Google Sheets document ID and sheet name, and configure the LinkedIn person ID (replace ). Use Cases and Variations Content Marketing — Automate daily posting of trending topics to multiple platforms, saving hours of manual research and writing. SEO Blogging — Modify the workflow to generate full blog posts instead of social media posts and publish to a CMS like WordPress. Multi-Client Management — Adapt the workflow to handle multiple clients by adding a loop or using a different Google Sheets row for each client. Custom Keywords — Change the parameter in the Google Trends node to target different niches or industries. Additional Platforms — Add more social media nodes (e.g., Instagram, Pinterest) by connecting them to the Split Out node. Human Review — Insert a manual approval step (e.g., using the Wait node or a Slack notification) before publishing to ensure content quality.
Low Cost AI Videos with Veo3 Fast for YouTube/TikTok
AI Video Generation & Social Media Upload Workflow This workflow automates the process of generating AI-powered videos using Google's Veo3 Fast model, saving them to Google Drive, generating SEO-optimized titles with GPT-4o, and automatically uploading them to YouTube and TikTok. It's designed for content creators, marketers, and social media managers who want to streamline their video production pipeline from a single Google Sheet interface. The workflow is triggered by a Google Sheet that acts as a central command center. You simply add your video prompts and desired durations to the sheet, and the workflow handles everything else — from video generation to multi-platform publishing. This eliminates manual downloading, renaming, and uploading steps, saving hours of repetitive work. Node-by-Node Breakdown When clicking 'Test workflow' (Manual Trigger) — No auth. Starts the workflow manually for testing purposes. Useful for initial setup and debugging. Schedule Trigger — No auth. Runs the workflow on a recurring schedule. Currently configured to run every 5 minutes (interval-based on minutes). Get new video (Google Sheets) — OAuth2 (Google). Reads rows from a Google Sheet where the "VIDEO" column is empty, indicating new video requests. The sheet must have columns: PROMPT, DURATION, VIDEO, YOUTUBEURL, and rownumber. Set data (Set) — No auth. Combines the PROMPT and DURATION fields from the sheet into a single prompt string that will be sent to the AI video generation API. Create Video (HTTP Request) — Header Auth (Authorization: Key YOURAPIKEY). Sends a POST request to the Veo3 Fast API endpoint () with the combined prompt as JSON body. Returns a for polling. Wait 60 sec. (Wait) — No auth. Pauses execution for 60 seconds to allow the video generation to complete before checking status. Get status (HTTP Request) — Header Auth (same as above). Polls the Veo3 Fast API status endpoint using the from step 5 to check if video generation is complete. Completed? (IF) — No auth. Checks if the status returned is "COMPLETED". If yes, proceeds to fetch the video URL. If not, loops back to wait another 60 seconds and check again. Get Url Video (HTTP Request) — Header Auth (same as above). Once completed, fetches the full video details including the download URL from the Veo3 API. Generate title (OpenAI) — API Key auth (OpenAI). Uses GPT-4o-mini to generate an SEO-optimized YouTube title (max 60 characters) based on the original prompt. The AI is instructed to match the language of the input and output only the title. Get File Video (HTTP Request) — No auth. Downloads the actual video file from the URL provided by Veo3. This binary data is used for uploading. Upload Video (Google Drive) — OAuth2 (Google). Uploads the downloaded video file to a specified Google Drive folder (named with timestamp + original filename). Update result (Google Sheets) — OAuth2 (Google). Updates the original Google Sheet row with the video URL from Veo3 in the "VIDEO" column. HTTP Request (Upload to YouTube) — Header Auth (Authorization: Apikey YOURAPIKEY). Uploads the video to YouTube via the Upload-Post API. Sends multipart form data including the title (from GPT-4o), username, platform (youtube), and the video binary. Update Youtube URL (Google Sheets) — OAuth2 (Google). Updates the same Google Sheet row with the YouTube video URL in the "YOUTUBE_URL" column. Upload on TikTok (HTTP Request) — Header Auth (same as Upload-Post). Uploads the same video to TikTok via the Upload-Post API, using the same title and username but with platform set to "tiktok". Setup Instructions Google Services: You need a Google Cloud project with the Sheets API and Drive API enabled. Create OAuth2 credentials and connect them in n8n. Fal.ai Account: Sign up at fal.ai to get an API key. In the HTTP Request nodes (Create Video, Get status, Get Url Video), set Header Auth with Name: and Value: . OpenAI Account: Get an API key from OpenAI. Connect it in the Generate title node. Upload-Post Account: Sign up at Upload-Post (free plan includes 10 uploads/month). Get your API key from Manage API Keys. Set Header Auth with Name: and Value: . Create a profile and use its username in the field. Google Sheet: Create a copy of this template. Add your prompts and durations. Leave the VIDEO and YOUTUBE_URL columns empty. Use Cases & Variations Content Repurposing: Modify the workflow to generate videos from blog posts or articles by adding an HTTP Request node to fetch content first. Multi-Language Support: The GPT-4o prompt already generates titles in the same language as the input. You can extend this to translate prompts before video generation. Additional Platforms: Add more HTTP Request nodes to upload to Instagram, Facebook, or LinkedIn using the same Upload-Post API (just change the parameter). Scheduling: Instead of running every 5 minutes, you could trigger the workflow via webhook from a form submission (e.g., Typeform or Google Forms). Thumbnail Generation: Add a node to generate video thumbnails using DALL-E or another image generation API before uploading. Analytics Tracking: After upload, add nodes to fetch video analytics from YouTube API and log them back to the Google Sheet.