feat: automated outreach lifecycle, Gmail API, DM queue, follow-up cron#2
Merged
Conversation
…queue, follow-up cron - Add outreach lifecycle module (outreach-lifecycle.ts) centralizing all status transitions: draft → sent → follow-up 1/2 → completed/replied - Integrate Gmail OAuth flow (route + callback) for server-side email sending - Build Gmail API client with token refresh, RFC 2822 MIME encoding, reply detection - Create /api/outreach/send endpoint with rate limiter integration - Add DM Focus Mode to queue page: one-at-a-time workflow with editable message, progress bar, rate limit display per platform - Add confirm-before-sent dialog for DMs (prevents false sent marks) - Create follow-up cron job (daily 9am UTC via Vercel Cron) that auto-sends email follow-ups and queues DM follow-ups for human review - Update settings page: Gmail now uses OAuth connect/disconnect flow - Add DB migration 002 for follow-up tracking columns and indexes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add scout/dm-automator.ts for Instagram/TikTok DM automation via persistent Playwright browser session. Update docs to reflect all Phase 1-4 features (lifecycle, Gmail API, DM queue, cron). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
outreach-lifecycle.ts): Centralized module with 6 events (draft_created,initial_sent,follow_up_1_sent,follow_up_2_sent,reply_detected,sequence_complete) driving automaticstage,dm_status, andnext_follow_uptransitionssendEmailViaAPI(), auto token refresh, reply detection — replacesmailto:links/api/cron/follow-ups): Daily at 9am UTC via Vercel Cron — checks for replies, auto-completes stale sequences, generates follow-up drafts, auto-sends emails if Gmail connectedscout/dm-automator.ts): Local script for Instagram/TikTok DMs using persistent browser session with human-in-the-loopNew files
src/lib/outreach-lifecycle.ts— status state machinesrc/app/api/auth/gmail/route.ts+callback/route.ts— Gmail OAuthsrc/app/api/outreach/send/route.ts— server-side email sendsrc/app/api/outreach/check-rate/route.ts— rate limit statussrc/app/api/cron/follow-ups/route.ts— daily follow-up cronpackages/db/migrations/002_outreach_automation.sql— new columns + indexesscout/dm-automator.ts— Playwright DM automation scriptModified files
src/app/api/outreach/approve/route.ts— uses lifecycle module instead of hardcoded statussrc/app/api/outreach/launch/route.ts— addsmessage_type: "cold"src/lib/gmail.ts— rewritten withsendEmailViaAPI(), token refresh, reply detectionsrc/components/draft-card.tsx— Gmail API send + confirm dialog for DMssrc/components/outreach-queue.tsx— DM Focus tab with rate limitssrc/app/(dashboard)/settings/page.tsx— Gmail connect/disconnectvercel.json— cron scheduleTest plan
002_outreach_automation.sqlin Supabase SQL editorCRON_SECRETandGMAIL_REDIRECT_URIin Vercel env varsnext_follow_upto today →curl /api/cron/follow-ups→ verify follow-up drafts generatedscout/→ rundm-automator.ts --dry-run→ verify queue fetching works🤖 Generated with Claude Code