Skip to content

Conversation

@bokelley
Copy link
Contributor

@bokelley bokelley commented Jan 2, 2026

Summary

  • Fixes a bug where CC'ing Addie on prospect outreach emails wasn't tracking the actual prospect recipients
  • The Resend webhook payload only includes addresses matching the Resend domain, not original TO/CC recipients
  • Now fetches original recipients from Resend API headers and uses those for contact extraction

Problem

When you CC [email protected] on an email to a prospect (e.g., [email protected]), only the sender was being tracked. The actual prospect wasn't recorded because Resend's webhook only reports addresses that match your configured inbound domain.

Solution

  1. Updated fetchEmailBody() to also return headers.to and headers.cc from the Resend API response
  2. Updated handleProspectEmail() to use these original recipients instead of the webhook payload
  3. Added parseEmailHeaderList() to handle comma-separated addresses with quoted display names
  4. Falls back to webhook data if API call fails

Test plan

  • TypeScript compiles without errors
  • All existing tests pass (72/72)
  • Send test email CC'ing Addie and verify recipient is tracked
  • Verify fallback works when API key lacks read permissions

🤖 Generated with Claude Code

The Resend webhook payload only includes addresses that match the Resend
domain (e.g., [email protected]), not the
original TO/CC recipients from the email. This meant when CC'ing Addie
on prospect outreach, the actual prospect (e.g., [email protected])
wasn't being tracked.

The fix:
- Fetch email from Resend API which includes original headers
- Parse headers.to and headers.cc for real recipient addresses
- Use these for contact extraction instead of webhook payload
- Fall back to webhook data if API call fails

Also adds parseEmailHeaderList() to handle comma-separated addresses
with quoted display names.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@bokelley bokelley merged commit f2c1e7c into main Jan 2, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants