How rebarfw/meme-autoposter works
Meme Autoposter is a Cloudflare Worker that turns an owner-authorized Instagram Reel DM into durable publishing jobs for Instagram and TikTok. Its main path polls Meta, validates and records messages, resolves and validates video, stores it temporarily, creates Buffer posts, checks delivery, and cleans up media. A documented signed-webhook mode can ingest jobs instead of polling; owner setup and protected administration support configuration and operations. Runtime wiring is evidenced by the supplied excerpts and SOURCE INDEX; some workflow links are documented in the README, and unsampled implementation details are not inferred.
Main entry points: jobs.ts Durable jobs · index.ts Worker router · downloaders.ts Provider selection · instagram-polling.ts DM polling
Components 21
Ingestion and authorization
- Worker router
src/index.ts - Owner setup
src/owner-setup.ts - DM polling
src/instagram-polling.ts - Instagram API client
src/instagram-api.ts - Meta messaging
src/meta.ts
Job processing
- Durable jobs
src/jobs.ts - D1 job store
- Provider selection
src/downloaders.ts - Apify budget
src/apify-budget.ts - Website adapters
src/downloader-providers - Video validation
src/video-downloader.ts
Publishing and storage
- Media lifecycle
src/media.ts - Private R2 media
- Buffer client
src/buffer.ts
Operations and safeguards
- Cloudflare usage guard
src/cloudflare-usage.ts - Privacy policy
src/privacy.ts
Other components
- Page owner
- Meta API
- Apify service
- Buffer
- Instagram and TikTok
Connections 23
- Page owner → Worker router: shares Reel
README.md - Worker router → DM polling: runs scheduled
README.md - DM polling → Instagram API client: reads conversations
src/instagram-polling.ts - Instagram API client → Meta API: requests messages
src/instagram-api.ts - DM polling → Durable jobs: processes messages
src/instagram-polling.ts - Worker router → Owner setup: routes setup
src/index.ts - Owner setup → Instagram API client: verifies sender
src/owner-setup.ts - Owner setup → DM polling: initializes polling
src/owner-setup.ts - Worker router → Meta messaging: handles webhook
README.md - Durable jobs → D1 job store: records jobs
src/jobs.ts - Durable jobs → Provider selection: downloads video
src/jobs.ts - Provider selection → Website adapters: tries providers
src/downloaders.ts - Provider selection → Apify budget: checks budget
src/downloaders.ts - Provider selection → Video validation: validates media
src/downloaders.ts - Website adapters → Video validation: validates candidates
src/downloader-providers/shared.ts - Provider selection → Apify service: resolves Reel
README.md - Durable jobs → Media lifecycle: stores media
README.md - Media lifecycle → Private R2 media: writes and deletes
README.md - Durable jobs → Buffer client: creates and checks posts
README.md - Buffer client → Buffer: creates posts
README.md - Buffer → Instagram and TikTok: publishes posts
README.md - Durable jobs → Meta messaging: notifies owner
src/jobs.ts - Worker router → Cloudflare usage guard: guards admin routes
src/index.ts