Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: send getting started email on signup #1877

Conversation

ShubhamPalriwala
Copy link
Contributor

What does this PR do?

  • Sends a new Getting Started Email when users signup to the platform (irrespective of their auth provider)
  • Renames the Verify Email subject and removes the word "Welcome" from it.

How should this be tested?

Run the branch & create a new user, now go to mailhog and view the email.

Screenshots

image
image
image

Checklist

Required

  • Filled out the "How to test" section in this PR
  • Read How we Code at Formbricks
  • Self-reviewed my own code
  • Commented on my code in hard-to-understand bits
  • Ran pnpm build
  • Checked for warnings, there are none
  • Removed all console.logs
  • Merged the latest changes from main onto my branch with git pull origin main
  • My changes don't cause any responsiveness issues
  • First PR at Formbricks? Please sign the CLA! Without it we wont be able to merge it 🙏

Appreciated

  • If a UI change was made: Added a screen recording or screenshots to this PR
  • Updated the Formbricks Docs if changes were necessary

Copy link

vercel bot commented Jan 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

2 Ignored Deployments
Name Status Preview Comments Updated (UTC)
formbricks-cloud ⬜️ Ignored (Inspect) Visit Preview Jan 22, 2024 4:00pm
formbricks-com ⬜️ Ignored (Inspect) Visit Preview Jan 22, 2024 4:00pm

Copy link
Contributor

github-actions bot commented Jan 10, 2024

Thank you for following the naming conventions for pull request titles! 🙏

Copy link
Contributor

packages/lib/emails/emails.ts

Consider moving the email content to a separate file or a database. This way, you can manage the content separately, making it easier to update or localize the content in the future.
Create Issue
See the diff
Checkout the fix

    // Instead of hardcoding the email content, load it from a separate file or a database
    const emailContent = await loadEmailContent('gettingStarted');
    await sendEmail({
      to: user.email,
      subject: "Get started with Formbricks 🤍",
      html: withEmailTemplate(emailContent),
    });
git fetch origin && git checkout -b ReviewBot/The-c-r4h4k0s origin/ReviewBot/The-c-r4h4k0s

packages/lib/authOptions.ts

Consider refactoring the signIn function to separate the different scenarios into separate functions. This would make the code more readable and easier to maintain.
Create Issue
See the diff
Checkout the fix

    // Instead of having one large signIn function, separate the different scenarios into separate functions
    async signIn({ user, account }: any) {
      if (account.provider === "credentials" || account.provider === "token") {
        return this.handleCredentialsSignIn(user);
      }

      if (!user.email || !user.name || account.type !== "oauth") {
        return false;
      }

      if (account.provider) {
        return this.handleOAuthSignIn(user, account);
      }

      return true;
    }
git fetch origin && git checkout -b ReviewBot/The-c-mheoz19 origin/ReviewBot/The-c-mheoz19

