BLOGS
Lovable: Send SMS and Email Notifications from Lovable.dev
Learn how to implement secure SMS and email notifications in your Lovable.dev application using NotificationAPI and Supabase edge functions.

YouTube Walkthrough
In this tutorial, we’ll learn how to implement secure SMS and email notifications in your Lovable.dev application. We’ll use NotificationAPI for sending notifications and Supabase edge functions to ensure secure implementation.
Why Use Edge Functions for Notifications?
When implementing notifications in your application, it’s crucial to handle sensitive operations like sending SMS or emails securely. Frontend code is visible to everyone and can be modified by malicious users. This is why we need to use backend services like Supabase edge functions to handle these operations.
Step 1: Set Up NotificationAPI
First, create a NotificationAPI account. The service offers a generous free tier:
- 100 SMS messages per month
- 30,000 emails per month
No credit card required, and everything works out of the box.
Step 2: Modify and use this prompt
- Replace [When X happens] with the event that triggers the notification
- Replace [to recipient] with who should receive the notification, possibly explaining how Lovable should retreive their email and phone number
- If you have a back-end different from Supabase, replace the [a Supabase edge function]
- Replace [YOUR_CLIENT_ID] and [YOUR_CLIENT_SECRET] with your NotificationAPI credentials
Sample Prompt:
[When X happens], send an SMS and Email notification [to recipient] using the following code from [a Supabase edge function]:
import notificationapi from 'notificationapi-node-server-sdk';
notificationapi.init('[YOUR_CLIENT_ID]', '[YOUR_CLIENT_SECRET]');
await notificationapi.send({
type: 'alert', // type of notification
to: {
email: 'recipient@example.com', // recipient's email
number: '+15005550006', // recipient's number
},
email: {
subject: 'New contact form submission received',
html: '<p>New contact form submission received.</p>',
},
sms: {
message: 'New contact form submission received.',
},
});
Security Best Practices
When implementing notifications, follow these security guidelines:
-
Control Message Recipients
- Either limit who can receive messages (e.g., only to your team)
- Or control what the message says (use static templates)
-
Never Trust User Input
- Don’t include user-provided content in notification messages
- Use static templates for message content
-
Implement Rate Limiting
- Add limits to how many notifications a user can trigger
- Consider implementing user authentication for sensitive operations
Monitoring and Analytics
NotificationAPI provides built-in monitoring features:
- View delivery status
- Track open rates
- Monitor error rates
- Analyze notification performance
Conclusion
By following this guide, you’ve learned how to:
- Set up secure notification handling using edge functions
- Implement both SMS and email notifications
- Follow security best practices
- Monitor notification delivery
Remember to always handle sensitive operations like sending notifications through backend services, never directly from the frontend.
Feedback and support
If you have any questions or need help implementing notifications in your Lovable.dev application, feel free to reach out to us at support@notificationapi.com. We’re here to help you create the best notification experience for your users.