Skip to content

📧 Email Alias Quick Start

Generate email aliases to receive orders via email.

Terminal window
pnpm --filter webapp email:list-connections

Copy the ID of the connection.

Terminal window
# Generate with auto user selection
pnpm --filter webapp email:generate-aliases <CONNECTION_ID>
# Generate with specific user
pnpm --filter webapp email:generate-aliases <CONNECTION_ID> user@example.com

The script automatically handles Clerk authentication using your backend credentials!

Verification emails are automatically sent to each alias address. Users must click the verification link to activate.

For an organization named “GenFit”:

  • Organization alias: orders+genfit@yourdomain.com
    • Receives emails for entire organization
  • Member aliases: orders+genfit_johnsmith@yourdomain.com
    • One for each organization member
    • Format: {org-slug}_{firstname}{lastname}
Terminal window
# View aliases in database
psql "$DATABASE_URL" -c \
"SELECT email, status, verified_at FROM email_aliases WHERE erp_connection_id = 'your-connection-id';"
  1. Send email to an alias (e.g., orders+genfit@yourdomain.com)
  2. Watch logs: webapp / Temporal logs will show email processing
  3. Verify: Order should be created in your system
Terminal window
# List ERP connections
pnpm --filter webapp email:list-connections
# Generate email aliases
pnpm --filter webapp email:generate-aliases <CONNECTION_ID>
  • Get a fresh Clerk token from browser
  • Make sure CLERK_SECRET_KEY is set in your local environment
  • Check RESEND_API_KEY in your local environment
  • Verify WEBAPP_URL / APP_URL is set if you need generated verification links to use a public URL
  • Check DATABASE_URL is correct
  • Verify webapp is running: curl http://localhost:4321/api/health

Update DATABASE_URL in .env with correct Neon credentials from Neon Console

The script:

  1. Connects to your database to list ERP connections
  2. Uses Clerk backend API to get a valid session token
  3. Calls the webapp alias-generation route with proper authentication
  4. Generates aliases for organization and all members
  5. Sends verification emails automatically
  1. Send test email to an alias to verify the end-to-end flow
  2. Monitor processing in webapp / Temporal logs