Skip to main content
Launched

Reply Tidy

A high-performance webhook system that moderates Threads comments with OpenAI, combining free keyword rules with batched AI moderation and a human review queue.

TypeScript TanStack Start Drizzle ORM PostgreSQL OpenAI Threads
Cover image for Reply Tidy

Overview

Reply Tidy is a webhook system for moderating Threads (Instagram) comments with OpenAI. The handler verifies, enqueues, and returns 200 in milliseconds, well inside Meta’s 10-second window. Then a Postgres-backed worker makes moderation decisions. Keyword rules run first for free; remaining comments go to OpenAI’s omni-moderation-latest endpoint in a single batched call, and per-user category thresholds decide HIDE vs REVIEW vs ALLOW.

Features

  • Instant webhook acknowledgement inside Meta’s timeout, with dual-format envelope support
  • Batched AI moderation via OpenAI omni-moderation-latest with per-user category thresholds
  • Per-user moderation settings: shadow mode (WOULD_HIDE), author allow/blocklists
  • Human review queue with approve, hide, unhide, false-positive, and requeue actions
  • Long-lived token exchange at sign-in with automatic refresh within 7 days of expiry
  • Postgres worker queue using FOR UPDATE SKIP LOCKED with deduplication and exponential backoff
  • Crash-recoverable manual hide/unhide via committed, expiring claim tokens
  • Full moderation evidence (moderation_source, moderation_reason, categories JSONB) and timed audit redaction
  • Bounded custom rules: up to 100 stored, 50 active, 10 AI rules, five concurrent AI evaluations

Technology Stack

  • TypeScript on Bun
  • TanStack Start + Drizzle ORM + Better Auth
  • PostgreSQL (Docker) worker queue
  • OpenAI omni-moderation-latest
  • Threads Graph API (graph.threads.net)

Share this project