-
Notifications
You must be signed in to change notification settings - Fork 939
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
feat: send getting started email on signup #1877
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 2 Ignored Deployments
|
Thank you for following the naming conventions for pull request titles! 🙏 |
packages/lib/emails/emails.tsConsider 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. // 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),
});
packages/lib/authOptions.tsConsider refactoring the signIn function to separate the different scenarios into separate functions. This would make the code more readable and easier to maintain. // 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;
}
|
packages/lib/emails/emails.ts
Outdated
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> | ||
`), | ||
}); | ||
}; |
There was a problem hiding this comment.
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.
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), | |
}); | |
}; |
hey @ShubhamPalriwala - looks great! i changed my mind re the content of the mail:
Have a look at the updated version: Whats missing:
Cheers! |
@ShubhamPalriwala please trigger the mail later, ill test it afterwards :) |
…cesful-first-login' of github.com:formbricks/formbricks into shubham/for-1590-write-a-getting-started-mail-after-succesful-first-login
Hey @jobenjada, thanks for the review! I've made the following change:
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 |
…l-after-succesful-first-login
What does this PR do?
How should this be tested?
Run the branch & create a new user, now go to mailhog and view the email.
Screenshots
Checklist
Required
pnpm build
console.logs
git pull origin main
Appreciated