Darwin Instagram Chatbot
Instagram DM assistant handling 200+ messages a day

Overview
An Instagram DM auto-responder for Darwin Daug, a Filipino creator selling a Facebook-automation and content course. The bot plays "Miss Pauline," Darwin's AI assistant: it answers course questions from a baked-in knowledge base, refuses to handle payments, and pings Darwin on Telegram when a real buyer shows up so he can close the sale personally.
Features
- IG webhook with Facebook verification handshake.
- Per-user conversation context: 24h TTL, last 50 messages kept.
- Human takeover detection via message echoes: if an echo isn't one the bot sent, AI pauses for that user; it resumes after 30 min of human silence plus a new user message.
- Tool calling: when purchase intent is detected, the AI calls notify_interested_buyer, which sends a Telegram DM to Darwin with the IG handle.
- Strict persona rules: English-only replies (but understands Tagalog, Bisaya, Taglish), 1-3 sentence casual tone, no markdown, never discloses payment details.
- IG long-lived token auto-refresh scheduler.
- Typing indicators while generating replies.
Highlights
- Handles 200+ messages per day, with bursts up to 1,000 messages on heavy days when Darwin posts.
Built with
Language & RuntimeTypeScript, Node.js
ServerExpress 5
AIOpenRouter, Kimi K2
MessagingInstagram Graph API, Telegram Bot API
TestingJest, ts-jest
