n8n

How to Automate Instagram DMs for Lead Response?

Turn Instagram direct messages into quick, helpful replies that match your brand voice. Ideal for creators, small shops, and marketing teams that get many DMs and need fast, consistent answers.

Incoming messages arrive through a webhook from your messaging tool to n8n. A Set node holds the system prompt so the AI knows the tone and rules. The AI Agent uses a ChatGPT model and a local memory block that remembers the last 20 messages, so replies follow the same conversation. n8n then sends the answer back to your messaging tool using a response node, which delivers it to Instagram.

You will need access to your messaging platform with a custom action or webhook, plus an OpenAI API key. Edit the prompt to fit your brand and adjust the memory window to control how much context the bot uses. Expect faster response times, more consistent replies, and the ability to handle high DM volume during launches or promos. Common uses include FAQ replies, simple sales questions, and first-touch lead qualification.

What are the key features?

  • Webhook trigger receives Instagram messages from your messaging tool
  • Set node stores a clear system prompt to guide AI tone and rules
  • ChatGPT model node lets you pick the best model for your needs
  • Local memory window keeps the last 20 messages for context
  • AI Agent combines prompt, model, and memory to craft replies
  • Respond to Webhook node returns the answer to your messaging tool
  • Session key support helps link replies to the right conversation

What are the benefits?

  • Reduce manual DM handling from hours per day to minutes
  • Automate up to 80 percent of repeat questions with consistent answers
  • Maintain a steady brand tone using a fixed system prompt
  • Handle 5 to 10 times more DM volume during busy periods
  • Connect Instagram messaging to AI without writing code
  • Improve first response time to under 10 seconds

How do you set it up?

  1. Import the template into n8n: Create a new workflow in n8n > Click the three dots menu > Select 'Import from File' > Choose the downloaded JSON file.
  2. You'll need accounts with ManyChat, Instagram and OpenAI. See the Tools Required section above for links to create accounts with these services.
  3. In the n8n credentials manager, create an OpenAI API Key credential. Get your API key from the OpenAI account dashboard under API keys. Name the credential clearly, such as OpenAI Prod.
  4. Open the ChatGPT model node and select your OpenAI credential from the Credential to connect with dropdown. Choose the model you want to use.
  5. Open the Getting message from Instagram webhook node. Copy the Production URL. Keep response mode as response node so the reply returns through the Respond node.
  6. In ManyChat, create a Custom Action that calls the n8n Production URL with HTTP POST. Send JSON fields that include chatInput for the incoming message text and sessionId for a unique user or thread id.
  7. Map the message text in ManyChat to chatInput and pass a stable sessionId, such as the user id, so memory keeps the conversation linked.
  8. Open the Set your system promt for AI node. Edit the prompt value to match your brand voice, product info, and rules for what the bot should or should not say.
  9. Open the Local n8n memory node and adjust the context window length if needed. A value near 20 keeps recent context without using too many tokens.
  10. Activate the workflow in n8n. In ManyChat, publish your flow and run a test by sending a DM from your Instagram account. Check n8n Executions to confirm the request and the returned response.
  11. Troubleshooting: If ManyChat shows an error, verify the Respond to Webhook node is connected and returns a 200 status. If replies look off, refine the system prompt or reduce the memory window. If no text returns, confirm chatInput and sessionId field names match what the AI Agent expects.

Tools Required

$24 / mo or $20 / mo billed annually to use n8n in the cloud. However, the local or self-hosted n8n Community Edition is free.

Instagram

Sign up

Free: $0 (no published pricing; API access available at no charge, subject to rate limits)

ManyChat

Sign up

Pro (Marketing Automation): starts at $15 / mo; API key and External Request are Pro features

OpenAI

Sign up

Pay-as-you-go: GPT-5 at $1.25 per 1M input tokens and $10 per 1M output tokens

Similar Templates

Join Futurise to access 1,200+ automation templates

Get instant access to ready-made automation workflows for n8n, Make.com, AI agents, and more. Download, customise, and deploy in minutes.