signup survey email sending

Send new user survey email 24 hours after signup to all new users
This commit is contained in:
Nuwan 2025-06-08 20:10:33 +05:30
parent 817719d539
commit fb4babc957
7 changed files with 71 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 = "https://www.surveymonkey.com/r/WVBKLYL"
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,15 @@
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
User.where("users.signup_survey_sent_at IS NULL AND users.created_at < ?", 1.days.ago)
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

@ -142,4 +142,12 @@ en:
paragraph5: |
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"