Click to expand
"Every reel you forward becomes a resource you own."
Instant!Q is a personal knowledge automation system that transforms the passive act of saving an Instagram reel into an active, fully automated pipeline. It detects the creator's call-to-action (CTA), comments the required keyword, captures the DM response, and stores the resource in your Notion knowledge base β all with zero manual follow-up.
Think of it as a personal bridge between Instagram's creator economy and your second brain.
π± You save a reel β π€ Instant!Q does everything else β π Resource lands in Notion
Instagram creators gate valuable resources behind engagement mechanics:
| Creator CTA Pattern | What Happens |
|---|---|
| "Comment GUIDE below π" | Automation DMs you a PDF or link |
| "Follow + Comment PDF" | Requires follow before triggering resource |
| "DM me START" | Direct message triggers a drip sequence |
| "Drop AI in the comments π₯" | Resource sent via DM after keyword comment |
β Scroll past at high speed β forget within seconds
β Friction of switching from watching to commenting breaks flow
β Save the reel to "do it later" β never happens
β Comment the keyword β never check DMs for the response
β Resources buried in DMs β impossible to find later
β No organization, search, or retrieval system
Career guides, programming tutorials, AI toolkits, fitness protocols β all lost despite the user explicitly showing interest by saving the reel.
Instant!Q automates the entire pipeline from reel share to structured knowledge entry β with just one manual action: sharing the reel to a collector account.
graph LR
A["π± Share Reel"] -->|"DM to collector"| B["π Detect CTA"]
B -->|"keyword found"| C["π¬ Auto Comment"]
B -->|"follow required"| C2["π€ Auto Follow"] --> C
C --> D["π© Monitor DMs"]
D --> E["π¦ Extract Resource"]
E --> F["πΎ Store in Supabase"]
F --> G["π Sync to Notion"]
style A fill:#6C63FF,stroke:#333,color:#fff
style B fill:#FF6584,stroke:#333,color:#fff
style C fill:#00C853,stroke:#333,color:#fff
style C2 fill:#FFB74D,stroke:#333,color:#fff
style D fill:#29B6F6,stroke:#333,color:#fff
style E fill:#AB47BC,stroke:#333,color:#fff
style F fill:#3FCF8E,stroke:#333,color:#fff
style G fill:#000000,stroke:#333,color:#fff
| Feature | Description | Status |
|---|---|---|
| π DM Detection | Monitors collector inbox for forwarded reels via instagrapi | β |
| π Caption Extraction | Opens reel URL, extracts caption text via Playwright | β |
| π― CTA Detection Engine | Keyword-based pattern matching with confidence scoring | β |
| π€ Auto Follow | Follows creators when required, with daily limits & cooldowns | β |
| π¬ Auto Comment | Posts detected keyword with human-like typing & delays | β |
| π© DM Monitoring | Watches inbox for creator response up to 30 minutes | β |
| π¦ Resource Extraction | Downloads PDFs, links, media, and text from DMs | β |
| πΎ Supabase Storage | PostgreSQL + file storage as single source of truth | β |
| π Notion Sync | Auto-creates categorized pages in Notion knowledge base | β |
| π Dashboard | Next.js pipeline monitor with analytics & search | β |
| π Retry & Recovery | Exponential backoff, checkpointed stages, dead-letter queue | β |
| π©Ί Health Monitoring | API, Redis, DB, and worker health endpoints | β |
| π Full-Text Search | PostgreSQL GIN index search across captions & resources | β |
| π Process Logging | Every pipeline step audited with error context | β |
Instant!Q is engineered to behave like a real user:
- π Randomized delays between actions (5β30 seconds)
- β¨οΈ Character-by-character typing with 50β150ms per keystroke
- π Consistent user agent (not random rotation)
- π Realistic viewport sizes
- π‘οΈ Daily action limits (configurable follow/comment caps)
- πͺ Persistent session cookies β no repeated logins
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β INSTANT!Q ARCHITECTURE β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
[Admin User]
β
β (1) Shares reel via Instagram app
βΌ
[Instagram App]
β
β Share to DM β @collector_account
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β GOOGLE CLOUD VM (Ubuntu) β
β β
β βββββββββββββββββββ ββββββββββββββββββββββββ β
β β DM Listener β β Automation Worker β β
β β (instagrapi) βββββΆβ (Playwright) β β
β βββββββββββββββββββ ββββββββββββ¬ββββββββββββ β
β β β
β βββββββββββββββββββββββββββββββββββΌβββββββββββββ β
β β Redis Queue (RQ) β β
β β reel_queue / comment_queue / notion_queue β β
β βββββββββββββββββββββββββββββββββββ¬βββββββββββββ β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
β HTTP
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β RAILWAY (FastAPI Backend) β
β β
β ββββββββββββ ββββββββββββ ββββββββββββ β
β β Reels β βResources β βAnalytics β β
β β Router β β Router β β Router β β
β ββββββββββββ ββββββββββββ ββββββββββββ β
βββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββ
β
βββββββββββββββββΌββββββββββββββββ
βΌ βΌ βΌ
ββββββββββββββββ βββββββββββββββ ββββββββββββββββ
β Supabase β β Supabase β β Notion API β
β PostgreSQL β β Storage β β Dashboard β
ββββββββββββββββ βββββββββββββββ ββββββββββββββββ
β²
βββββββββββββββββββββββββ
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β VERCEL (Next.js 14 Frontend) β
β β
β Dashboard / History / Resources / Logs / Search β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
instantiq/
β
βββ π backend/ # FastAPI REST API
β βββ app/
β β βββ main.py # Application entry point
β β βββ config.py # Pydantic settings
β β βββ database.py # SQLAlchemy async engine
β β βββ models/ # SQLAlchemy ORM models
β β β βββ reel.py # β³ Reel records
β β β βββ dm_resource.py # β³ Extracted resources
β β β βββ creator_relationship.py # β³ Follow tracking
β β β βββ process_log.py # β³ Pipeline audit trail
β β βββ routers/ # API route handlers
β β β βββ reels.py # β³ CRUD + pipeline control
β β β βββ resources.py # β³ DM resource management
β β β βββ creators.py # β³ Creator relationships
β β β βββ analytics.py # β³ Dashboard analytics
β β β βββ search.py # β³ Full-text search
β β β βββ logs.py # β³ Process log viewer
β β β βββ health.py # β³ Health checks
β β βββ schemas/ # Pydantic request/response
β β βββ services/ # Business logic
β β β βββ notion_service.py # β³ Notion API integration
β β β βββ supabase_service.py # β³ Storage operations
β β βββ queue/ # Redis queue client
β βββ Dockerfile
β βββ requirements.txt
β βββ .env.example
β
βββ π€ automation/ # Instagram automation workers
β βββ instagram/ # Core automation modules
β β βββ session.py # β³ Playwright session mgmt
β β βββ cta_detector.py # β³ CTA pattern matching
β β βββ comment_agent.py # β³ Comment automation
β β βββ follow_agent.py # β³ Follow automation
β β βββ dm_harvester.py # β³ DM resource extraction
β β βββ dm_reader.py # β³ DM content parsing
β β βββ utils.py # β³ Human-like delay utils
β βββ workers/ # Background job workers
β β βββ dm_listener_worker.py # β³ Inbox polling (instagrapi)
β β βββ reel_worker.py # β³ Full pipeline processor
β β βββ notion_sync_worker.py # β³ Supabase β Notion sync
β β βββ base_worker.py # β³ Shared worker utilities
β βββ Dockerfile
β βββ requirements.txt
β βββ .env.example
β
βββ π¨ frontend/ # Next.js 14 dashboard
β βββ src/app/
β β βββ page.tsx # Main dashboard page
β β βββ layout.tsx # Root layout
β β βββ globals.css # Global styles
β βββ package.json
β βββ tailwind.config.ts
β
βββ π scripts/ # Setup & utility scripts
β βββ create_session.py # Instagram session creator
β
βββ π³ docker-compose.yml # Full-stack orchestration
βββ π PRD.md # Product Requirements Document
βββ π οΈ TECH_STACK.md # Technology decisions & rationale
βββ π APP_FLOW.md # Detailed pipeline flow docs
βββ ποΈ BACKEND_STRUCTURE.md # Backend architecture docs
βββ π¨ FRONTEND_GUIDELINES.md # Frontend conventions
βββ π .gitignore
| Requirement | Version | Check |
|---|---|---|
| Python | 3.12+ | python --version |
| Node.js | 20+ | node --version |
| Docker & Docker Compose | 26+ | docker --version |
| Git | Latest | git --version |
External Services Required:
- π’ Supabase account (free tier)
- π΄ Redis (self-hosted via Docker or Upstash)
- β¬ Notion integration token
- πΈ Dedicated Instagram collector account
# 1. Clone the repository
git clone https://github.com/santosh5603/instantIQ.git
cd instantIQ
# 2. Copy environment files
cp backend/.env.example backend/.env
cp automation/.env.example automation/.env# Application
APP_ENV=development
APP_SECRET_KEY=<random-64-char-string>
API_PORT=8000
# Database (Supabase PostgreSQL)
DATABASE_URL=postgresql+asyncpg://postgres:<password>@db.<project>.supabase.co:5432/postgres
DATABASE_POOL_SIZE=5
# Redis
REDIS_URL=redis://localhost:6379/0
# Supabase
SUPABASE_URL=https://<project>.supabase.co
SUPABASE_ANON_KEY=<your-anon-key>
SUPABASE_SERVICE_KEY=<your-service-key>
SUPABASE_STORAGE_BUCKET=instantiq-resources
# Instagram Collector Account
INSTAGRAM_USERNAME=<collector_username>
INSTAGRAM_PASSWORD=<collector_password>
INSTAGRAM_SESSION_PATH=session/instagram_session.json
# Notion
NOTION_API_KEY=secret_<your-token>
NOTION_RESOURCES_DB_ID=<database-id>
# Worker Constraints
MAX_DAILY_FOLLOWS=10
FOLLOW_COOLDOWN_SECONDS=300
COMMENT_DELAY_MIN=10
COMMENT_DELAY_MAX=30
DM_POLL_INTERVAL_MIN=45
DM_POLL_INTERVAL_MAX=90
DM_MAX_WAIT_MINUTES=30REDIS_URL=redis://localhost:6379/0
SUPABASE_URL=https://<project>.supabase.co
SUPABASE_ANON_KEY=<your-anon-key>
SUPABASE_SERVICE_KEY=<your-service-key>
INSTAGRAM_USERNAME=<collector_username>
INSTAGRAM_PASSWORD=<collector_password>
INSTAGRAM_SESSION_PATH=session/instagram_session.jsonRecommended β This is the simplest way to get all services running.
# Build and start all services
docker compose up --build -d
# Verify services are running
docker compose ps
# View logs
docker compose logs -f
# Stop services
docker compose downπ³ Services started by Docker Compose
| Service | Container | Port | Description |
|---|---|---|---|
api |
instantiq-api |
8000 |
FastAPI backend |
dm-listener |
instantiq-dm-listener |
β | DM inbox poller |
worker-rq |
instantiq-rq-worker |
β | Reel pipeline processor |
worker-notion-sync |
instantiq-notion-sync |
β | Notion sync worker |
rq-dashboard |
instantiq-rq-dashboard |
9181 |
Queue monitoring UI |
redis |
instantiq-redis |
6379 |
Message queue |
Click to expand manual setup instructions
cd backend
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # Linux/Mac
.venv\Scripts\activate # Windows
# Install dependencies
pip install -r requirements.txt
# Run the FastAPI server
uvicorn app.main:app --host 0.0.0.0 --port 8000 --reloadcd automation
# Create virtual environment
python -m venv .venv
source .venv/bin/activate
# Install dependencies
pip install -r requirements.txt
# Install Playwright browsers
playwright install chromium
# Create Instagram session (one-time)
python manual_login.py
# Start workers (in separate terminals)
python -m workers.dm_listener_worker
python -m workers.reel_worker
python -m workers.notion_sync_workercd frontend
# Install dependencies
npm install
# Start development server
npm run dev# Using Docker
docker run -d --name instantiq-redis -p 6379:6379 redis:7-alpineThe collector account needs a one-time manual login:
# Navigate to automation directory
cd automation
# Run the session creator
python manual_login.py- A browser window opens β manually log in to your collector account
- Complete 2FA if prompted
- Session is saved to
session/instagram_session.json - All future worker runs reuse this session automatically
β οΈ Important: Keep the session file secure. It contains your collector account's authentication cookies.
| Variable | Default | Description |
|---|---|---|
MAX_DAILY_FOLLOWS |
10 |
Max follow actions per day |
FOLLOW_COOLDOWN_SECONDS |
300 |
Min seconds between follows |
COMMENT_DELAY_MIN |
10 |
Min seconds before commenting |
COMMENT_DELAY_MAX |
30 |
Max seconds before commenting |
DM_POLL_INTERVAL_MIN |
45 |
Min seconds between DM checks |
DM_POLL_INTERVAL_MAX |
90 |
Max seconds between DM checks |
DM_MAX_WAIT_MINUTES |
30 |
Max wait time for creator DM |
Create a Notion database with these properties:
| Property | Type | Values |
|---|---|---|
| Name | Title | Auto-generated |
| Category | Select | AI, Career, Programming, Fitness, Communication, Other |
| Resource Type | Select | Link, PDF, Text, Media |
| URL | URL | Resource link |
| Creator | Text | Instagram username |
| Caption | Text | First 200 chars |
| Status | Select | Unread, Reading, Done, Archived |
| Received At | Date | Auto-set |
| Source Reel | URL | Original reel link |
The backend exposes a RESTful API with auto-generated Swagger documentation.
π Interactive Docs: http://localhost:8000/docs
π ReDoc: http://localhost:8000/redoc
| Method | Endpoint | Description |
|---|---|---|
GET |
/health |
System health (API, DB, Redis) |
GET |
/health/worker |
Worker heartbeat status |
GET |
/health/queue |
Redis queue depths |
GET |
/api/reels |
List all processed reels |
GET |
/api/reels/{id} |
Get reel details + timeline |
POST |
/api/reels/reprocess/{id} |
Retry a failed reel |
GET |
/api/resources |
List extracted resources |
GET |
/api/resources/{id} |
Get resource details |
GET |
/api/creators |
List creator relationships |
GET |
/api/creators/{name} |
Get creator profile |
GET |
/api/search?q=<query> |
Full-text search |
GET |
/api/analytics |
Dashboard metrics |
GET |
/api/logs |
Process audit trail |
Every reel goes through a deterministic, checkpointed pipeline:
stateDiagram-v2
[*] --> PENDING: Reel detected
PENDING --> EXTRACTING_CAPTION: Worker picks up
EXTRACTING_CAPTION --> CTA_DETECTED: CTA found
EXTRACTING_CAPTION --> NO_CTA: No CTA in caption
CTA_DETECTED --> AWAITING_FOLLOW: Follow required
CTA_DETECTED --> AWAITING_COMMENT: Comment only
AWAITING_FOLLOW --> FOLLOWING: Execute follow
FOLLOWING --> AWAITING_COMMENT: Follow success
AWAITING_COMMENT --> COMMENTING: Execute comment
COMMENTING --> COMMENTED: Comment posted
COMMENTED --> WAITING_DM: Monitor inbox
WAITING_DM --> DM_RECEIVED: Creator responded
WAITING_DM --> DM_TIMEOUT: 30 min exceeded
DM_RECEIVED --> EXTRACTING_RESOURCE: Process content
EXTRACTING_RESOURCE --> COMPLETED: Resource saved β
NO_CTA --> COMPLETED: Stored (no action needed)
DM_TIMEOUT --> COMPLETED: Logged
COMMENTING --> RETRYING: Error (retryable)
FOLLOWING --> RETRYING: Error (retryable)
RETRYING --> AWAITING_COMMENT: Retry attempt
RETRYING --> FAILED: Max attempts β
| Stage | Code | Description |
|---|---|---|
PENDING |
P |
Reel detected and queued |
EXTRACTING_CAPTION |
EC |
Playwright opening reel URL |
CTA_DETECTED |
CD |
Call-to-action found in caption |
NO_CTA |
NC |
No CTA, reel stored as-is |
AWAITING_FOLLOW |
AF |
Follow action queued |
COMMENTING |
CM |
Comment being posted |
WAITING_DM |
WD |
Monitoring for creator response |
COMPLETED |
β
|
Resource stored & Notion synced |
FAILED |
β |
Unrecoverable error after retries |
# Backend API health check
curl http://localhost:8000/health
# Queue status
curl http://localhost:8000/health/queue
# RQ Dashboard (queue monitoring)
open http://localhost:9181timeline
title Instant!Q Development Roadmap
section V1 β MVP β
Core Pipeline : DM detection, CTA matching, auto-comment
Storage Layer : Supabase PostgreSQL + file storage
Knowledge Base : Notion sync with categories
Dashboard : Next.js pipeline monitor
section V2 β Intelligence
AI Summarization : GPT-4o-mini caption summaries
Semantic Search : pgvector embeddings
Smart Categories : AI-powered auto-categorization
Quality Scoring : Resource relevance scoring
section V3 β Platforms
TikTok : TikTok reel support
YouTube Shorts : Shorts pipeline
LinkedIn : Carousel content extraction
section V4 β Interface
Custom Dashboard : Replace Notion with Next.js UI
Browser Extension : One-click reel submission
Mobile App : React Native companion
Contributions are welcome! Please read the contribution guidelines before getting started.
# 1. Fork the repository
# 2. Create a feature branch
git checkout -b feature/amazing-feature
# 3. Make your changes and commit
git commit -m "feat: add amazing feature"
# 4. Push to your fork
git push origin feature/amazing-feature
# 5. Open a Pull RequestThis project follows Conventional Commits:
| Prefix | Use Case |
|---|---|
feat: |
New feature |
fix: |
Bug fix |
docs: |
Documentation only |
refactor: |
Code change (no feature/fix) |
test: |
Adding tests |
chore: |
Build process or tooling |
This project is licensed under the MIT License β see the LICENSE file for details.
This project is a personal automation tool built for educational purposes.
- Automated interactions with Instagram violate Instagram's Terms of Service
- This tool is designed for single-user, personal use only β not spam or commercial automation
- The developer assumes no responsibility for account restrictions or bans resulting from use
- Use at your own risk with full awareness of platform ToS implications
- No data from other users is collected, stored, or processed