AI chatbot for Instagram DMs using ManyChat integration. Features conversation memory, customizable AI persona, and webhook-based messaging.
Build an AI-powered Instagram chatbot that integrates with ManyChat. This workflow receives messages via webhook, processes them through a customizable AI agent with ChatGPT, maintains conversation history using buffer memory, and sends responses back through ManyChat. Perfect for influencers and businesses looking to automate Instagram DM interactions while maintaining a personalized touch.
{
"id": "qww129cm4TM9N8Ru",
"meta": {
"instanceId": "038da3428bba4563b42be267feeca21b4922693db254331ac640a5c56ee7cadf"
},
"name": "Instagram ManyChat AI Bot",
"tags": [],
"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 }}"
}
]
}
},
"typeVersion": 3.3
},
{
"id": "0fb36573-d632-4403-8809-3973f9caa32a",
"name": "Local n8n memory",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
1500,
780
],
"parameters": {
"sessionKey": "={{ $('Set your system promt for AI').last().json.sessionId }}",
"sessionIdType": "customKey",
"contextWindowLength": 20
},
"typeVersion": 1.3
},
{
"id": "2f0471a7-2a84-41ce-aab1-896d5ea95ac3",
"name": "ChatGPT model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
1360,
780
],
"parameters": {
"options": {}
},
"credentials": {
"openAiApi": {
"id": "YOUR_OPENAI_CREDENTIAL_ID",
"name": "OpenAI account"
}
},
"typeVersion": 1
},
{
"id": "49abc3a3-faf9-4249-b874-908138a84aea",
"name": "Send respond",
"type": "n8n-nodes-base.respondToWebhook",
"position": [
1720,
620
],
"parameters": {
"options": {}
},
"typeVersion": 1.1
},
{
"id": "49382508-9307-4ffa-8b31-78fac3a7db10",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
320,
360
],
"parameters": {
"color": 5,
"width": 458,
"height": 448,
"content": "## Instagram AI Bot via ManyChat\n---\n### Description:\nThis template receives messages from Instagram via ManyChat, generates AI responses using ChatGPT with conversation memory, and sends them back.\n\n### Flow:\n1. Receive message from Instagram (via ManyChat webhook)\n2. Set your system prompt for AI personality\n3. Generate response with AI Agent\n4. Send response back to ManyChat\n\n---\n### Setup:\n- Create a ManyChat account and connect Instagram\n- Copy the webhook URL and paste in ManyChat custom action\n- Configure your OpenAI credentials"
},
"typeVersion": 1
},
{
"id": "5d14544c-7039-435f-a53c-615b5722bb99",
"name": "Getting message from Instagram",
"type": "n8n-nodes-base.webhook",
"position": [
900,
620
],
"webhookId": "68d3fbc9-6e49-4bdc-851c-2a532be911ab",
"parameters": {
"path": "instagram_chat",
"options": {},
"httpMethod": "POST",
"responseMode": "responseNode"
},
"typeVersion": 2
},
{
"id": "3770f558-341b-4d67-a7f0-0bb2fecf51a3",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
1320,
300
],
"parameters": {
"width": 314,
"height": 615,
"content": "## AI Block\n---\nComponents:\n- AI Agent\n- ChatGPT model\n- Memory for conversation history\n\n### Customization:\n- Choose your preferred GPT model\n- Adjust memory context window length"
},
"typeVersion": 1
},
{
"id": "cbb6c5a2-9b96-4305-afce-5ac560ae2dec",
"name": "AI Agent",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
1340,
620
],
"parameters": {
"text": "={{ $json.chatInput }}",
"options": {
"systemMessage": "={{ $json.prompt }}"
},
"promptType": "define"
},
"typeVersion": 1.7
},
{
"id": "4e28119f-b1aa-4b20-a8ed-28bd137f9627",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
820,
360
],
"parameters": {
"height": 440,
"content": "## Webhook Endpoint\n\nCopy the production URL and paste into ManyChat custom action.\n\nNo edits needed."
},
"typeVersion": 1
},
{
"id": "b18a8890-b420-4086-91c8-8edbc845c8af",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
1080,
480
],
"parameters": {
"width": 220,
"height": 320,
"content": "## Edit Prompt\n\nCustomize the AI persona and response style here."
},
"typeVersion": 1
},
{
"id": "74d4e6f5-069e-4b37-8005-8c03226b05df",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
1660,
480
],
"parameters": {
"height": 300,
"content": "## Respond Webhook\n\nNo edits needed"
},
"typeVersion": 1
},
{
"parameters": {
"content": "## Template by Harshith Vaddiparthy\n\n\n**Learn to Build AI Automations**\nMaster n8n, AI agents, and no-code automation in my comprehensive course.\n→ harshith.com/vibecode\n\n\n**Content Automation Consulting**\nI help businesses automate video creation, social media, blogs, and newsletters.\n→ harshith.com/meet\n\n\n**Connect with me**\n→ linkedin.com/in/harshith-vaddiparthy",
"height": 310,
"width": 260,
"color": 5
},
"id": "promo-sticky-note",
"name": "Sticky Note - Credits",
"type": "n8n-nodes-base.stickyNote",
"position": [
100,
360
],
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"connections": {
"AI Agent": {
"main": [
[
{
"node": "Send respond",
"type": "main",
"index": 0
}
]
]
},
"ChatGPT model": {
"ai_languageModel": [
[
{
"node": "AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Local n8n memory": {
"ai_memory": [
[
{
"node": "AI Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"Set your system promt for AI": {
"main": [
[
{
"node": "AI Agent",
"type": "main",
"index": 0
}
]
]
},
"Getting message from Instagram": {
"main": [
[
{
"node": "Set your system promt for AI",
"type": "main",
"index": 0
}
]
]
}
}
}Copy this JSON and import it into n8n via Settings → Import from File/URL → Paste JSON