Email Outreach
AI-generated personalized emails sent through Resend, with automatic content generation powered by OpenRouter (Gemini 2.0 Flash).
How It Works
Email is the simplest channel -- it runs entirely within the Next.js dashboard (no external Python service needed). Emails can be sent manually from the dashboard or automatically through campaign execution.
AI Generation
Gemini 2.0 Flash generates personalized subject lines and body text
Resend Delivery
High-deliverability email API with tracking
Custom Sender
Configure from address, reply-to, and sender name per org
Email API Endpoints
/api/dashboard/email/send/api/dashboard/email/generate/api/dashboard/email/test/api/dashboard/email/messagesAI Email Generation
The email generation endpoint uses OpenRouter (Gemini 2.0 Flash) to create personalized emails based on the lead information and selected script.
User opens Email page in dashboard
|
| Fills in lead name, company, selects script, email type
v
POST /api/dashboard/email/generate
|
| Load script content from DB
| Load voice config (language, personality)
| buildEmailPrompt() -> Build prompt template
v
OpenRouter API (Gemini 2.0 Flash):
| Generate personalized email subject + body
| Parse JSON response: { "subject": "...", "body": "..." }
v
Dashboard: Returns generated email for user review
|
| User edits and clicks "Send"
v
POST /api/dashboard/email/send
| Resend API sends the email
| Result logged to messages tableThe system supports three email types for different stages of the outreach funnel:
initial
First contact email
followup
Follow-up after no reply
final
Last attempt before closing
Email Configuration
Email sender settings are stored in the channel_configs table per organization. Configure these from the dashboard settings.
{
"channel": "email",
"config": {
"fromEmail": "sales@yourdomain.com",
"fromName": "Sales Team",
"replyTo": "sales@yourdomain.com"
}
}If no email config is set, the default sender is noreply@projectnoir.xyz.
Campaign Integration
During campaign execution, the email channel is typically the last priority (after Telegram and voice) since it has the lowest response rate. The campaign executor handles email automatically:
- Check if lead has an email address
- Build a personalized AI prompt using the campaign script
- Send via Resend API with the org's configured sender
- Log the result to the messages table
- Apply a 3-second inter-lead delay