Skip to content

Best practice for dealing with email address confirmation? #279

Open
@marckohlbrugge

Description

@marckohlbrugge

The example code shows this:

after_create_commit do
  OnboardingCampaign.add(self)
end

Which conveniently omits the fact that we'll want to hold off sending emails until the user has confirmed their email address.

The intuitive solution is to add a segment check to the campaign like below, but I believe this won't work as expected. The campaign will be triggered, the user does not fit the segment yet, and thus the campaign will never be sent. Even after email confirmation.

class OnboardingCampaign < ApplicationCampaign
  segment :confirmed?
end

The proper solution then seems to be to hold off on adding the user to the campaign, until the user has confirmed their email address. We could add OnboardingCampaign.add(user) in a ConfirmationsController.

This seems like a pragmatic solution, but it doesn't work well if you also use OAuth logins where email confirmations can be skipped. Which means we'll need to add another OnboardingCampaign.add(user) somewhere in the OAuth signup process.

So my question is this: what's the best practice for holding off on sending campaigns until the user has confirmed their email address?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions