How rebarfw/arabic-meme-autoposter works
Arabic Meme Autoposter turns approved Instagram DM shares into deduplicated Reel jobs, downloads and validates the original media, then publishes it to the configured Instagram and TikTok Buffer channels. Polling is the configured ingestion route; webhook validation remains a capability, not the active ingestion path. Separate branches cover sender enrollment, cost controls, diagnostics, and cleanup. The excerpts and README support the main workflow; some unsampled internals are represented only at their documented subsystem paths.
Main entry points: jobs.ts Job orchestration · index.ts Worker routes · downloaders.ts Provider selection · instagram-polling.ts DM polling
Components 24
Ingestion and authorization
- Worker routes
src/index.ts - DM polling
src/instagram-polling.ts - Instagram API
src/instagram-api.ts - Sender enrollment
src/owner-setup.ts - Sender allowlist
src/senders.ts
Publishing pipeline
- Job orchestration
src/jobs.ts - Job state
- Media storage
src/media.ts - Private media
- Buffer publishing
src/buffer.ts
Media acquisition
- Provider selection
src/downloaders.ts - Apify downloads
src/apify-download.ts - Website providers
src/downloader-providers - MP4 validation
src/video-downloader.ts
Safety and operations
- Apify budget guard
src/apify-budget.ts - Cloudflare usage guard
src/cloudflare-usage.ts - Privacy cleanup
src/privacy.ts - Meta diagnostics
src/meta-diagnostics.ts - Usage probe
src/cloudflare-probe.ts
External services
- Meta messages
- Buffer API
- Cloudflare analytics
Other components
- Approved sender
- Administrator
Connections 28
- Approved sender → DM polling: shares Reel
- DM polling → Instagram API: reads conversations
src/instagram-polling.ts - Instagram API → Meta messages: requests messages
- DM polling → Job orchestration: enqueues source
src/instagram-polling.ts - Worker routes → DM polling: dispatches polling
src/index.ts - Administrator → Worker routes: calls admin routes
src/index.ts - Worker routes → Sender enrollment: routes setup
src/index.ts - Sender enrollment → Meta messages: verifies identity
- Sender enrollment → Sender allowlist: installs sender IDs
src/owner-setup.ts - Job orchestration → Sender allowlist: checks authorization
src/jobs.ts - Job orchestration → Job state: stores job state
- Job orchestration → Provider selection: requests download
src/jobs.ts - Provider selection → Apify downloads: uses Apify
src/downloaders.ts - Provider selection → Website providers: tries providers
src/downloaders.ts - Provider selection → MP4 validation: validates media
src/downloaders.ts - Apify downloads → Apify budget guard: reserves runs
src/apify-download.ts - Job orchestration → Media storage: stores video
src/jobs.ts - Media storage → Private media: writes object
- Job orchestration → Buffer publishing: requests posts
src/jobs.ts - Buffer publishing → Buffer API: creates posts
- Job orchestration → Cloudflare usage guard: checks capacity
src/jobs.ts - Cloudflare usage guard → Cloudflare analytics: reads usage
- Worker routes → Cloudflare usage guard: guards routes
src/index.ts - Worker routes → Usage probe: dispatches probe
src/index.ts - Usage probe → Cloudflare usage guard: checks usage
src/cloudflare-probe.ts - Worker routes → Meta diagnostics: dispatches diagnosis
src/index.ts - Worker routes → Privacy cleanup: serves privacy routes
src/index.ts - Job orchestration → Private media: deletes after delivery