How to send notifications with Remix and React email
Learn how to send email notifications with Remix, React email and Novu
Introduction
Learn how to send notifications with Remix, React email and Novu. You can check out the complete code for a working app.
Prerequisites
- A Novu account
- Node installed on your machine
- A working Remix app
Follow these Steps
1. Install all dependencies including react email components
2. Integrate Novu with Remix
Within the app/routes
directory, create an api.novu.tsx
file.
3. Create an email template in your Remix app
Within the app
directory, create an emails
folder and add an email template file to it.
In this scenario, create a vercel-invite-user.tsx
file and the code below to it:
4. Create a Novu Workflow
Next, create a Novu workflow with an email step. This code-first notification workflow approach makes it easy for product teams to modify notification content.
Within the app
directory, create an novu
folder and add a workflows.ts
file to it. Copy/paste the code below to the recently created file.
5. Preview Email Workflow & Sync to Novu Cloud
Open Novu Dev Studio to preview and make changes to the email workflow as needed via the command below:
- Run the Studio
Novu Dev Studio on the first run
Note: Use the port on which your Remix app is running for the Bridge endpoint so that the Novu Dev Studio can connect to your API route as highlighted in the image above.
- Check out the signup email workflow and test
Preview Email workflow with Step Inputs & Payload
- Deploy to Novu Cloud when you’re done.
On the top right(as seen in the image above) of the Novu Dev Studio, you can sync to Novu Cloud when you’re done working locally.
Note: You’ll need to create a local tunnel that the Novu Cloud environment can reach for local experimentation purposes. Ngrok is a good tunnel.
6. Send a Notification
Trigger a notification using the recently deployed workflow either via your Novu Cloud dashboard or code.
Once you’ve built the workflow, you might want read one of our other guides on how to empower product teams to manage notification workflows.