Skip to content

Instantly share code, notes, and snippets.

@joshuap
Last active December 9, 2021 15:50
Show Gist options
  • Save joshuap/03347a54e34279a467d1b2b53cb61bdd to your computer and use it in GitHub Desktop.
Save joshuap/03347a54e34279a467d1b2b53cb61bdd to your computer and use it in GitHub Desktop.
Configuring Jumpstart to send a welcome sequence w/ Heya

Jumpstart + Heya

This creates a 4-part email series to welcome users who sign up for your Jumpstart app. The first email is sent immediately, and the following emails are sent 2 days apart.

This guide assumes you meet Jumpstart's requirements.

  • In a new terminal, run the following:

    export DISABLE_SPRING=1
    rails new jumpstart -d postgresql -m https://raw.githubusercontent.com/excid3/jumpstart/master/template.rb
    cd jumpstart
    bundle add heya maildown
    rails generate heya:install
    rails db:migrate
    rails generate heya:campaign Onboarding welcome:0 getting_started extending_jumpstart jumpstart_pro
  • Add the following to the end of app/models/user.rb:

    after_create_commit do
      OnboardingCampaign.add(self)
    end
  • Configure MailCatcher (optional):

    # config/environments/development.rb
    Rails.application.configure do
      # ..
    
      # Use MailCatcher to inspect emails
      # http://mailcatcher.me
      # Usage:
      #   gem install mailcatcher
      #   mailcatcher
      #   # => Starting MailCatcher
      #   # => ==> smtp://127.0.0.1:1025
      #   # => ==> http://127.0.0.1:1080
      config.action_mailer.delivery_method = :smtp
      config.action_mailer.smtp_settings = {host: "localhost", port: 1025}
    end
    
  • Update Procfile.dev:

    web: bundle exec rails server
    - worker: bundle exec sidekiq
    + worker: bundle exec sidekiq -q default -q heya
    webpack: bundle exec bin/webpack-dev-server
  • Run the servers:

    mailcatcher
    foreman start
  • Open these tabs:

  • Sign up for an account: http://localhost:5000/users/sign_up

You should see the welcome email in MailCatcher. To send the next 3 emails, run rails heya:scheduler periodically (the emails are sent every 2 days by default, unless you customize it).

@swagner2
Copy link

swagner2 commented Dec 9, 2021

Implemented this today. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment