BLOGS

Lovable: Send SMS and Email Notifications from Lovable.dev

May 9, 2025

Learn how to implement secure SMS and email notifications in your Lovable.dev application using NotificationAPI and Supabase edge functions.

Lovable: Send SMS and Email Notifications from Lovable.dev

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:

No credit card required, and everything works out of the box.

Step 2: Modify and use this prompt

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:

  1. Control Message Recipients

    • Either limit who can receive messages (e.g., only to your team)
    • Or control what the message says (use static templates)
  2. Never Trust User Input

    • Don’t include user-provided content in notification messages
    • Use static templates for message content
  3. 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:

Conclusion

By following this guide, you’ve learned how to:

  1. Set up secure notification handling using edge functions
  2. Implement both SMS and email notifications
  3. Follow security best practices
  4. 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.