How to Use n8n with ._Template 63 Instagram Dm Keyword Autoresponse

Your Instagram DMs are a lead channel disguised as a chore. Someone comments "PRICE" under your reel, or DMs "LINK" after seeing your story, and you have maybe 15 minutes before that intent evaporates

How to Use n8n with ._Template 63 Instagram Dm Keyword Autoresponse

Your Instagram DMs are a lead channel disguised as a chore. Someone comments "PRICE" under your reel, or DMs "LINK" after seeing your story, and you have maybe 15 minutes before that intent evaporates. Do it manually and you either burn hours babysitting a phone or you lose the sale to slow response time. The fix is a keyword-triggered autoresponder: when a DM contains a specific word, the right message fires back instantly — with the link, the price, the booking form, whatever converts. This walks through building exactly that with n8n and the ._Template 63 Instagram DM Keyword Autoresponse workflow, including the specific nodes, credentials, and edge cases that break real deployments.

The Problem: Intent Has a Shelf Life

Instagram's DM funnel is high-intent but latency-sensitive. Meta's own creator data consistently shows that reply speed correlates with conversion — a DM answered in under a minute converts far better than one answered an hour later. For a founder or a two-person ops team, that window is impossible to hold manually. You are asleep, in a meeting, or heads-down on product, and the "how much is this?" DM sits unread.

The naive workarounds all fail at scale. Instagram's built-in "Saved Replies" require you to be in the app, tapping. Third-party SaaS tools (ManyChat and friends) work but lock your logic inside their UI, charge per contact, and give you no ownership of the data or the branching logic. What you actually want is a system that listens to every incoming DM, checks it against a keyword list you control, and responds programmatically — while writing every interaction to a store you own. That is a workflow problem, and n8n is built for exactly this.

The Solution: A Keyword Router on the Instagram Graph API

The ._Template 63 workflow is a listener-plus-router. At a high level it does four things: receives the inbound message event from Meta, extracts the message text, matches that text against a keyword dictionary, and sends the mapped reply back through the Instagram Send API. Everything runs on your own n8n instance, so the keyword-to-response mapping, the logging, and any downstream actions (tag a CRM, notify Slack, add to a nurture sequence) are yours to extend.

The critical dependency: this requires an Instagram Professional (Business or Creator) account connected to a Facebook Page, plus a Meta App with the instagram_manage_messages and pages_messaging permissions. DMs on Instagram flow through the Messenger Platform's webhook and Send API — you are not scraping the app, you are using Meta's official messaging endpoints. That distinction is what keeps the account safe from bans.

Step-by-Step Setup in n8n

1. Configure the Webhook trigger. Start the workflow with a Webhook node set to POST. Copy its production URL — this is what you register with Meta. In the Meta App dashboard, under Webhooks, subscribe your Instagram/Page to the messages field and paste the n8n URL as the callback. Meta first sends a GET verification challenge, so add a second Webhook node (method GET) or handle the hub.challenge query param and echo it back with a Respond to Webhook node. Until that handshake returns 200 with the challenge string, Meta won't deliver events.

2. Parse the incoming event. Meta's payload is nested. Add a Set node (or a small Code node) to pull out the fields you need:

senderId = {{ $json.body.entry[0].messaging[0].sender.id }}
messageText = {{ $json.body.entry[0].messaging[0].message.text }}

Use a Code node here if you want to defensively lowercase and trim the text — return [{ json: { senderId: ..., text: (msg || '').toLowerCase().trim() } }] — because keyword matching against raw, mixed-case input is the number-one reason these workflows silently miss.

3. Match the keyword. Use a Switch node (or an IF node for a single keyword). Set the mode to expression and route on whether text contains each keyword. For example, output 0 fires when {{ $json.text.includes('price') }}, output 1 for 'link', output 2 for 'book'. Add a fallback output for unmatched messages so nothing falls into a void. If your keyword list is long or changes often, replace the Switch with a Code node holding a dictionary object { price: '...', link: '...', book: '...' } and look up the reply — that keeps the logic in one editable place instead of scattered across node branches.

4. Send the reply. Add an HTTP Request node (POST) to the Graph API Send endpoint:

https://graph.facebook.com/v21.0/me/messages?access_token={{ $credentials.pageAccessToken }}

Set the body to JSON: { "recipient": { "id": "{{ $json.senderId }}" }, "message": { "text": "Here's your link: https://..." } }. Store the Page Access Token in n8n Credentials (Header Auth or a generic credential) rather than hardcoding it in the node — you'll rotate it, and you don't want it living in exported JSON. Because Meta enforces a 24-hour standard messaging window, the recipient must have messaged you within the last day (which, for a DM autoresponder, they just did — so you're always compliant).

5. Log and respond fast. Branch a Google Sheets, Airtable, or Postgres node off the parse step to record senderId, text, matched keyword, and timestamp — this is your lead list and your debugging trail. Critically, place a Respond to Webhook node early (returning 200) so Meta gets its acknowledgment inside the required window; do the sending and logging on branches that don't block the response. Meta retries and eventually disables webhooks that respond slowly.

Benefits: Speed, Ownership, and Compounding Logic

Once live, the payoff is immediate and structural. Response latency drops to seconds, around the clock, which directly lifts the conversion rate on high-intent DMs. You own the logic and the data — no per-contact SaaS pricing, no vendor lock-in, and every interaction lands in a database you control for retargeting and analytics.

The bigger win is compounding. Because the router is just an n8n workflow, each keyword branch can do more than reply. A "book" match can create a calendar hold and send a scheduling link. A "price" match can tag the contact in your CRM and drop a note in Slack. A repeat sender can be routed to a human via a notification instead of the bot. You start with a text autoresponder and end with a lead-qualification pipeline, without ever leaving the same workflow. And because it's self-hosted, the marginal cost of another thousand DMs is essentially zero.

Common Pitfalls

The verification handshake fails silently. If Meta never delivers events, 90% of the time the GET challenge wasn't echoed correctly. The response must return the raw hub.challenge value with a 200 status and the verify token must match exactly. Test this before anything else.

Case sensitivity and partial matches. "Price?", "PRICE", and "pricing" all mean the same intent to a human, but includes('price') catches only if you lowercased the input first. Always normalize text in the parse step, and decide deliberately whether you want includes (matches "pricing") or exact equality.

Token expiry. Page Access Tokens can expire. When sends suddenly 400 with an OAuth error, regenerate a long-lived token and update the n8n credential — don't chase phantom logic bugs. Build a small error branch that alerts you (email or Slack) on non-200 responses from the Send node so you catch this within minutes, not days.

The 24-hour window and policy. This template is for responding to inbound DMs, which Meta permits within 24 hours. Do not repurpose it for cold outreach or bulk unsolicited messaging — that violates the Messenger Platform policy and risks the account. Keep it reactive.

No fallback branch. Always wire the Switch node's default output to something — even a generic "Thanks, we'll be right with you" plus a human notification. Messages that match no keyword should never vanish; that silent gap is where you lose the leads the automation was supposed to save.