Skip to main content

Notification reminders

In Notifications v1.22 or later (HERE Core UI Components 12.1.5 or later), users can set reminders on notifications. This feature lets them dismiss the notification temporarily, until the reminder time occurs. You can disable this feature, and not allow users to set a reminder on a notification. You can also add a reminder time when you create the notification.

How it works

You can configure the following properties when you define the notification:

  • reminderDate (optional): the Date object that represents the reminder time

  • allowReminder (boolean, default true): set to false to disable reminders

info

You cannot set a reminder time if you disable reminders. This combination throws an error.

How to do it

const exampleNotification: BaseNotificationOptions =
{

// rest of your notification definition

// optional if you want to set the reminder time yourself
// otherwise users can set it
// throws an error if `allowReminder` is set to `false`
reminderDate: DATE_OBJECT_FOR_REMINDER

// or, to keep users from setting a reminder. Default value is `true`.
// value `false` throws an error if `reminderDate` is set
allowReminder: false
};

create(exampleNotification);

Bulk operations

The notifications client API supports two methods to schedule or cancel multiple reminders at once.

Set reminders

The setReminder method schedules a reminder for one or more notifications. It posts a notification-reminder-created event for each reminder scheduled.

const notificationIds = ["notification-id-1", "notification-id-2"];

const reminderPayload = {
reminderDate: new Date("2025-01-15T09:00:00Z"),
};

const targets = {
users: ["user@example.com"],
groups: ["trading-desk"],
};

// Set reminder for multiple notifications
await setReminder(notificationIds, reminderPayload, targets);

Cancel reminders

The cancelReminders method cancels one or more previously scheduled reminders. It posts a notification-reminder-removed event for each reminder cancelled.

const notificationIds = ["notification-id-1", "notification-id-2"];

const targets = {
users: ["user@example.com"],
groups: ["trading-desk"],
};

// Cancel reminders for multiple notifications
await cancelReminder(notificationIds, targets);