Schedule notification

Hello Team,

I want to utilize the scheduled notification functionality from the notification module. However, I am unable to identify the fields required to map the date and time. Could you please guide me on how to use this functionality? I noticed there is a method for scheduling notifications, but I can’t seem to find the corresponding implementation.

Thank you.

Hello,
The notification module does not currently support scheduling notifications to be sent at a specific time. It provides two methods for sending notifications:

  1. Synchronous: SendNotificationAsync
  2. Asynchronous: ScheduleSendNotificationAsync

To schedule a notification for a specific date and time, you can use the following code snippet:

// Schedule the notification to be sent at a specific date and time using Hangfire's BackgroundJob.Schedule method.
BackgroundJob.Schedule(
    () => ScheduleSendNotification(notification), 
    new DateTimeOffset(new DateTime(2024, 12, 31))
);

// Method to handle the notification sending logic.
public async Task ScheduleSendNotification(EmailNotification notification)
{
    // Ensure the notification sender is properly utilized to send the notification asynchronously.
    await _notificationSender.SendNotificationAsync(notification);
}

Thank you for the solution.