Learn how to send email notifications with Nuxt.js, Vuemail and Novu
@novu/framework
package in the root of our Nuxt app directory by running the following command:app/server
directory and create a new directory named api
.app/server/api
directory and name it novu.ts
. Copy and paste the code snippet below:
app/server
directory and create another directory named novu
.
app/server/novu
directory and name it workflows.ts
. Copy and paste the code snippet below:
app/server/novu/workflows.ts
; make sure to provide each workflow with a unique name.
vue-email
package in the root of our Nuxt app directory by running the following command:templates
. That is where our vue-email templates will be stored.app/templates
directory, we will create a file for our first vue-email template and name it sample-email.vue
.Launching the dev studio
Provide Echo endpoint
Dev studio locates our workflow
Viewing the workflow
send-email
. We should see a preview of our email template and the Step Input
and Payload
variables we have configured in the workflow schemas.
Preview of our email template
Sync to Cloud
button on the top right.
Sync to Cloud
Create a local tunnel
Local tunnel url should be the same in the image here
Create Diff
button. To push (merge) the workflow code to the cloud, an API Key from our Novu account should be added to our Framework Client instance.
Create Diff
../app/server/novu/workflows.ts
file and add our Novu API Key.
Create Diff
button again.
Launching the dev studio
Deploy Changes
button.
Deploy changes
cURL
API call to Novu Cloud from our terminal in this guide.
If we don’t have any subscribers or users in our database or within our Novu Cloud organization, we’ll send the test to ourselves for simplicity.
subscriberId
key, input a random number or even our email address (as long as we do not try to assign the same ID key to another subscriber, we should be good).
email
key, we will need to insert a valid email address so we can actually receive the email.
payloadSchema
we established in the workflow definition.