Browse Source

chore(api): update email templates

pull/72/head
isra el 11 months ago
parent
commit
1f8893d3c5
  1. 147
      api/src/mail/templates/inactive-new-user-day-10.hbs
  2. 85
      api/src/mail/templates/inactive-new-user-day-3.hbs
  3. 181
      api/src/mail/templates/inactive-new-user.hbs
  4. 276
      api/src/mail/templates/upgrade-to-pro.hbs
  5. 277
      api/src/mail/templates/welcome-1.hbs
  6. 55
      api/src/users/users.service.ts

147
api/src/mail/templates/inactive-new-user-day-10.hbs

@ -0,0 +1,147 @@
<html>
<head>
<meta charset='utf-8' />
<meta name='viewport' content='width=device-width, initial-scale=1.0' />
<title>How to Get the Most from textbee.dev</title>
<style>
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
line-height: 1.6; color: #333; margin: 0; padding: 0; background-color:
#f7f9fc; } .container { max-width: 600px; margin: 0 auto; padding: 20px; }
.header { text-align: center; padding: 20px 0; } .logo { max-width: 150px;
} .content { background-color: #ffffff; padding: 35px; border-radius: 8px;
box-shadow: 0 2px 10px rgba(0,0,0,0.05); } .button { display:
inline-block; background-color: #4A90E2; color: white; text-decoration:
none; padding: 12px 28px; border-radius: 4px; font-weight: 600; margin:
25px 0; transition: background-color 0.3s ease; } .button:hover {
background-color: #3A80D2; } .footer { text-align: center; font-size:
12px; color: #777; margin-top: 30px; } .use-case-container { border: 1px
solid #e0e6ed; border-radius: 8px; margin: 25px 0; overflow: hidden; }
.use-case-header { background-color: #f0f7ff; padding: 15px 20px;
border-bottom: 1px solid #e0e6ed; } .use-case-header h3 { margin: 0;
color: #4A90E2; } .use-case-body { padding: 20px; } .code-block {
background-color: #f5f7f9; padding: 12px; border-radius: 4px; font-family:
monospace; font-size: 14px; margin: 10px 0; overflow-x: auto; }
.help-offer { background-color: #f6fbff; border-left: 4px solid #4A90E2;
padding: 20px; margin: 30px 0; } .social-links { margin-top: 20px; }
.social-links a { display: inline-block; margin: 0 10px; color: #4A90E2;
text-decoration: none; }
</style>
</head>
<body>
<div class='container'>
<div class='header'>
<!-- Logo could be added here -->
</div>
<div class='content'>
<h2>Hello {{name}},</h2>
<p>We noticed you haven't started using textbee.dev yet. We'd love to
help you get started!</p>
<p>Many of our users find these specific use cases particularly
valuable:</p>
<div class='use-case-container'>
<div class='use-case-header'>
<h3>Example: Order Notification System</h3>
</div>
<div class='use-case-body'>
<p>Let's say you run an e-commerce site and want to send order
updates via SMS:</p>
<div class='code-block'>
// Send notification when order status changes<br />
const response = await
axios.post('https://api.textbee.dev/api/v1/gateway/{DEVICE_ID}/send-sms',
{<br />
&nbsp;&nbsp;recipients: ['+1234567890'],<br />
&nbsp;&nbsp;message: 'Your order #12345 has been shipped! Track at
example.com/track/12345'<br />
});
</div>
<p>This simple integration can significantly improve customer
satisfaction!</p>
</div>
</div>
<div class='use-case-container'>
<div class='use-case-header'>
<h3>Example: Two-Factor Authentication</h3>
</div>
<div class='use-case-body'>
<p>Enhance your application security with SMS verification codes:</p>
<div class='code-block'>
// Generate a random 6-digit code<br />
const verificationCode = Math.floor(100000 + Math.random() *
900000);<br /><br />
// Send it via SMS<br />
await
axios.post('https://api.textbee.dev/api/v1/gateway/{DEVICE_ID}/send-sms',
{<br />
&nbsp;&nbsp;recipients: ['+1234567890'],<br />
&nbsp;&nbsp;message: `Your verification code is:
${verificationCode}`<br />
});
</div>
</div>
</div>
<p style="text-align: center; margin-top: 20px;">
<a href="https://textbee.dev/use-cases" style="color: #4A90E2; text-decoration: underline;">
Explore more use cases →
</a>
</p>
<div class='help-offer'>
<h3>Have questions?</h3>
<p>Feel free to reply to this email, I'll be happy to help you get
started.</p>
</div>
<p>If you prefer to explore on your own, here's how to get started:</p>
<ol>
<li><strong>Download our Android app</strong>
from
<a href='https://dl.textbee.dev'>dl.textbee.dev</a></li>
<li><strong>Log in to your dashboard</strong>
at
<a href='https://textbee.dev/dashboard'>textbee.dev/dashboard</a>
and generate a QR code</li>
<li><strong>Scan the QR code</strong>
with the app to connect your device</li>
</ol>
<p style="text-align: center; margin: 20px 0;">
<a href="https://textbee.dev/docs/quick-start" style="color: #4A90E2; text-decoration: underline;">
View our Quick Start Guide →
</a>
</p>
<div style='text-align: center;'>
<a href='https://textbee.dev/dashboard' class='button'>Access Your
Dashboard</a>
</div>
<p>If you have any questions or need help with setup, please don't
hesitate to reach out. We're here to ensure you get the most out of
textbee.dev.</p>
<p>Best regards,<br />The textbee.dev Team</p>
<div class='social-links'>
<a href='https://discord.gg/d7vyfBpWbQ'>Join our Discord Community</a>
|
<a href='https://github.com/vernu/textbee'>Star us on GitHub</a>
</div>
</div>
<div class='footer'>
<p>© 2025 textbee.dev. All rights reserved.</p>
</div>
</div>
</body>
</html>

85
api/src/mail/templates/inactive-new-user-day-3.hbs

@ -1,85 +0,0 @@
<html>
<head>
<meta charset='utf-8' />
<meta name='viewport' content='width=device-width, initial-scale=1.0' />
<title>Get Started with textbee.dev</title>
<style>
body { font-family: Arial, sans-serif; line-height: 1.6; color: #333;
margin: 0; padding: 0; } .container { max-width: 600px; margin: 0 auto;
padding: 20px; } .header { text-align: center; padding: 20px 0; } .logo {
max-width: 150px; } .content { background-color: #f9f9f9; padding: 30px;
border-radius: 5px; } .button { display: inline-block; background-color:
#4A90E2; color: white; text-decoration: none; padding: 12px 24px;
border-radius: 4px; font-weight: bold; margin: 20px 0; } .footer {
text-align: center; font-size: 12px; color: #777; margin-top: 30px; }
.steps { margin: 20px 0; } .step { margin-bottom: 15px; } .step-number {
display: inline-block; width: 25px; height: 25px; background-color:
#4A90E2; color: white; border-radius: 50%; text-align: center;
line-height: 25px; margin-right: 10px; }
</style>
</head>
<body>
<div class='container'>
<div class='header'>
</div>
<div class='content'>
<h2>Hello {{name}},</h2>
<p>We noticed it's been 3 days since you signed up for textbee.dev, but
you haven't registered any devices yet.</p>
<p>We'd love to help you get the most out of our platform! With
textbee.dev, you can:</p>
<ul>
<li>Send and receive SMS messages from your dashboard or API</li>
<li>Receive SMS notifications with webhooks</li>
<li>Integrate SMS functionality into your applications</li>
<li>And much more!</li>
</ul>
<p>Getting started is quick and easy:</p>
<div class='steps'>
<div class='step'>
<span class='step-number'>1</span>
Install the textbee.dev android app on your device
</div>
<div class='step'>
<span class='step-number'>2</span>
Grant the necessary permissions
</div>
<div class='step'>
<span class='step-number'>3</span>
Login to your
<a href='{{registerDeviceUrl}}'>dashboard</a>
and generate a QR code
</div>
<div class='step'>
<span class='step-number'>4</span>
Scan the QR code with the app to register your device
</div>
<div class='step'>
<span class='step-number'>5</span>
Start sending and receiving SMS!
</div>
</div>
<div style='text-align: center;'>
<a href='{{registerDeviceUrl}}' class='button'>Register Your Device
Now</a>
</div>
<p>Is there anything we can help you with? If you're experiencing any
issues or have questions, our support team is ready to assist at
<a href='mailto:support@textbee.dev'>support@textbee.dev</a>.</p>
<p>Best regards,<br />The textbee.dev Team</p>
</div>
<div class='footer'>
<p>© 2025 textbee.dev. All rights reserved.</p>
</div>
</div>
</body>
</html>

181
api/src/mail/templates/inactive-new-user.hbs

@ -2,81 +2,166 @@
<head>
<meta charset='utf-8' />
<meta name='viewport' content='width=device-width, initial-scale=1.0' />
<title>Get Started with textbee.dev</title>
<title>Getting Started with textbee.dev</title>
<style>
body { font-family: Arial, sans-serif; line-height: 1.6; color: #333;
margin: 0; padding: 0; } .container { max-width: 600px; margin: 0 auto;
padding: 20px; } .header { text-align: center; padding: 20px 0; } .logo {
max-width: 150px; } .content { background-color: #f9f9f9; padding: 30px;
border-radius: 5px; } .button { display: inline-block; background-color:
#4A90E2; color: white; text-decoration: none; padding: 12px 24px;
border-radius: 4px; font-weight: bold; margin: 20px 0; } .footer {
text-align: center; font-size: 12px; color: #777; margin-top: 30px; }
.steps { margin: 20px 0; } .step { margin-bottom: 15px; } .step-number {
display: inline-block; width: 25px; height: 25px; background-color:
#4A90E2; color: white; border-radius: 50%; text-align: center;
line-height: 25px; margin-right: 10px; }
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
line-height: 1.6;
color: #333;
margin: 0;
padding: 0;
background-color: #f7f9fc;
}
.container {
max-width: 600px;
margin: 0 auto;
padding: 20px;
}
.header {
text-align: center;
padding: 20px 0;
}
.logo {
max-width: 150px;
}
.content {
background-color: #ffffff;
padding: 35px;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.button {
display: inline-block;
background-color: #4A90E2;
color: white;
text-decoration: none;
padding: 12px 28px;
border-radius: 4px;
font-weight: 600;
margin: 25px 0;
transition: background-color 0.3s ease;
}
.button:hover {
background-color: #3A80D2;
}
.footer {
text-align: center;
font-size: 12px;
color: #777;
margin-top: 30px;
}
.value-prop {
background-color: #f0f7ff;
padding: 20px;
border-radius: 6px;
margin: 25px 0;
}
.value-prop h3 {
color: #4A90E2;
margin-top: 0;
}
.help-section {
margin: 30px 0;
padding: 20px;
background-color: #f9f9f9;
border-radius: 6px;
}
.help-section h3 {
margin-top: 0;
}
.use-case {
margin-bottom: 15px;
}
.use-case-icon {
display: inline-block;
width: 24px;
height: 24px;
background-color: #4A90E2;
color: white;
border-radius: 50%;
text-align: center;
line-height: 24px;
margin-right: 10px;
font-weight: bold;
}
.social-links {
margin-top: 20px;
}
.social-links a {
display: inline-block;
margin: 0 10px;
color: #4A90E2;
text-decoration: none;
}
</style>
</head>
<body>
<div class='container'>
<div class='header'>
<!-- Logo could be added here -->
</div>
<div class='content'>
<h2>Hello {{name}},</h2>
<p>Thank you for signing up for textbee.dev! We noticed you haven't
registered any devices yet.</p>
<p>Thank you for creating your textbee.dev account! We're excited to have you with us.</p>
<p>With textbee.dev, you can:</p>
<ul>
<li>Send and receive SMS messages from your dashboard or API</li>
<li>Receive SMS notifications with webhooks</li>
<li>Integrate SMS functionality into your applications</li>
<li>And much more!</li>
</ul>
<p>To get started, you'll need to register your first device:</p>
<div class="value-prop">
<h3>What can you do with textbee.dev?</h3>
<p>Our users are leveraging textbee.dev to:</p>
<div class='steps'>
<div class='step'>
<span class='step-number'>1</span>
Install the textbee.dev android app on your device
</div>
<div class='step'>
<span class='step-number'>2</span>
Grant the necessary permissions
</div>
<div class='step'>
<span class='step-number'>3</span>
Login to your <a href='{{registerDeviceUrl}}'>dashboard</a> and generate a QR code
<div class="use-case">
<div class="use-case-icon">1</div>
<strong>Send notifications and alerts</strong> - Keep customers informed about orders, appointments, and more
</div>
<div class='step'>
<span class='step-number'>4</span>
Scan the QR code with the app to register your device
<div class="use-case">
<div class="use-case-icon">2</div>
<strong>Implement 2FA with SMS verification</strong> - Add an extra layer of security to your applications
</div>
<div class='step'>
<span class='step-number'>5</span>
Start sending and receiving SMS!
<div class="use-case">
<div class="use-case-icon">3</div>
<strong>Build interactive SMS workflows</strong> - Create engaging experiences for your users
</div>
</div>
<p>Getting started with textbee.dev is straightforward:</p>
<ol>
<li><strong>Install the Android app</strong> - Our app connects securely to your phone's SMS capabilities</li>
<li><strong>Register your device</strong> - A simple process using a QR code from your dashboard</li>
<li><strong>Start sending and receiving messages</strong> - Through our intuitive dashboard or API</li>
</ol>
<div style='text-align: center;'>
<a href='{{registerDeviceUrl}}' class='button'>Register Your Device
Now</a>
<a href='https://textbee.dev/dashboard' class='button'>Visit Your Dashboard</a>
</div>
<p>If you have any questions or need assistance, please don't hesitate
to contact our support team at
<a href='mailto:support@textbee.dev'>support@textbee.dev</a>.</p>
<div class="help-section">
<h3>Need help getting started?</h3>
<p>We've prepared resources to make your setup experience smooth:</p>
<ul>
<li><a href="https://textbee.dev/quickstart">Quick Start Guide</a> - Step-by-step instructions</li>
<li><a href="https://api.textbee.dev">API Documentation</a> - For developers</li>
<li><a href="https://textbee.dev/use-cases">Use Cases & Examples</a> - See what's possible</li>
</ul>
</div>
<p>If you have questions or run into any issues, I'm here to help. Just reply to this email or contact our support team at <a href='mailto:support@textbee.dev'>support@textbee.dev</a>.</p>
<p>Looking forward to seeing what you'll build with textbee.dev!</p>
<p>Best regards,<br />The textbee.dev Team</p>
<div class="social-links">
<a href="https://discord.gg/d7vyfBpWbQ">Join our Discord Community</a> |
<a href="https://github.com/vernu/textbee">Star us on GitHub</a>
</div>
</div>
<div class='footer'>
<p>© 2025 textbee.dev. All rights reserved.</p>
</div>
</div>
</body>

276
api/src/mail/templates/upgrade-to-pro.hbs

@ -2,128 +2,218 @@
<head>
<meta charset='utf-8' />
<meta name='viewport' content='width=device-width, initial-scale=1.0' />
<title>Upgrade to Pro - textbee.dev</title>
<title>Unlock More Capabilities with textbee.dev Pro</title>
<style>
body { font-family: Arial, sans-serif; line-height: 1.6; color: #333;
margin: 0; padding: 0; } .container { max-width: 600px; margin: 0 auto;
padding: 20px; } .header { text-align: center; padding: 20px 0; } .logo {
max-width: 150px; } .content { background-color: #f9f9f9; padding: 30px;
border-radius: 5px; } .button { display: inline-block; background-color:
#4A90E2; color: white; text-decoration: none; padding: 12px 24px;
border-radius: 4px; font-weight: bold; margin: 20px 0; } .footer {
text-align: center; font-size: 12px; color: #777; margin-top: 30px; }
.feature { margin-bottom: 15px; display: flex; align-items: center; }
.feature-icon { display: inline-block; width: 20px; height: 20px;
background-color: #4A90E2; color: white; border-radius: 50%; text-align:
center; line-height: 20px; margin-right: 10px; font-weight: bold; }
.comparison { width: 100%; border-collapse: collapse; margin: 20px 0; }
.comparison th, .comparison td { padding: 10px; text-align: center;
border-bottom: 1px solid #ddd; } .comparison th { background-color:
#f2f2f2; } .highlight { background-color: #e6f2ff; }
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
line-height: 1.6;
color: #333;
margin: 0;
padding: 0;
background-color: #f7f9fc;
}
.container {
max-width: 600px;
margin: 0 auto;
padding: 20px;
}
.header {
text-align: center;
padding: 20px 0;
}
.logo {
max-width: 150px;
}
.content {
background-color: #ffffff;
padding: 35px;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.button {
display: inline-block;
background-color: #4A90E2;
color: white;
text-decoration: none;
padding: 12px 28px;
border-radius: 4px;
font-weight: 600;
margin: 25px 0;
transition: background-color 0.3s ease;
}
.button:hover {
background-color: #3A80D2;
}
.secondary-button {
display: inline-block;
background-color: #ffffff;
color: #4A90E2;
border: 1px solid #4A90E2;
text-decoration: none;
padding: 11px 24px;
border-radius: 4px;
font-weight: 600;
margin: 25px 10px;
transition: background-color 0.3s ease;
}
.secondary-button:hover {
background-color: #f0f7ff;
}
.footer {
text-align: center;
font-size: 12px;
color: #777;
margin-top: 30px;
}
.testimonial {
border-left: 4px solid #4A90E2;
padding: 15px 20px;
margin: 25px 0;
background-color: #f8fbff;
font-style: italic;
}
.testimonial-author {
font-weight: 600;
font-style: normal;
margin-top: 10px;
}
.pro-feature {
display: flex;
align-items: flex-start;
margin: 15px 0;
}
.feature-icon {
width: 24px;
height: 24px;
background-color: #4A90E2;
border-radius: 50%;
color: white;
text-align: center;
line-height: 24px;
margin-right: 15px;
flex-shrink: 0;
}
.feature-content {
flex-grow: 1;
}
.feature-content h4 {
margin: 0 0 5px 0;
}
.feature-content p {
margin: 0;
color: #555;
}
.pricing-container {
background-color: #f0f7ff;
border-radius: 8px;
padding: 20px;
margin: 25px 0;
text-align: center;
}
.pricing-option {
display: inline-block;
background-color: white;
border-radius: 6px;
padding: 20px;
margin: 10px;
width: 150px;
box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}
.pricing-discount {
color: #e63946;
font-weight: bold;
}
.social-links {
margin-top: 20px;
}
.social-links a {
display: inline-block;
margin: 0 10px;
color: #4A90E2;
text-decoration: none;
}
</style>
</head>
<body>
<div class='container'>
<div class='header'>
<!-- Logo could be added here -->
</div>
<div class='content'>
<h2>Hello {{name}},</h2>
<p>Thank you for using textbee.dev! We hope you're enjoying our service
so far.</p>
<p>Thank you for using textbee.dev! We're excited to see that you've been using our platform with {{deviceCount}} connected device{{#if deviceCount > 1}}s{{/if}}.</p>
<p>We wanted to let you know that you're currently on our
<strong>Free Plan</strong>, which provides basic functionality. To
unlock the full potential of textbee.dev, consider upgrading to our
<strong>Pro Plan</strong>.</p>
<p>Many of our users have found that upgrading to Pro helps them scale their SMS capabilities more effectively as they grow. Here's what you can unlock:</p>
<p><strong>Special Offer Just For You:</strong>
We're extending a
<span style='color: #e63946; font-weight: bold;'>30% discount</span>
on all Pro plans exclusively for our most active users like you! This
offer is only available for a limited time.</p>
<div class="pro-feature">
<div class="feature-icon">✓</div>
<div class="feature-content">
<h4>Unlimited Daily Messages</h4>
<p>Remove the 50-message daily limit and scale your SMS communications as needed</p>
</div>
</div>
<h3>Plan Comparison:</h3>
<div class="pro-feature">
<div class="feature-icon">✓</div>
<div class="feature-content">
<h4>Connect Multiple Devices</h4>
<p>
Connect multiple devices to your account to increase your SMS sending capacity.
</p>
</div>
</div>
<table class='comparison'>
<tr>
<th>Feature</th>
<th>Free Plan</th>
<th class='highlight'>Pro Plan</th>
</tr>
<tr>
<td>Daily Message Limit</td>
<td>50</td>
<td class='highlight'>Unlimited</td>
</tr>
<tr>
<td>Monthly Recipient Limit</td>
<td>500</td>
<td class='highlight'>5,000</td>
</tr>
<tr>
<td>Device Limit</td>
<td>1</td>
<td class='highlight'>Unlimited</td>
</tr>
<tr>
<td>Bulk SMS Recipients</td>
<td>50</td>
<td class='highlight'>Unlimited</td>
</tr>
<tr>
<td>Support</td>
<td>Basic</td>
<td class='highlight'>Priority</td>
</tr>
<div class="pro-feature">
<div class="feature-icon">✓</div>
<div class="feature-content">
<h4>Priority Support</h4>
<p>Get faster responses and dedicated assistance for your integration questions</p>
</div>
</div>
</table>
<div class="testimonial">
"textbee.dev Pro has been game-changing for our delivery notifications. We've seen a 28% increase in customer satisfaction since implementing automated SMS updates."
<div class="testimonial-author">- Sarah K., E-commerce Business Owner</div>
</div>
<p>As a valued user, we're offering you a special <span class="pricing-discount">30% discount</span> if you upgrade in the next 7 days:</p>
<div
style='background-color: #e6f2ff; padding: 15px; border-radius: 5px; margin-bottom: 20px; text-align: center;'
>
<h3 style='margin-top: 0; margin-bottom: 10px; color: #4A90E2;'>Pro
Plan Pricing</h3>
<div style='display: flex; justify-content: center; gap: 15px;'>
<div
style='padding: 10px; background-color: white; border-radius: 5px; flex: 1; max-width: 130px;'
>
<h4 style='margin: 0 0 5px 0;'>Monthly</h4>
<p style='font-size: 18px; font-weight: bold; margin: 5px 0;'><s
>$9.99</s>
<span style='color: #e63946;'>$6.99</span></p>
<p style='font-size: 11px; color: #666; margin: 0;'>30% off -
limited time</p>
</div>
<div
style='padding: 10px; background-color: white; border-radius: 5px; flex: 1; max-width: 130px;'
>
<h4 style='margin: 0 0 5px 0;'>Annual</h4>
<p style='font-size: 18px; font-weight: bold; margin: 5px 0;'><s
>$99.99</s>
<span style='color: #e63946;'>$69.99</span></p>
<p style='font-size: 11px; color: #666; margin: 0;'>30% off -
limited time</p>
<div class="pricing-container">
<div class="pricing-option">
<h4>Monthly</h4>
<p style="text-decoration: line-through; color: #777; margin: 5px 0;">$9.99/mo</p>
<p style="font-size: 18px; font-weight: bold; margin: 5px 0;">$6.99/mo</p>
<p style="font-size: 12px; color: #666;">30% savings</p>
</div>
<div class="pricing-option">
<h4>Annual</h4>
<p style="text-decoration: line-through; color: #777; margin: 5px 0;">$99.99/yr</p>
<p style="font-size: 18px; font-weight: bold; margin: 5px 0;">$69.99/yr</p>
<p style="font-size: 12px; color: #666;">Save 42% vs monthly</p>
</div>
</div>
<div style='text-align: center;'>
<a href='{{upgradeUrl}}' class='button'>Upgrade to Pro Now</a>
<p><small>Hurry! This 30% discount offer is only available for a
limited time.</small></p>
<a href='https://textbee.dev/checkout/pro' class='button'>Upgrade to Pro</a>
<a href='https://textbee.dev/#pricing' class='secondary-button'>Learn More</a>
</div>
<p>If you have any questions about our plans or need assistance, please
feel free to contact us at
<a href='mailto:support@textbee.dev'>support@textbee.dev</a>.</p>
<p>Not ready to upgrade? That's completely fine! Your free plan will continue to work as usual. If you have any questions about the Pro features or need help with your current setup, I'm happy to assist.</p>
<p>Best regards,<br />The textbee.dev Team</p>
<div class="social-links">
<a href="https://discord.gg/d7vyfBpWbQ">Join our Discord Community</a> |
<a href="https://github.com/vernu/textbee">Star us on GitHub</a>
</div>
</div>
<div class='footer'>
<p>© 2025 textbee.dev.</p>
<p>© 2025 textbee.dev. All rights reserved.</p>
<p style="font-size: 10px; color: #999;">You're receiving this email because you have an active textbee.dev account. To update your preferences, visit your <a href="https://textbee.dev/account/notifications">account settings</a>.</p>
</div>
</div>
</body>

277
api/src/mail/templates/welcome-1.hbs

@ -1,126 +1,207 @@
<html>
<head>
<meta charset='utf-8' />
<meta name='viewport' content='width=device-width, initial-scale=1.0' />
<title>Welcome to textbee.dev</title>
<style>
body {
font-family: Arial, sans-serif;
line-height: 1.6;
color: #333333;
max-width: 600px;
margin: 0 auto;
padding: 20px;
}
.container {
background-color: #ffffff;
border-radius: 8px;
padding: 30px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.header {
text-align: center;
margin-bottom: 30px;
}
.divider {
border-top: 1px solid #e0e0e0;
margin: 20px 0;
}
.community-section {
text-align: center;
}
.tips-section {
margin: 20px 0;
}
.tips-section ol {
padding-left: 20px;
}
.signature {
margin-top: 20px;
}
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
line-height: 1.6; color: #333; margin: 0; padding: 0; background-color:
#f7f9fc; } .container { max-width: 600px; margin: 0 auto; padding: 20px; }
.header { text-align: center; padding: 20px 0; } .logo { max-width: 150px;
} .content { background-color: #ffffff; padding: 35px; border-radius: 8px;
box-shadow: 0 2px 10px rgba(0,0,0,0.05); } .button { display:
inline-block; background-color: #4A90E2; color: white; text-decoration:
none; padding: 12px 28px; border-radius: 4px; font-weight: 600; margin:
25px 0; transition: background-color 0.3s ease; } .button:hover {
background-color: #3A80D2; } .footer { text-align: center; font-size:
12px; color: #777; margin-top: 30px; } .welcome-banner { background-color:
#4A90E2; color: white; padding: 30px; text-align: center; border-radius:
8px 8px 0 0; margin: -35px -35px 30px -35px; } .welcome-banner h1 {
margin: 0; font-size: 28px; letter-spacing: 0.5px; } .welcome-banner p {
margin: 10px 0 0 0; opacity: 0.9; } .divider { border-top: 1px solid
#e0e0e0; margin: 25px 0; } .quick-links { display: flex; flex-wrap: wrap;
justify-content: space-between; margin: 25px 0; } .quick-link {
background-color: #f8f9fa; border: 1px solid #e6e8eb; border-radius: 6px;
padding: 15px; margin-bottom: 15px; width: calc(50% - 45px);
text-decoration: none; color: #333; transition: all 0.2s ease; }
.quick-link:hover { background-color: #f0f7ff; border-color: #4A90E2;
transform: translateY(-2px); } .quick-link h3 { margin: 0 0 5px 0; color:
#4A90E2; font-size: 16px; } .quick-link p { margin: 0; font-size: 14px;
color: #666; } .steps-container { background-color: #f8f9fa;
border-radius: 8px; padding: 20px; margin: 25px 0; } .steps-container h2 {
margin-top: 0; color: #333; font-size: 18px; } .step { display: flex;
margin-bottom: 20px; } .step:last-child { margin-bottom: 0; } .step-number
{ background-color: #4A90E2; color: white; width: 28px; height: 28px;
border-radius: 50%; display: flex; align-items: center; justify-content:
center; font-weight: bold; margin-right: 15px; flex-shrink: 0; }
.step-content { flex-grow: 1; } .step-content h3 { margin: 0 0 5px 0;
font-size: 16px; } .step-content p { margin: 0; color: #555; font-size:
14px; } .personal-note { background-color: #f6fbff; border-left: 4px solid
#4A90E2; padding: 20px; margin: 30px 0; } .signature { margin-top: 30px;
display: flex; align-items: center; } .signature-text { margin-left: 15px;
} .signature-text h3 { margin: 0 0 5px 0; } .signature-text p { margin: 0;
color: #666; font-style: italic; } .signature-img { width: 60px; height:
60px; border-radius: 50%; object-fit: cover; } .social-links { margin-top:
20px; display: flex; justify-content: center; flex-wrap: wrap; }
.social-links a { display: inline-flex; align-items: center; margin: 0
10px 10px 10px; color: #4A90E2; text-decoration: none; padding: 8px 15px;
border-radius: 4px; background-color: #f0f7ff; transition: all 0.2s ease;
} .social-links a:hover { background-color: #e0ebfa; } .social-links img {
width: 18px; height: 18px; margin-right: 8px; } .use-case { margin: 20px
0; padding: 15px; background-color: #f9f9f9; border-radius: 6px; }
.use-case h3 { margin-top: 0; color: #4A90E2; } @media (max-width: 550px)
{ .quick-link { width: 100%; } }
</style>
</head>
<body>
<div class='container'>
<div class='header'>
<h1>Welcome to TextBee!</h1>
<!-- Logo could be added here -->
</div>
<p>Hi {{name}},</p>
<div class='content'>
<div class='welcome-banner'>
<h1>Welcome to textbee.dev!</h1>
<p>Your gateway to powerful SMS integration</p>
</div>
<h2>Hi {{name}},</h2>
<p>It's Vernu here, creator of textbee.dev. I built this platform to help you
with all your messaging needs - whether it's sending OTPs,
notifications, or creating automated messaging workflows for your
business.</p>
<p>Welcome to textbee.dev! This platform is designed to provide simple
yet powerful SMS integration for developers and businesses of all
sizes.</p>
<div class='tips-section'>
<h3>Here are a few tips to get you started:</h3>
<ol>
<li><a href='https://github.com/vernu/textbee'>Explore our
Documentation</a>
- Learn how to integrate TextBee with your existing systems</li>
<li><a href='https://dl.textbee.dev'>Download the Mobile App</a></li>
<li><a href='https://textbee.dev/dashboard'>Access your Dashboard</a></li>
<li><a href='https://discord.gg/d7vyfBpWbQ'>Join our Discord Community</a></li>
<li><a href='https://www.patreon.com/vernu'>Support Our Work</a></li>
<li><a href='https://github.com/vernu/textbee'>Star our GitHub
Repository</a></li>
</ol>
<div class='personal-note'>
<p>Thank you for choosing textbee.dev. We're excited to support your
projects, whether you're building authentication systems for your
customers, notifications, or interactive workflows!</p>
</div>
<div class='divider'></div>
<h2>What You Can Build with textbee.dev</h2>
<p>
<strong>P.S.</strong>
I'd love to hear from you! Why did you choose TextBee? Do you have any
feedback or questions?<br />
Feel free to reach out to our support team at
<a href='mailto:contact@textbee.dev'>contact@textbee.dev</a>.<br />
We read and respond to all emails as quickly as possible.
</p>
<div class='use-case'>
<h3>User Authentication</h3>
<p>Implement secure two-factor authentication with SMS verification
codes to protect user accounts and sensitive data.</p>
</div>
<div class='signature'>
<p>
Cheers,<br />
<strong>Vernu</strong><br />
Creator, textbee.dev
<div class='use-case'>
<h3>Customer Notifications</h3>
<p>Send automated order updates, appointment reminders, delivery
status changes, and other important alerts directly to your
customers' phones.</p>
</div>
<div class='use-case'>
<h3>Interactive Workflows</h3>
<p>Create conversational experiences where users can reply to messages
to complete tasks, answer surveys, or trigger automated responses.</p>
</div>
<p style='text-align: center; margin-top: 15px;'>
<a
href='https://textbee.dev/use-cases'
style='color: #4A90E2; text-decoration: underline;'
>Explore more use cases →</a>
</p>
<h2>Get Started in Minutes</h2>
<div class='steps-container'>
<h2>Quick Setup Guide</h2>
<div class='step'>
<div class='step-number'>1</div>
<div class='step-content'>
<h3>Download the App</h3>
<p>Install our Android app from
<a href='https://dl.textbee.dev'>dl.textbee.dev</a></p>
</div>
</div>
<div class='step'>
<div class='step-number'>2</div>
<div class='step-content'>
<h3>Connect Your Device</h3>
<p>Visit your dashboard, generate a QR code, and scan it with the
app</p>
</div>
</div>
<div class='step'>
<div class='step-number'>3</div>
<div class='step-content'>
<h3>Start Sending</h3>
<p>Send SMS messages via our dashboard or integrate with our API</p>
</div>
</div>
</div>
<div style='text-align: center;'>
<a href='https://textbee.dev/dashboard' class='button'>Go to Your
Dashboard</a>
</div>
<div class='divider'></div>
<div class='community-section'>
<p style='font-size: 14px; margin-bottom: 15px;'>Join our community!</p>
<a
href='https://discord.gg/d7vyfBpWbQ'
style='display: inline-block; margin: 0 10px; color: #7289DA; text-decoration: none;'
>
<img
src='https://cdn.prod.website-files.com/6257adef93867e50d84d30e2/636e0a6918e57475a843f59f_icon_clyde_black_RGB.svg'
alt='Discord'
style='width: 20px; vertical-align: middle;'
/>
Join Discord
<h2>Helpful Resources</h2>
<div class='quick-links'>
<a href='https://textbee.dev/quickstart' class='quick-link'>
<h3>Quick Start Guide</h3>
<p>Step-by-step setup instructions</p>
</a>
<a
href='https://github.com/vernu/textbee'
style='display: inline-block; margin: 0 10px; color: #333; text-decoration: none;'
>
<img
src='https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png'
alt='GitHub'
style='width: 20px; vertical-align: middle;'
/>
Star on GitHub
<a href='https://api.textbee.dev' class='quick-link'>
<h3>API Documentation</h3>
<p>Integrate SMS into your applications</p>
</a>
<a
href='https://patreon.com/vernu'
style='display: inline-block; margin: 0 10px; color: #FF424D; text-decoration: none;'
>
<a href='https://github.com/vernu/textbee' class='quick-link'>
<h3>GitHub Repository</h3>
<p>Explore the code and contribute</p>
</a>
<a href='https://discord.gg/d7vyfBpWbQ' class='quick-link'>
<h3>Discord Community</h3>
<p>Get help and share ideas</p>
</a>
<a href='https://textbee.dev/use-cases' class='quick-link'>
<h3>Code Examples</h3>
<p>Ready-to-use integration samples</p>
</a>
<a href='https://textbee.dev/#faqs' class='quick-link'>
<h3>FAQ</h3>
<p>Answers to common questions</p>
</a>
</div>
<div class='divider'></div>
<p>Have questions or feedback? I'd love to hear from you! Feel free to
reply to this email or contact our support team at
<a href='mailto:support@textbee.dev'>support@textbee.dev</a>.</p>
<div class='signature'>
<img
src='https://c5.patreon.com/external/logo/downloads_logomark_color_on_white.png'
alt='Patreon'
style='width: 20px; vertical-align: middle;'
src='https://ui-avatars.com/api/?name=Vernu&background=4A90E2&color=fff'
class='signature-img'
alt='Vernu'
/>
Support on Patreon
</a>
<div class='signature-text'>
<h3>Vernu</h3>
<p>Founder, textbee.dev</p>
</div>
</div>
</div>
<div class='footer'>
<p>© 2025 textbee.dev. All rights reserved.</p>
<p>If you don't want to receive these emails, you can
<a href='https://textbee.dev/account/notifications'>update your
preferences</a>.</p>
</div>
</div>
</body>

55
api/src/users/users.service.ts

@ -75,43 +75,42 @@ export class UsersService {
@Cron('0 12 * * *') // Every day at 12 PM
async sendEmailToInactiveNewUsers() {
try {
// Get users who signed up between 24-48 hours ago (1-2 days ago)
const twoDaysAgo = new Date(Date.now() - 48 * 60 * 60 * 1000)
const oneDayAgo = new Date(Date.now() - 24 * 60 * 60 * 1000)
// Get users who signed up between 3-4 days ago (not 1-2 days)
const fourDaysAgo = new Date(Date.now() - 4 * 24 * 60 * 60 * 1000)
const threeDaysAgo = new Date(Date.now() - 3 * 24 * 60 * 60 * 1000)
const newUsers = await this.userModel.find({
createdAt: {
$gte: twoDaysAgo,
$lt: oneDayAgo,
$gte: fourDaysAgo,
$lt: threeDaysAgo,
},
})
const emailPromises = newUsers.map(async (user) => {
for (const user of newUsers) {
try {
// Check if user has any devices registered
// Check if user has any devices registered or has sent/received any SMS
const devices = await this.deviceModel.find({ user: user._id })
if (devices.length === 0) {
if (devices.length === 0 || devices.map(device=>device.sentSMSCount + device.receivedSMSCount).reduce((a,b)=>a+b,0) == 0) {
// User hasn't registered any device, send email
await this.mailService.sendEmailFromTemplate({
to: user.email,
subject:
'Get Started with textbee.dev - Register Your First Device',
'Getting Started with textbee.dev - How Can We Help?',
template: 'inactive-new-user',
context: {
name: user.name,
registerDeviceUrl: `${process.env.FRONTEND_URL}/dashboard`,
},
})
console.log(`Sent inactive new user email to ${user.email}`)
}
// Wait 200ms before processing the next user
await new Promise((resolve) => setTimeout(resolve, 200))
} catch (error) {
console.error(`Error processing email for user ${user.email}:`, error)
}
})
await Promise.allSettled(emailPromises)
}
} catch (error) {
console.error('Error sending emails to inactive new users:', error)
}
@ -120,18 +119,18 @@ export class UsersService {
@Cron('0 13 * * *') // Every day at 1 PM
async sendEmailToFreeUsers() {
try {
// Get users who signed up between 3-4 days ago
const threeDaysAgo = new Date(Date.now() - 3 * 24 * 60 * 60 * 1000)
const fourDaysAgo = new Date(Date.now() - 4 * 24 * 60 * 60 * 1000)
// Get users who signed up between 13-14 days ago
const fourteenDaysAgo = new Date(Date.now() - 14 * 24 * 60 * 60 * 1000)
const thirteenDaysAgo = new Date(Date.now() - 13 * 24 * 60 * 60 * 1000)
const usersToEmail = await this.userModel.find({
createdAt: {
$gte: fourDaysAgo,
$lt: threeDaysAgo,
$gte: fourteenDaysAgo,
$lt: thirteenDaysAgo,
},
})
const emailPromises = usersToEmail.map(async (user) => {
for (const user of usersToEmail) {
try {
const subscription = await this.billingService.getActiveSubscription(
user._id.toString(),
@ -140,11 +139,12 @@ export class UsersService {
if (subscription?.plan?.name === 'free') {
const devices = await this.deviceModel.find({ user: user._id })
if (devices.length === 0) {
if (devices.length === 0 || devices.map(device=>device.sentSMSCount + device.receivedSMSCount).reduce((a,b)=>a+b,0) == 0) {
// Only send this if they haven't set up any devices after 10-14 days
await this.mailService.sendEmailFromTemplate({
to: user.email,
subject: `${user.name?.split(' ')[0]}, Your textbee.dev account is waiting for you!`,
template: 'inactive-new-user-day-3',
subject: `${user.name?.split(' ')[0]}, we'd love to help you get started with textbee.dev`,
template: 'inactive-new-user-day-10',
context: {
name: user.name,
registerDeviceUrl: `${process.env.FRONTEND_URL}/dashboard`,
@ -153,24 +153,27 @@ export class UsersService {
console.log(`Sent inactive new user email to ${user.email}`)
} else {
// Only send upgrade email to active users who have at least one device
await this.mailService.sendEmailFromTemplate({
to: user.email,
subject: `${user.name?.split(' ')[0]}, Upgrade to Pro with a 30% Discount - textbee.dev`,
subject: `${user.name?.split(' ')[0]}, unlock more capabilities with textbee.dev Pro`,
template: 'upgrade-to-pro',
context: {
name: user.name,
upgradeUrl: `${process.env.FRONTEND_URL}/checkout/pro`,
deviceCount: devices.length,
},
})
console.log(`Sent upgrade to pro email to ${user.email}`)
}
}
// Wait 200ms before processing the next user
await new Promise((resolve) => setTimeout(resolve, 200))
} catch (error) {
console.error(`Error processing email for user ${user.email}:`, error)
}
})
await Promise.allSettled(emailPromises)
}
} catch (error) {
console.error('Error sending emails to free plan users:', error)
}

Loading…
Cancel
Save