MyGit

v0.20.0

novuhq/novu

版本发布时间: 2023-10-24 16:53:32

novuhq/novu最新发布版本:v0.24.0(2024-03-18 17:44:43)

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.

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:

{

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

The exposed methods from the widgets are:

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"
      }
    }
  }
}

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>"
    }
  }
}

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"
  }
);

..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

All Changes

New Contributors

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

相关地址:原始地址 下载(tar) 下载(zip)

查看:2023-10-24发行的版本