How to send notifications with Next.js and Novu Framework
In this guide, we will add a Novu Bridge Endpoint to a Next.js application and send our first test workflow.
Run the Local Studio
The Local Studio is where you will build your notification workflows and craft the controls that will be exposed for your non-technical peers to maintain after your workflow is pushed to your Development or Production environments.
The dev
command is your go-to command whenever you want to build and preview your changes before syncing to cloud. By default, it will start a secure tunnel that our durable cloud workflow engine will
be able to communicate with, and the Local Studio web service listening on http://localhost:2022
Create a Next.js application
This link can be copied right from the onboarding guide on the Novu Studio or can always be copied from the API Keys page on the Novu Dashboard.
The sample application will create an .env
file containing the NOVU_SECRET_KEY
environment variable required
for securing your endpoint. And a sample workflow demonstrating the flexibility of Novu using Step Controls.
Start your application
To start your boilerplate Next.js server with the Novu Endpoint configured, run the following command:
The sample application will start on https://localhost:4000
and your novu endpoint will be exposed at /api/novu
served by the Next.js API.
If your Next.js application is running on other than 4000
port, restart the novu dev
command with the port:
Test your workflow
After your application is up and running, visit the Local Studio interface that was started on http://localhost:2022
by running the npx novu dev
command on the first step.
The onboarding guide will guide you to send the newly created sample workflow to your e-mail address.
Deploy your application
Once you have finished refining your first workflow, it’s time to sync your local changes to Novu Cloud. Novu recommends deploying your workflows similarly to how you will deploy the features that generate those notifications using your CI/CD pipeline or our CLI command.
Read more about syncing your changes to the cloud.
Next Steps
Was this page helpful?