DEV Community

Emil Pearce for novu

Posted on

What’s new in Novu 0.20?

TL;DR: All you need to know about the latest Novu 0.20.0 release. Global User Preferences, Integrations conditions, Digest and delay filters, and more!

0.20 Release Updates

We're thrilled to announce the newest features in our most recent release. Let's get started and explore what's waiting for you!

https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1jxs3nc6jp6abbjvis8i.gif

Global Channel Preferences for Subscribers API

It's now possible to set subscriber preferences globally for either a particular channel or all channels via API.

I'm really stoked about this because before now it was only available per workflow, /:subscriberId/preferences/:templateId

With these API URLs, you can fetch and update global subscriber preferences.

  • PATCH /subscribers/:subscriberid/preference - Update a subscriber preference globally.
  • GET /subscribers/:subscriberid/preferences/global - Fetch a subscriber preference globally.

Note: These methods are also available in the NodeJS SDK. They will be available in other language SDKs very soon.

If you're using the Headless service and Notification Center Widgets, you can set or fetch via the following APIs:

  • widgets/preferences - PATCH : Update subscriber preferences globally
{

    "enabled": true,
    "preferences": [
        {
            "type": "in_app",
            "enabled": true
        },
        {
            "type": "email",
            "enabled": false
        }
    ]
}

Enter fullscreen mode Exit fullscreen mode
  • widgets/preferences/global - GET : Fetch subscriber preferences globally.

The exposed methods from the widgets are:

  • fetchUserGlobalPrereferences
  • updateUserGlobalPreferences

Note: If a workflow is marked as critical, the subscriber global preferences will be ignored, and notifications will be sent.

Filters Usage in Digest and Delay Nodes

Users can now add filters to the digest and delay nodes inside the workflow editor to dynamically control if a digest should be used or not.

https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g1l0dao60xd7eixps56r.png

Digest Node: Adding filter

https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8epc6ew33s9accvtmjzm.png

Delay Node: Adding filter

Improved Error Messages In The Workflow Editor

We have improved the error icons and states for each node in the workflow, when no provider is connected or not configured.

SMS & Email Custom Data Overrides

We now support adding custom data in email overrides as shown below:

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

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

await novu.subscribers.trigger("workflowIdentifier", {
  to: "subscriberId",
  payload: {
    customKey: "customValue",
  },
  overrides: {
    email: {
      from: "support@novu.co",
      // customData will work only for sendgrid
      customData: {
        "customKey": "customValue"
      }
    }
  }
}

Enter fullscreen mode Exit fullscreen mode

Email Custom Data overrides

Note: This works for Sendgrid only at the moment.

You can override sms values via the code below.

...
...
await novu.subscribers.trigger("workflowIdentifier", {
  to: "subscriberId",
  payload: {
    customKey: "customValue",
  },
  overrides: {
    sms: {
      to: "<insert-phone-number>",
      content: "<insert-content>"
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

SMS Overrides

Enabling The Addition of Conditions to Integrations

Users can now create conditions for the channel integrations to be executed for specific tenants only.

https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c4j4ioad8tjqljy3qzqx.png

https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o187yxcsmtgfgq7a7gyp.png

In the image above, you can add the condition (to an integration) to state that the integration should be used if the tenant identifier used in trigger matches the tenant identifier set here.

Note: The integrations are the provider instances on the Integration store dashboard.

When Novu runs a trigger code with a tenant Identifier attached to it like so:

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

const novu = new Novu(process.env.NOVU_API_KEY);

await novu.trigger('<WORKFLOW_TRIGGER_ID>',
  {
    to: {
      subscriberId: '<UNIQUE_SUBSCRIBER_IDENTIFIER>',
      email: 'john@doemail.com',
    },
   tenant: "tenantIdentifier"
  }
);

Enter fullscreen mode Exit fullscreen mode

..Novu runs checks on the integrations in the Integration store to determine which integration matches to be used to send the notification based on any condition that has been set. If nothing was set, it defaults to the primary provider set for the channel used in the workflow.

Mailtrap Email Provider Integration

Now, you can use the Mailtrap Email provider on Novu.

https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fb9pmn5xu3ep6f8lcpq3.png

Clicksend SMS Provider Integration

Now, you can use the Clicksend SMS provider on Novu.

https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1f5154c9alnn4aqollxl.png

Full Changelog: https://github.com/novuhq/novu/compare/v0.19.0...v0.20.0

Top comments (0)