@@ -72,13 +72,14 @@ graph TB
7272
7373| Component | Purpose | When Used |
7474| -----------| ---------| -----------|
75- | ** n8n Cloud** | Workflow orchestration, daily monitoring | All automation flows |
76- | ** Claude Code Max** | Code generation, routine evaluation | Primary AI workload |
75+ | ** n8n Cloud** | Workflow orchestration, daily monitoring, social media scheduling | All automation flows + social media posting |
76+ | ** Claude Code Max** | Code generation, routine evaluation, post content generation | Primary AI workload + marketing |
7777| ** Vertex AI (Multi-LLM)** | Critical decisions requiring consensus | Final approval, complex plots |
7878| ** GitHub Actions** | Testing (4 Python versions), preview generation | On PR + before QA |
7979| ** GitHub Copilot** | Automated code review | On every PR |
80- | ** Google Cloud Storage** | PNG hosting with versioning (old versions auto-deleted after 30 days) | All preview images |
81- | ** Cloud SQL** | Metadata, tags, quality scores | Plot catalog |
80+ | ** Google Cloud Storage** | PNG hosting with versioning (old versions auto-deleted after 30 days) | All preview images + social media images |
81+ | ** Cloud SQL** | Metadata, tags, quality scores, promotion queue | Plot catalog + marketing queue |
82+ | ** X (Twitter) API** | Automated social media posting | Up to 2 posts/day for plot promotion |
8283
8384---
8485
@@ -318,6 +319,90 @@ graph TB
318319
319320---
320321
322+ ### Flow 7: Social Media Promotion
323+
324+ ** Purpose** : Automatically promote new and updated plots on social media
325+
326+ ** Trigger** :
327+ - New plot deployed (passed Multi-LLM approval and went live)
328+ - Existing plot significantly updated (new version with improved quality score)
329+
330+ ** Process** :
331+ 1 . ** Queue Addition** :
332+ - Plot added to promotion queue in Cloud SQL
333+ - Queue entry includes: plot ID, quality score, preview image URL, plot description
334+ - Priority assigned based on quality score:
335+ - ** High Priority** : Score ≥ 90 ("Cool plots")
336+ - ** Medium Priority** : Score 85-89 (Standard approved plots)
337+ - ** Low Priority** : Updates to existing plots
338+
339+ 2 . ** Daily Processing** (n8n scheduled workflow):
340+ - Runs twice daily at optimal engagement times (e.g., 10 AM, 3 PM CET)
341+ - Checks daily post count (stored in database)
342+ - If daily limit not reached (max 2 posts/day):
343+ - Selects highest priority item from queue
344+ - Proceeds to post generation
345+
346+ 3 . ** Post Generation** :
347+ - Claude generates engaging post content:
348+ - Eye-catching description (what makes this plot special)
349+ - Relevant use cases
350+ - Key features highlighted
351+ - Hashtags: #dataviz #python #matplotlib (or library name)
352+ - Loads preview image from GCS
353+ - Adds link to plot on website
354+ - Ensures X character limit compliance (280 chars)
355+
356+ 4 . ** Publishing** :
357+ - Posts to X (Twitter) via API
358+ - Marks queue item as "posted" with timestamp
359+ - Increments daily post counter
360+ - Logs success/failure
361+
362+ 5 . ** Queue Management** :
363+ - FIFO within priority tiers
364+ - Queue items older than 30 days may be deprioritized
365+ - Failed posts retry next day (max 3 attempts)
366+
367+ ** Rate Limiting** :
368+ - ** Hard limit** : 2 posts per day maximum
369+ - ** Reset** : Daily counter resets at midnight CET
370+ - ** Prevents spam** : Even with many new plots, respects limit
371+ - ** Quality over quantity** : Only best plots get promoted
372+
373+ ** Output** :
374+ - Automated X posts with preview images
375+ - Increased platform visibility
376+ - Community engagement
377+
378+ ** Platform Strategy** :
379+ - ** Phase 1 (MVP)** : X (Twitter) only
380+ - ** Phase 2** : Add LinkedIn for professional audience
381+ - ** Phase 3** : Relevant subreddits (r/dataisbeautiful, r/Python)
382+ - ** Coordination** : Cross-platform posts spaced to avoid redundancy
383+
384+ ** Queue Storage** (Cloud SQL):
385+ ```
386+ promotion_queue:
387+ - id
388+ - plot_id
389+ - priority (high/medium/low)
390+ - quality_score
391+ - preview_url
392+ - created_at
393+ - posted_at (null if not yet posted)
394+ - status (queued/posted/failed)
395+ - attempt_count
396+ ```
397+
398+ ** Cost Optimization** :
399+ - n8n handles scheduling (already subscribed)
400+ - Claude generates post text (Code Max subscription)
401+ - X API posting (free tier sufficient for 2 posts/day)
402+ - No additional infrastructure needed
403+
404+ ---
405+
321406## Flow Integration
322407
323408``` mermaid
@@ -354,6 +439,13 @@ graph TD
354439
355440 K -->|Approved| P[Flow 6: Deploy to Website]
356441 P --> Q[🌐 Publicly Visible]
442+ P --> U[Flow 7: Add to Promotion Queue]
443+
444+ U --> V{Daily Post Limit?}
445+ V -->|< 2 posts today| X[Generate & Post to X]
446+ V -->|Limit reached| Y[Wait in Queue]
447+ X --> Z
448+ Y -.->|Next day| V
357449
358450 R[Event: LLM/Library Update] -->|Trigger| S[Flow 6: Maintenance]
359451 S -->|Check Improvements| T{Better?}
@@ -368,6 +460,8 @@ graph TD
368460 style R fill:#ffe1e1
369461 style L fill:#FFB6C1
370462 style O fill:#FF6B6B
463+ style U fill:#E6E6FA
464+ style X fill:#98FB98
371465```
372466
373467---
@@ -526,6 +620,7 @@ strategy:
526620- 🐍 **Python** : 3.12, 3.11, 3.10 (add 3.13 when stable)
527621- ✋ **Approval** : Manual for all new plots
528622- ✅ **Quality** : Basic Claude evaluation
623+ - 📱 **Promotion** : X (Twitter) posting with 2/day limit
529624
530625**Goal**: Prove automation pipeline works end-to-end
531626
@@ -540,6 +635,7 @@ strategy:
540635- 🤖 **Approval** : Hybrid (auto for similar, manual for new)
541636- ✅ **Quality** : Multi-LLM for critical decisions
542637- 🐍 **Python** : + 3.13 (when stable)
638+ - 📱 **Promotion** : + LinkedIn posts for professional audience
543639
544640**Goal**: Scale content production and improve automation
545641
@@ -553,6 +649,7 @@ strategy:
553649- 🤖 **Approval** : Intelligent auto-approval (high confidence)
554650- 🔄 **Maintenance** : Proactive optimization suggestions
555651- 🌐 **Community** : Public spec submissions via issues
652+ - 📱 **Promotion** : + Reddit posts (r/dataisbeautiful, r/Python), cross-platform coordination
556653
557654**Goal**: Comprehensive, self-maintaining plot library
558655
@@ -562,13 +659,14 @@ strategy:
562659
563660This workflow ensures :
564661
565- ✅ **Fully Automated** pipeline from discovery to deployment
662+ ✅ **Fully Automated** pipeline from discovery to deployment to promotion
566663✅ **Multi-Layer Quality Control** :
567664 - Self-review loop in code generation (max 3 attempts)
568665 - Multi-version testing across Python 3.10-3.13
569666 - Multi-LLM consensus validation (Claude + Gemini + GPT)
570667 - Feedback-driven optimization on rejection
571668✅ **Only High-Quality Plots on Website** : Failed attempts never publicly visible
669+ ✅ **Automated Marketing** : Queue-based social media promotion with smart rate limiting (max 2 posts/day)
572670✅ **Cost-Conscious** design leveraging existing subscriptions
573671✅ **Smart Storage** with GCS lifecycle management (current version stays, old deleted after 30d)
574672✅ **Deterministic & Reproducible** : Same code = same image every time
@@ -577,4 +675,4 @@ This workflow ensures:
577675✅ **Phased Rollout** starting simple, scaling intelligently
578676✅ **Feedback Storage** : All quality reviews saved for continuous learning
579677
580- The system is designed to **scale from MVP to full automation** while maintaining the highest quality standards and controlling costs.
678+ The system is designed to **scale from MVP to full automation** while maintaining the highest quality standards, controlling costs, and automatically promoting the best content to the community .
0 commit comments