Fraink AI Quote-Tweet Automation Workflow
Technical White Paper
The Fraink AI Quote-Tweet Automation is a production-grade n8n orchestration pipeline that autonomously scrapes trending X posts in AI/crypto/tech/finance failure niches, crafts a signature “Fraink” (cynical, Peterson-drunk professorial) reply, generates a matching Flux-powered meme or Fraink-character image, and publishes it as a verified quote tweet. Executed on a three-times-daily cron (09:00/15:00/22:00 SAST), the system enforces strict 100-250 character limits, style randomization, and blacklist deduplication to guarantee originality and platform compliance while minimizing manual intervention.
Data flow begins with GetXapi advanced search (paginated, 16-hour recency filter), followed by a custom JavaScript “Choose One” node that ranks candidates by velocity (views ÷ age-in-hours) and breakout ratio (views ÷ followers). The winner is passed to the primary LangChain agent (Groq Llama-3.3-70B or xAI Grok-4-1-fast) which, guided by a detailed system prompt and structured JSON output parser, produces new_tweet, meme_seed, and metadata while cross-checking against prior tweets stored in Google Sheets. A parallel length-validation IF + retry branch (Grok-powered shortening agent) guarantees compliance before proceeding.
Image generation forks on a randomized style selector (20 % Fraink’s Fever Dream, 30 % Photo-Realistic Chaos, 10 % Digital Glitch, 10 % Cartoon, 30 % special “Fraink at His Desk”). Non-Fraink paths route through a second LangChain prompt engineer that crafts one- or two-panel Flux instructions with mandatory @fraink_ai watermark and exact style constraints; Fraink paths use a randomized scene/settings code node plus img2img (Flux Kontext, 0.7 strength) against a fixed reference portrait. Both branches call fal.run endpoints (flux-2 or flux-kontext) with safety checker disabled, retrieve binary output, upload via Twitter media API, and attach the resulting media_id to the quote-tweet payload.
Final leg refreshes OAuth cookies on-demand (with 422 retry + 21-second wait), posts via twitterapi.io (quote + attachment_url), persists records to Google Sheets and Supabase, logs costs via sub-workflow, and notifies Slack on success or error. Robust error continuation, structured parsers, and credential rotation ensure 24/7 uptime for this fully autonomous AI meme-commentary engine.
Text-based Flow Chart
Cron Trigger (9/15/22)
↓
GetXapi Search (trending failures)
↓
JS Velocity Scorer → Choose One
↓
AI Fraink (Groq/xAI) + Blacklist + Structured Parser
↓
Tweet Length IF
├── OK → Randomizer (style + sub-style)
└── Retry (Grok shorten) → Final Length IF
↓
Style Branch
├── Fraink Desk → Random Scene → Fraink Img Prompt → Flux Kontext (img2img)
└── Meme → AI Meme Prompt → Flux-2 (text-to-image)
↓
Get Binary → X Media Upload
↓
Cookie Refresh (422 retry loop)
↓
Quote Tweet POST + Supabase/Sheets/Slack
↓
Status: Completed