◇ Case study / 04 · 2026
Instagram DM Automation
Stateful conversational lead capture

◇ The problem
What we were trying to solve
The CEO's personal-brand Instagram was generating qualified inbound — DMs, ad-form leads, comment intent — but the team was missing replies for hours during the day and entirely overnight. By the time someone got to a hot lead, the visitor had already moved on. Conversion was leaking.
◇ The solution
How it shipped
Built an n8n workflow on a Meta Graph API webhook with two paths: a GET handler that returns Meta's challenge token to complete subscription verification, and a POST handler that ingests four event types (DM, new follower, post comment, Meta Ad lead) and routes each into a stateful multi-turn conversation. Per-user state (waiting_name → waiting_phone → waiting_email → complete) lives in n8n's static data, keyed by Instagram sender ID. Each stage validates input (phone regex, email regex) before advancing. On `complete`, the qualified lead is appended to Google Sheets with name, phone, email, IG ID, source, and timestamp — ready for the sales team to action.
◇ Decisions
Engineering choices worth flagging
Stateful per-user conversation, not one-shot
Most Instagram automations are one-message blasts. The leap was treating each conversation as state — track which question the user is on, validate their reply, advance them. This is what turns DM automation from spam to a real lead-capture funnel.
n8n static data over external DB for state
For medium volume, `$getWorkflowStaticData('global')` is dramatically simpler than wiring Supabase or Redis. Trade-off documented in the README: doesn't survive workflow restructure, so production at scale would externalise to Postgres. Right call for v1.
Two webhook paths in one workflow
Meta's webhook subscription requires a GET endpoint that returns `hub.challenge` before any events are sent. Most tutorials wire that into a separate workflow; I kept verification + event handling in the same n8n flow with two webhook nodes on the same path. Means one URL to register, one place to debug.
Same pattern reused inside WSJR Academy's ATLAS
Once the multi-turn pattern worked, I lifted the architecture into the WSJR School ATLAS advisor. One battle-tested flow, two production surfaces. Reuse is leverage.
◇ Results
What shipped
◇ Stack
Tools used
◇ Keep exploring