Skip to content

Send Welcome Email After User Signup #471

Open
@chibie

Description

@chibie

User Story
As a new user signing up for Paycrest
I want to receive a welcome email after successful registration
So that I can feel welcomed and understand what type of account I've created

Acceptance Criteria

  1. GIVEN a user successfully registers on Paycrest
    WHEN the registration process completes
    THEN a welcome email should be sent to their email address

  2. GIVEN a user registers with either sender or provider scope
    WHEN the welcome email is received
    THEN it should contain information specific to their account type

  3. GIVEN a user registers in any environment (production/non-production)
    WHEN the registration is successful
    THEN the welcome email should be sent regardless of email verification status

Tech Details

  1. Create new SendGrid template for welcome emails with dynamic data:

    • first_name: User's first name
    • email: User's email address
    • scopes: User's account scopes (sender/provider)
  2. Add new method to EmailService:

func (m *EmailService) SendWelcomeEmail(ctx context.Context, email, firstName string, scopes []string) (types.SendEmailResponse, error) {
    payload := types.SendEmailPayload{
        FromAddress: _DefaultFromAddress,
        ToAddress:   email,
        DynamicData: map[string]interface{}{
            "first_name": firstName,
            "email":     email,
            "scopes":    scopes,
        },
    }
    return SendTemplateEmail(payload, "WELCOME_EMAIL_TEMPLATE_ID")
}
  1. Modify Register function in controllers/accounts/auth.go to send welcome email after successful user creation but before verification email.

  2. Add unit tests in services/email_test.go and integration tests in controllers/accounts/auth_test.go.

Notes/Assumptions

  • The welcome email should be sent after user creation but before verification email
  • If welcome email fails to send, it should be logged but not block registration
  • Existing email service infrastructure (SendGrid) will be used
  • Welcome email template will be created in SendGrid before implementation
  • The feature should not affect existing email verification flow

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions