[← back to projects]

[archived]

Instagram DM Intake

n8n intake layer for an AI appointment setter

Turns a burst of Instagram DMs into exactly one AI reply — verified, deduplicated, and handed back to a human when the coach steps in.

Instagram DM Intake screenshot 1
Instagram DM Intake screenshot 2

The problem

An AI setter that answers Instagram DMs needs a front door that answers Meta within a second, ignores retries and duplicates, waits for a lead to finish typing, and never talks over a human.

What I built

n8n workflows backed by Postgres that receive Meta's Instagram webhooks, verify every request, batch each conversation's messages, and pass one clean batch to a send sub-workflow. Built as a paid trial and delivered two days early.

Core features

  • -Meta webhook verification handshake and HMAC-SHA256 signature check
  • -Duplicate and retry protection through a database constraint
  • -Burst batching: several quick messages produce exactly one reply
  • -Automatic pause when the coach replies personally
  • -Daily job that refreshes expiring access tokens

Engineering highlights

  • -Signature verified over the raw request bytes with a constant-time comparison, so emoji and escapes never break it
  • -A single SQL statement lets only the newest message claim the batch — exactly one reply even with concurrent executions, no locks or queues
  • -Responds to Meta in about 40ms locally, before any database work
  • -Signed-request test harness covering bursts, duplicates, parallel leads, emoji, and the coach-takeover case

Tech stack

n8nPostgreSQLMeta Graph APIWebhooksDockerBash

Impact

  • -Client feedback called it "solid work", singling out the claim query and the limitations write-up

Want something similar built?

Happy to talk it through — drop me a line.

[get in touch]