Merged in 5631-signup-survey (pull request #61)

signup survey email sending

* signup survey email sending

Send new user survey email 24 hours after signup to all new users

* add config parameters

add config.signup_survey_url, config.signup_survey_cutoff_date
This commit is contained in:
Nuwan Chaturanga 2025-06-13 12:02:21 +00:00 committed by Seth Call
parent 0f556bfad4
commit 55372bf83d
9 changed files with 76 additions and 0 deletions

View File

@ -0,0 +1,8 @@
class AddSignupSurveySentAtToUsers < ActiveRecord::Migration
def self.up
execute "ALTER TABLE users ADD COLUMN signup_survey_sent_at TIMESTAMP"
end
def self.down
execute "ALTER TABLE users DROP COLUMN signup_survey_sent_at"
end
end

View File

@ -480,6 +480,16 @@ module JamRuby
end
end
def signup_survey(user)
@user = user
@subject = I18n.t('user_mailer.signup_survey.subject')
@survey_url = Rails.application.config.signup_survey_url
mail(:to => user.email, :subject => @subject) do |format|
format.text
format.html { render layout: "user_mailer_beta" }
end
end
#################################### NOTIFICATION EMAILS ####################################
def friend_request(user, msg, friend_request_id)
return if !user.subscribe_email

View File

@ -0,0 +1,18 @@
<p><%= I18n.t 'user_mailer.signup_survey.greeting' -%> <%= @user.first_name -%> -</p>
<p>
<%= I18n.t 'user_mailer.signup_survey.paragraph1' -%>
</p>
<p>
<%= @survey_url %>
</p>
<p>
<%= I18n.t 'user_mailer.signup_survey.ps' -%>
<%= I18n.t 'user_mailer.signup_survey.ps_text' -%>
</p>
<p><%= I18n.t 'user_mailer.signup_survey.regards' -%><br/>
<%= I18n.t 'user_mailer.signup_survey.signature' -%>
</p>

View File

@ -0,0 +1,11 @@
<%= I18n.t 'user_mailer.signup_survey.greeting' -%> <%= @user.first_name -%> -
<%= I18n.t 'user_mailer.signup_survey.paragraph1' -%>
<%= @survey_url %>
<%= I18n.t 'user_mailer.signup_survey.ps' -%>
<%= I18n.t 'user_mailer.signup_survey.ps_text' -%>
<%= I18n.t 'user_mailer.signup_survey.regards' -%>,
<%= I18n.t 'user_mailer.signup_survey.signature' -%>

View File

@ -0,0 +1,16 @@
module JamRuby
class EmailSignupSurvey
def self.send_survey
# if signup survey email has not been sent to this user, then send it
survey_users.each do |user|
UserMailer.signup_survey(user).deliver_now
user.update(signup_survey_sent_at: Time.now)
end
end
def self.survey_users
cutoff_date = Date.parse(Rails.application.config.signup_survey_cutoff_date) # Define a cutoff date for the survey
User.where("users.signup_survey_sent_at IS NULL AND users.created_at < ? AND users.created_at > ?", 1.days.ago, cutoff_date)
end
end
end

View File

@ -14,6 +14,7 @@ module JamRuby
User.hourly_check
AffiliatePartner.tally_up(Date.today)
EmailProfileReminder.send_reminders
EmailSignupSurvey.send_survey
ConnectionManager.new.cleanup_dangling
@@log.info("done")

View File

@ -520,6 +520,8 @@ if defined?(Bundler)
config.spa_origin_url = "http://beta.jamkazam.local:4000"
config.user_match_monitoring_email = "user_match_monitoring_email@jamkazam.com"
config.send_user_match_mail_only_to_jamkazam_team = true
config.signup_survey_url = "https://www.surveymonkey.com/r/WVBKLYL"
config.signup_survey_cutoff_date = "2025-06-10"
config.action_mailer.asset_host = config.action_controller.asset_host
end
end

View File

@ -126,4 +126,6 @@ SampleApp::Application.configure do
config.action_controller.asset_host = 'http://www.jamkazam.local:3000'
config.send_user_match_mail_only_to_jamkazam_team = false
config.signup_survey_url = "https://www.surveymonkey.com/r/WVBKLYL"
config.signup_survey_cutoff_date = "2025-06-10"
end

View File

@ -143,3 +143,11 @@ en:
If you have any trouble or feel confused about gear setup, you can email us for help at <a href="mailto:support@jamkazam.com">support@jamkazam.com</a>. You can also visit with a JamKazam support team member in our <a href="https://us02web.zoom.us/j/5967470315?pwd=eHZZL2hmVW1haUU5aTZTUUJobjFIdz09">weekly Zoom office hours</a>, which is offered every Wednesday from 11am to 12pm US Central Time.
regards: "Best Regards,"
signature: "JamKazam Team"
signup_survey:
subject: "Let us help you to be successful on JamKazam"
greeting: "Hi"
paragraph1: "Thanks for signing up to join our community of musicians! Please click the link below and take 2 minutes to let us know a little more about your goals. Our support team will use this information to provide tailored, individual help to you to make it faster and easier for you to be successful."
ps: "p.s."
ps_text: "If we can help in any way, please always feel free to contact us at"
regards: "Best Regards,"
signature: "JamKazam Team"