Email Setup with Resend

Configure Resend to send team invitation emails and notifications from your WhatsApp Team Inbox.

TL;DR - Quick Setup

1

Sign up for Resend

resend.com → Create account (free tier: 100 emails/day)
2

Get API Key

Dashboard → API Keys → Create API Key → Copy key
3

Add to .env

RESEND_API_KEY=re_xxxxxxxxxxxx
FROM_EMAIL=noreply@yourdomain.com
FROM_NAME=WhatsApp Team Inbox
4

Verify Domain (Optional)

For production: Add DNS records to send from your domain
Total time: ~10 minutes | Cost: Free (100 emails/day)

Overview

Resend is a modern email API designed for developers. It’s the email service used by WhatsApp Team Inbox for sending team invitation emails.

What Resend is Used For

Team Invitations

Send invitation emails when adding new team members

Password Resets

Send password reset links (future feature)

Notifications

Optional email notifications for new messages

System Alerts

Critical system notifications to admins
Email setup is optional. If not configured, invitation links will be displayed in the admin panel for manual sharing.

Why Resend?

Simple API

Clean REST API, no complicated SMTP configuration

Generous Free Tier

100 emails/day free forever

Built for Developers

Modern developer experience, great documentation

Reliable Delivery

High deliverability rates out of the box

Prerequisites

A Resend account (free tier available)
A domain name (optional, for production use)
Access to your domain’s DNS settings (for production)

Step 1: Create Resend Account

1

Sign Up

Go to resend.com and create a free account.No credit card required for the free tier.
2

Verify Email

Check your email and click the verification link.
3

Complete Onboarding

Follow the onboarding prompts to set up your account.

Step 2: Get API Key

1

Navigate to API Keys

In Resend dashboard, go to API Keys section.
2

Create New API Key

  1. Click Create API Key
  2. Name: “WhatsApp Team Inbox”
  3. Permission: Full Access (or Sending access for production)
  4. Click Add
3

Copy API Key

Copy the API key immediately - you won’t be able to see it again!
# Example format:
re_123abc456def789ghi012jkl345mno678
Store this key securely. Never commit it to version control.

Step 3: Configure Environment Variables

Add these variables to your .env file:

Required Variables

RESEND_API_KEY
string
required
Your Resend API keyExample: re_123abc456def789ghi012jkl345mno678Get from: Resend Dashboard → API Keys

Optional Variables

FROM_EMAIL
string
default:"onboarding@resend.dev"
Email address to send fromDevelopment: Use default onboarding@resend.devProduction: Use your verified domain noreply@yourdomain.com
FROM_NAME
string
default:"Team Inbox"
Display name for senderExample: WhatsApp Team Inbox or Your Company Name
NEXT_PUBLIC_APP_URL
string
required
Your application URL (used for invitation links)Development: http://localhost:3000Production: https://app.yourdomain.com

Example Configuration

  • Development
  • Production
# .env (Development)
RESEND_API_KEY=re_123abc456def789ghi012jkl345mno678
FROM_EMAIL=onboarding@resend.dev
FROM_NAME=Team Inbox Dev
NEXT_PUBLIC_APP_URL=http://localhost:3000
In development, you can use Resend’s default onboarding@resend.dev sender without domain verification.

Step 4: Verify Domain (Production Only)

For production deployments, verify your domain to send emails from your own domain.
1

Add Domain to Resend

  1. In Resend dashboard, go to Domains
  2. Click Add Domain
  3. Enter your domain: yourdomain.com
  4. Click Add
2

Add DNS Records

Resend will provide DNS records to add to your domain:
Type: TXT
Name: resend._domainkey
Value: p=MIGfMA0GCSqG...

Type: TXT
Name: @
Value: v=spf1 include:resend.io ~all
Add these records in your domain registrar’s DNS settings:
  • Namecheap
  • GoDaddy
  • Cloudflare
  • Google Domains
  • etc.
3

Verify Domain

  1. Wait for DNS propagation (5 minutes - 48 hours)
  2. Click Verify in Resend dashboard
  3. Once verified, you can send from @yourdomain.com
4

Update Environment Variable

Update your FROM_EMAIL to use verified domain:
FROM_EMAIL=noreply@yourdomain.com
# or
FROM_EMAIL=team@yourdomain.com

Step 5: Test Email Sending

Verify your email configuration is working:
1

Restart Application

Restart your backend server to load new environment variables:
# If using Docker
docker-compose restart backend

# If using PM2
pm2 restart backend

# If running directly
npm run dev
2

Check Logs

Look for email service initialization message:
 Email service initialized with Resend API
If you see a warning:
⚠️  Email service not configured
Then RESEND_API_KEY is not set correctly.
3

Send Test Invitation

Invite a team member from the admin panel:
  1. Go to SettingsTeam
  2. Click Invite Member
  3. Enter email address
  4. Select role
  5. Click Send Invitation
Check backend logs for:
 Invitation email sent to user@example.com (ID: abc123...)
4

Check Email Delivery

  1. Check the recipient’s inbox
  2. Email should arrive within seconds
  3. Subject: “You’ve been invited to join [Your App Name] as [Role]”
  4. Click invitation link to verify it works

Email Templates

The invitation email includes:

Professional Design

Clean, responsive HTML email template

Clear CTA

Prominent “Accept Invitation” button

Plain Text Fallback

Works in all email clients

Expiry Notice

7-day expiration mentioned in email

Customizing Email Templates

To customize email templates, edit:
backend/src/services/email.service.ts
The template includes:
  • Inviter name
  • Role assignment
  • Invitation link
  • Expiration period
  • Company branding

Pricing & Limits

Free Tier

Resend Free Tier

Perfect for small teams
  • 100 emails per day
  • 3,000 emails per month
  • Full API access
  • 1 verified domain
  • No credit card required
Sufficient for:
  • Teams up to 10 people
  • Light notification usage
PlanMonthly CostEmails IncludedBest For
Free$03,000/monthSmall teams
Pro$2050,000/monthGrowing teams
ScaleCustomCustomLarge teams
View full pricing →
Most teams stay on the free tier. You only need paid plans if sending >100 invitations per day or using advanced features.

Deliverability Best Practices

Verify Domain

Use verified domain for better deliverability

Monitor Bounces

Check Resend dashboard for bounce rates

Avoid Spam Triggers

Don’t send unsolicited emails

Use Real Reply-To

Set up monitored reply-to address

Domain Verification Benefits

Verified domains have better inbox placement rates:
  • Unverified: ~85-90% inbox rate
  • Verified: ~95-99% inbox rate
Use your brand’s email addresses:
  • team@yourcompany.com
  • noreply@yourcompany.com
  • invites@yourcompany.com
Automatic email authentication:
  • Prevents email spoofing
  • Increases trust with email providers
  • Required by some enterprise recipients

Troubleshooting

Check these:
  1. Verify RESEND_API_KEY is set correctly
  2. Check backend logs for errors
  3. Verify API key has “Sending access” permission
  4. Check Resend dashboard for failed sends
  5. Ensure NEXT_PUBLIC_APP_URL is correct
Test API key manually:
curl -X POST https://api.resend.com/emails \
  -H "Authorization: Bearer $RESEND_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "from": "onboarding@resend.dev",
    "to": "test@example.com",
    "subject": "Test",
    "html": "<p>Test email</p>"
  }'
Common causes:
  • Domain not verified
  • Sending from onboarding@resend.dev in production
  • No DKIM/SPF records
Solutions:
  1. Verify your domain in Resend
  2. Add all DNS records (DKIM, SPF)
  3. Use custom domain email address
  4. Avoid spam trigger words in content
Steps to fix:
  1. Wait 24-48 hours for DNS propagation
  2. Check DNS records are added correctly:
    dig TXT resend._domainkey.yourdomain.com
    dig TXT yourdomain.com
    
  3. Verify no typos in DNS values
  4. Check you’re adding records to the right domain
  5. Contact Resend support if still failing
Solutions:
  1. Verify key starts with re_
  2. Check for spaces or line breaks when copying
  3. Regenerate API key in Resend dashboard
  4. Ensure environment variable is loaded:
    echo $RESEND_API_KEY
    
  5. Restart backend after updating .env

Monitoring Email Delivery

Resend Dashboard

Track email performance in Resend dashboard:
  1. Go to Emails in Resend dashboard
  2. View recent sends with status:
    • ✅ Delivered
    • ⏳ Queued
    • ❌ Failed
    • ⚠️ Bounced
  3. Click on any email to see:
    • Delivery time
    • Recipient
    • Subject
    • Content
    • Error details (if failed)

Application Logs

Monitor in your backend logs:
# Successful send
 Invitation email sent to user@example.com (ID: abc123...)

# Failed send
 Failed to send invitation email to user@example.com: Error details

# Service not configured
⚠️  Skipping email send to user@example.com (email service not configured)

Alternative: Running Without Email

If you don’t want to set up email, you can still invite team members:
1

Generate Invitation Link

When inviting a member, the invitation link will be displayed in the UI even if email fails.
2

Share Link Manually

Copy the invitation link and share via:
  • Slack/Teams
  • WhatsApp
  • Text message
  • Any other communication channel
3

Team Member Accepts

They click the link and complete registration.
Invitation links expire after 7 days for security.

Security Considerations

Protect API Key

Never expose in client-side code or version control

Use Environment Variables

Store in .env files, not hardcoded

Rotate Keys

Regenerate API keys periodically

Monitor Usage

Watch for unusual sending patterns

API Key Best Practices

# ✅ Good - Environment variable
RESEND_API_KEY=re_123abc...

# ❌ Bad - Hardcoded in code
const apiKey = "re_123abc...";

# ❌ Bad - Committed to Git
# .env file in repository

# ✅ Good - Excluded from Git
# .env added to .gitignore

Production Checklist

Resend account created
API key generated and secured
Environment variables configured
Domain verified (for production)
DNS records added and verified
Test email sent successfully
Invitation emails working
Emails arriving in inbox (not spam)
FROM_EMAIL uses verified domain
Monitoring configured in Resend dashboard

Next Steps

Additional Resources