All work
App & web app development / CASE STUDY

Instagram DM Lead Capture & Android Web Push Notifications

An Instagram DM lead-intake pipeline that detects phone numbers, saves private inquiry records and sends Android web push alerts without requiring AI auto-replies.

ILLUSTRATION · NOT AN ACTUAL SCREEN
OVERVIEW

Project overview

This case study focuses on a different part of Instagram DM automation from an AI chatbot: reliably handing an incoming phone-number inquiry to the business owner. A customer may leave a mobile callback number while AI auto-replies are disabled or restricted. The lead capture path therefore runs independently of the AI responder. The integration examines inbound Instagram messages delivered through the signed Meta webhook. It recognizes Korean mobile-number formats and normalizes the value for the private inquiry record. Landlines, email-only inquiries and business outbound messages are not treated as mobile leads. A limited summary of the customer's stated gym type, products or opening date can accompany the saved record, but missing details are not guessed. Netlify Blobs holds the private messages, lead records and notification state. A scheduled function checks new phone inquiries. It uses conversation identifiers and existing lead records to avoid duplicate captures. To prevent a flood of historical alerts, only phone messages received after the first valid administrator push subscription are eligible for this passive capture path. The AI bot and passive capture share the lead record without needing public auto-reply access. Authenticated administrators can register a browser push subscription. A VAPID Web Push sender and service worker deliver the notification to the owner's Galaxy phone. Tapping the notification opens the relevant conversation in the admin interface; private customer data remains behind authentication. The lock-screen payload does not contain the callback number or raw message text. Any optional preview is restricted to a short, sanitized gym/product/timing summary. The pipeline records per-device delivery state so scheduled reprocessing does not repeatedly notify the same device. Expired subscriptions are removed, while ambiguous sending outcomes require review instead of uncontrolled retries. Test notifications, diagnostic alerts and real inquiry pushes remain distinguishable. The notification process runs on a roughly one-minute schedule, not a guaranteed instantaneous channel. A phone-number test from an authorized Instagram account produced an observed Galaxy notification. Automated integration tests also covered a non-allowlisted account scenario: no AI call or outbound Instagram reply, one saved contact and one private push, with no second notification on rerun. These tests verify application behavior, not universal Meta webhook permission. As of November 2026, Meta app review is still pending and unrestricted external-account message delivery requires a separate live verification. This is a built and tested restricted-beta system rather than a claim of completed public launch.

The starting point

A buyer may send a phone number in Instagram DM while the business owner is away from the inbox. Capturing the contact and notifying the owner should be possible independently of an AI bot, subject to the messages Meta is permitted to deliver through the webhook.

The problem to solve

If lead capture depends on an enabled bot, the business may miss contacts when auto-replies are disabled. Replaying older DMs can flood a newly registered phone. Other risks include mistaking landlines for mobile numbers, duplicate pushes and exposing contact details on a lock screen.

Key features

Consume incoming Meta Instagram webhook events
Inspect customer inbound text only
Recognize and normalize Korean mobile numbers
Ignore landlines, emails and outbound business messages
Capture leads independently of the AI responder
Deduplicate repeated conversation events
Respect first administrator push enrollment time
Avoid retroactive historical notification floods
Summarize stated gym, products and dates
Store privacy-reduced inquiry excerpts
Keep private lead records in Netlify Blobs
Run a scheduled one-minute intake pipeline
Register and send VAPID Web Push notifications
Deliver notifications through a Galaxy service worker
Never display customer phone numbers in push payloads
Open authenticated admin conversation details
Prevent duplicate notifications per subscription
Remove expired subscriptions
Separate real leads from test and diagnostic alerts
Verify tester receipt and simulate non-allowlisted leads
Disclose pending Meta review and live verification limits