# Blogger Workers


# bloggers-worker

Type: HTTP + Scheduled Route: api-private.influtics.com/blogger/* Cron: 0 0,12 * * *

# HTTP Endpoints

Endpoint Method Description
/blogger/add POST Add new blogger to tracking
/blogger/add-from-tracking POST Add existing blogger (already has videos)
/blogger/list GET List tracked bloggers for org
/blogger/stats GET Get blogger stats
/blogger/toggle POST Pause/resume tracking
/blogger/delete POST Delete blogger (keep videos)
/blogger/delete-with-videos POST Delete blogger + all videos
/blogger/set-tags POST Set tags on blogger (triggers DB propagation)
/blogger/set-campaign POST Set campaign assignment
/blogger/set-budget-per-video POST Set budget per video
/blogger/merge POST Create new creator profile from bloggers
/blogger/add-to-creator POST Add blogger to existing creator profile
/blogger/fetch-initial-videos POST Re-trigger initial video fetch

# Scheduled Handler

scheduled() fires on 0 0,12 * * * and calls scheduleMidnightBloggerFetches() from midnightBloggerFetch.ts.


# blogger-video-consumer

Type: Queue Consumer Queue: BLOGGER_VIDEO_QUEUE

Message type Handler Description
blogger_initial_fetch handleInitialFetch() (line 118) Initial video fetch for a newly tracked blogger
(no type) handleMidnightBatch() (line 643) Midnight/noon batch fetch for an active tracked account

# handleInitialFetch()

  1. Check pending_initial_fetch flag (prevents duplicate processing)
  2. Check subscription limits
  3. Fetch videos via apiService.getUserVideosBatch()
  4. Save via saveBloggerVideos()videos + video_statistics
  5. Queue thumbnail downloads
  6. YouTube only: enqueue stats batches to HIGH_PRIORITY_QUEUE
  7. Set initial_videos_fetched = true, clear pending_initial_fetch

# handleMidnightBatch()

  1. Check subscription limits
  2. Fetch via getUserVideosBatch()
  3. Save videos + stats
  4. Queue thumbnail downloads
  5. YouTube only: enqueue stats batches to HIGH_PRIORITY_QUEUE
  6. Update tracked_accounts.last_scraped_at