Novu can be used to deliver email messages to your customers using a unified delivery API. You can easily integrate your favorite email provider using the built-in integration store.

Configuring email providers

When creating an email provider integration you will be asked to provide additional fields alongside the provider-specific credentials:

  • Sender name - Will be displayed as the sender of the message
  • From email address - Emails sent using Novu will be sent using this address

For some email providers including SendGrid you will have to authenticate the From email address to make sure you will send email messages using an authorized address.

Sending Email Overrides

The overrides field supports an email property. The email overrides field have properties like to, from, senderName etc

import { Novu } from '@novu/node';

const novu = new Novu('<NOVU_API_KEY>');

novu.trigger('<WORKFLOW_TRIGGER_IDENTIFIER>', {
to: {
subscriberId: '<SUBSCRIBER_ID>',
},
overrides: {
email: {
to: ['to@novu.co'],
from: 'from@novu.co',
senderName: 'Novu Team',
text: 'text version of email using overrides',
replyTo: 'no-reply@novu.co',
cc: ['1@novu.co'],
bcc: ['2@novu.co'],
},
},
});

It’s very important to know that Novu merges the to field in the email overrides with the subscriber email. It DOES NOT REPLACE IT.

Sending Email attachments

You can easily send attachments with the Novu API by passing the attachments array when triggering an Email based workflow. Attachment file can either be in the buffer or base64 format.

import { Novu } from '@novu/node';

const novu = new Novu('<NOVU_API_KEY>');

novu.trigger('<WORKFLOW_TRIGGER_IDENTIFIER>', {
  to: {
    subscriberId: '<SUBSCRIBER_ID>',
  },
  payload: {
    attachments: [
      {
        file: fs.readFileSync(__dirname + '/data/novu.jpeg'),
        name: 'novu.jpeg',
        mime: 'image/jpeg',
      },
    ],
  },
});

Using different email integration

In Novu integration store, multiple email channel type provider integrations can be active at the same time. But only one provider integration can be primary at a time. This primary integration will be used as a provider to deliver the email by default. If you want to use a different active provider integration then you can use the integrationIdentifier email overrides field.

If there are 4 active email integrations with these identifiers:-

  1. sendgrid-abcdef
  2. sendgrid-ghijkl
  3. brevo-abcdef
  4. mailersend-abcdef

Here, if sendgrid-abcdef is primary integration and you want to use brevo-abcdef with this trigger then you can use integrationIdentifier email overrides field as below:-

import { Novu } from '@novu/node';

const novu = new Novu('<NOVU_API_KEY>');

novu.trigger('<WORKFLOW_TRIGGER_IDENTIFIER>', {
to: {
subscriberId: '<SUBSCRIBER_ID>',
},
overrides: {
email: {
integrationIdentifier: "brevo-abcdef"
},
},
});

Integration identifier is similar to Provider identifier but it is different than Provider Id. It is unique for each integration.You can find the integrationIdentifier in the integration store page.
Are we missing a provider you'd like to use for SMS channel? Please consider adding a new feature request on github or help us upvoting the existing ones on our public roadmap