Comment on lines 94 to 136
export const sendGettingStartedEmail = async (user: TEmailUserWithName) => {
await sendEmail({
to: user.email,
subject: "Get started with Formbricks 🤍",
html: withEmailTemplate(`
<p>Dear ${user.name || "friend"},</p>
<p>Welcome aboard, and thank you for choosing Formbricks - we’re thrilled to have you!</p>
<h4>First Impressions Count</h4>
<p>You’ve likely already had a look around Formbricks - love it! What's your first impression? Any issues getting started? Wanna share some love? Please <a href="https://app.formbricks.com/s/clqe9gpsi0572114z052uig9j?userId=${
user.email
}">leave a quick note for the team here</a>, takes literally 10 seconds 🤸</p>
<h3>No Matter the Channel, Formbricks Can Handle Your Feedback</h3>
<p>Our open source survey platform is really powerful. Run:</p>
<ul>
<li>Website Surveys like HotJar Ask</li>
<li>In-App Surveys like Sprig</li>
<li>Link Surveys like Typeform</li>
<li>Headless Surveys via API</li>
</ul>
<p>You're missing something? <a href="https://github.com/formbricks/formbricks/issues/new?assignees=&labels=enhancement&projects=&template=feature_request.yml&title=%5BFEATURE%5D"> Request it</a> and we'll build it 👷</p>
<b>Best Practices with Formbricks</b>
<p>We've created a list with the use cases which are most popular among Formbricks user. Maybe they inspire you to harvest more user insights as well:</p>
<ul>
<li><a href="https://formbricks.com/docs/best-practices/cancel-subscription">Learn from Churn</a></li>
<li><a href="https://formbricks.com/docs/best-practices/interview-prompt">Interview Prompts</a> with Power Users</li>
<li>Measure <a href="https://formbricks.com/docs/best-practices/pmf-survey">Product-Market Fit</a></li>
<li><a href="https://formbricks.com/docs/best-practices/improve-trial-cr">Improve Trial Conversion</a></li>
<li><a href="https://formbricks.com/docs/best-practices/feedback-box">Feedback Box</a></li>
<li><a href="https://formbricks.com/docs/best-practices/feature-chaser">Feature Follow Up</a></li>
<li><a href="https://formbricks.com/docs/best-practices/docs-feedback">Docs Feedback</a></li>
</ul>
<b>Join Our Community</b>
<p>Formbricks is powered by an open source survey platform. We're building it with our community - come and join us to share ideas, feedback and contribute.</p>
<a class="button" href="https://formbricks.com/discord">Join Discord</a><br/><br/>
<h2>Privacy-first Experience Management</h2>
<p>Your privacy and security are paramount. Formbricks is GDRP and CCPA compliant. We also make self-hosting really easy to maintain full control over your data. Feel free to reach out to <a href="mailto:privacy@formbricks.com">privacy@formbricks.com</a> with any questions.</p>
<p>Once again, <strong>welcome to the Formbricks family!</strong> We can’t wait to see what you’ll craft.</p>
<p>Life is too short for mediocre products,<br>
craft an irresistible experience.</p>
<p>The Formbricks Team</p>
`),
});
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved the hardcoded email content to a separate function for better manageability and updatability.

Suggested change
export const sendGettingStartedEmail = async (user: TEmailUserWithName) => {
await sendEmail({
to: user.email,
subject: "Get started with Formbricks 🤍",
html: withEmailTemplate(`
<p>Dear ${user.name || "friend"},</p>
<p>Welcome aboard, and thank you for choosing Formbricks - we’re thrilled to have you!</p>
<h4>First Impressions Count</h4>
<p>You’ve likely already had a look around Formbricks - love it! What's your first impression? Any issues getting started? Wanna share some love? Please <a href="https://app.formbricks.com/s/clqe9gpsi0572114z052uig9j?userId=${
user.email
}">leave a quick note for the team here</a>, takes literally 10 seconds 🤸</p>
<h3>No Matter the Channel, Formbricks Can Handle Your Feedback</h3>
<p>Our open source survey platform is really powerful. Run:</p>
<ul>
<li>Website Surveys like HotJar Ask</li>
<li>In-App Surveys like Sprig</li>
<li>Link Surveys like Typeform</li>
<li>Headless Surveys via API</li>
</ul>
<p>You're missing something? <a href="https://github.com/formbricks/formbricks/issues/new?assignees=&labels=enhancement&projects=&template=feature_request.yml&title=%5BFEATURE%5D"> Request it</a> and we'll build it 👷</p>
<b>Best Practices with Formbricks</b>
<p>We've created a list with the use cases which are most popular among Formbricks user. Maybe they inspire you to harvest more user insights as well:</p>
<ul>
<li><a href="https://formbricks.com/docs/best-practices/cancel-subscription">Learn from Churn</a></li>
<li><a href="https://formbricks.com/docs/best-practices/interview-prompt">Interview Prompts</a> with Power Users</li>
<li>Measure <a href="https://formbricks.com/docs/best-practices/pmf-survey">Product-Market Fit</a></li>
<li><a href="https://formbricks.com/docs/best-practices/improve-trial-cr">Improve Trial Conversion</a></li>
<li><a href="https://formbricks.com/docs/best-practices/feedback-box">Feedback Box</a></li>
<li><a href="https://formbricks.com/docs/best-practices/feature-chaser">Feature Follow Up</a></li>
<li><a href="https://formbricks.com/docs/best-practices/docs-feedback">Docs Feedback</a></li>
</ul>
<b>Join Our Community</b>
<p>Formbricks is powered by an open source survey platform. We're building it with our community - come and join us to share ideas, feedback and contribute.</p>
<a class="button" href="https://formbricks.com/discord">Join Discord</a><br/><br/>
<h2>Privacy-first Experience Management</h2>
<p>Your privacy and security are paramount. Formbricks is GDRP and CCPA compliant. We also make self-hosting really easy to maintain full control over your data. Feel free to reach out to <a href="mailto:privacy@formbricks.com">privacy@formbricks.com</a> with any questions.</p>
<p>Once again, <strong>welcome to the Formbricks family!</strong> We can’t wait to see what you’ll craft.</p>
<p>Life is too short for mediocre products,<br>
craft an irresistible experience.</p>
<p>The Formbricks Team</p>
`),
});
};
export const sendGettingStartedEmail = async (user: TEmailUserWithName) => {
const emailContent = await loadEmailContent('gettingStarted');
await sendEmail({
to: user.email,
subject: "Get started with Formbricks 🤍",
html: withEmailTemplate(emailContent),
});
};

@jobenjada
Copy link
Member

hey @ShubhamPalriwala - looks great!

i changed my mind re the content of the mail:

  • it was way too long
  • way too many different CTAs
  • we burned through all the content for the upcoming drip campaign :)

Have a look at the updated version:

image

Whats missing:

  1. Setup tracking of the individual CTAs to see how effective they are bringing users back 🤓
  2. Proper testing (team invite, oauth, signup with and without verification)
  3. The mail comes even before the Verify Email email. We should send it after the user is logged in and sees the dashboard, or even a bit later. Wouldn't be good to have two unread Formbricks email in the inbox, feels spammy.

Cheers!

@jobenjada
Copy link
Member

@ShubhamPalriwala please trigger the mail later, ill test it afterwards :)

@ShubhamPalriwala
Copy link
Contributor Author

Hey @jobenjada, thanks for the review! I've made the following change:

  • Users signing up via OAuth: They receive the welcome email instantly (since there's no other email that goes to them)
  • Users signing up via email & email verification is disabled: They receive the welcome email instantly (since there's no other email that goes to them)
  • Users signing up via email & email verification is enabled: They receive the welcome email after they verify their email

I have tested the above cases as well! Let me know if it's good to go now! I was also thinking that it'd be nice to do some personalisation in the email's subject ie Get Started with Formbricks Matti :emoji:, wdyt?

@jobenjada jobenjada added this pull request to the merge queue Jan 22, 2024
Merged via the queue into main with commit 64ddcb6 Jan 22, 2024
12 checks passed
@jobenjada jobenjada deleted the shubham/for-1590-write-a-getting-started-mail-after-succesful-first-login branch January 22, 2024 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants