// Enabling it for a channel
await channel.updatePartial({
config_overrides: {
user_message_reminders: true,
},
});
// Enabling it for a channel type
const update = await client.updateChannelType("messaging", {
user_message_reminders: true,
});Reminders & Bookmarks
Message reminders let users schedule notifications for specific messages, making it easier to follow up later. When a reminder includes a timestamp, it's like saying "remind me later about this message," and the user who set it will receive a notification at the designated time. If no timestamp is provided, the reminder functions more like a bookmark, allowing the user to save the message for later reference.
Reminders require Push V3 to be enabled - see details here
Enabling Reminders
The Message Reminders feature must be activated at the channel level before it can be used. You have two configuration options: activate it for a single channel using configuration overrides, or enable it globally for all channels of a particular type.
Message reminders allow users to:
- schedule a notification after given amount of time has elapsed
- bookmark a message without specifying a deadline
Limits
- A user cannot have more than 250 reminders scheduled
- A user can only have one reminder created per message
Creating a Message Reminder
You can create a reminder for any message. When creating a reminder, you can specify a reminder time or save it for later without a specific time.
// Create a reminder with a specific due date
await client.createReminder(
messageId,
// Remind in 1 hour
remindAt: DateTime.now().add(const Duration(hours: 1)),
);
// Create a 'Save for later' reminder without a specific time
await client.createReminder(messageId);Updating a Message Reminder
You can update an existing reminder for a message to change the reminder time.
// Update a reminder with a new due date
await client.updateReminder(
messageId,
// New reminder time in 2 hours
remindAt: DateTime.now().add(const Duration(hours: 2)),
);
// Convert a timed reminder to 'Save for later'
await client.updateReminder(
messageId,
remindAt: null, // Remove specific reminder time
);Deleting a Message Reminder
You can delete a reminder for a message when it's no longer needed.
// Delete the reminder for the message
await client.deleteReminder(messageId);Querying Message Reminders
The SDK allows you to fetch all reminders of the current user. You can filter, sort, and paginate through all the user's reminders.
// Retrieve all reminders for the current user.
await client.queryReminders();Filtering Reminders
You can filter the reminders based on different criteria:
message_id- Filter by the message that the reminder is created on.remind_at- Filter by the reminder time.created_at- Filter by the creation date.channel_cid- Filter by the channel ID.
The most common use case would be to filter by the reminder time. Like filtering overdue reminders, upcoming reminders, or reminders with no due date (saved for later).
final now = DateTime.now().toIso8601String();
// Overdue reminders, most recently expired first
await client.queryReminders(
filter: Filter.lessOrEqual('remind_at', now),
sort: [SortOption<MessageReminder>.desc('remind_at')],
pagination: PaginationParams(limit: 25),
);
// Upcoming reminders, nearest to expire first
await client.queryReminders(
filter: Filter.greater('remind_at', now),
sort: [SortOption<MessageReminder>.asc('remind_at')],
pagination: PaginationParams(limit: 25),
);
// Reminders saved for later (no remind_at), most recently created first
await client.queryReminders(
filter: Filter.notExists('remind_at'),
sort: [SortOption<MessageReminder>.desc('created_at')],
pagination: PaginationParams(limit: 25),
);Pagination
If you have many reminders, you can paginate the results.
// Load more reminders
final response = await client.queryReminders(
sort: sort,
filter: filter,
// Pass the limit and next page key for pagination
pagination: PaginationParams(limit: limit, next: nextPageKey),
);Events
The following WebSocket events are available for message reminders:
reminder.created- Triggered when a reminder is createdreminder.updated- Triggered when a reminder is updatedreminder.deleted- Triggered when a reminder is deletednotification.reminder_due- Triggered when a reminder's due time is reached
When a reminder's due time is reached, the server also sends a push notification to the user. Ensure push notifications are configured in your app.
client.on(EventType.reminderCreated).listen((event) {
print('Reminder created for message: ${event.messageId}');
});
client.on(EventType.reminderUpdated).listen((event) {
print('Reminder updated for message: ${event.messageId}');
});
client.on(EventType.reminderDeleted).listen((event) {
print('Reminder deleted for message: ${event.messageId}');
});
client.on(EventType.notificationReminderDue).listen((event) {
print('Reminder due for message: ${event.messageId}');
});Webhooks
The same events are available as webhooks to notify your backend systems:
reminder.createdreminder.updatedreminder.deletednotification.reminder_due
These webhook events contain the same payload structure as their WebSocket counterparts. For more information on configuring webhooks, see the Webhooks documentation.