I have an Ionic app with Drupal as the backend. I am using the Firebase module to send push notifications.
I want to send all users of the site a push notification once a day. The tricky part is that I want users to be able to configure when they receive the push notification.
To let users choose when to receive the notification, I added a field of type text list to the account. This field has the following options:
0:00 0:30 1:00 1:30 and so on until 23:30
My question is: which API or module should I use to schedule daily notifications per user at specific times of day? Even better if there is a way to queue this because there might be a few hundred users for each time slot.
What I have considered so far
I looked at the Job Scheduler module but it’s difficult for me to understand. This module allows for things to be scheduled at cron intervals, so it seems like I could use that, but then how would I assign the users to each time slot? I thought I could create a job for each half-hour interval, run an entity query to get the list of users who have selected that time slot, and then send a message to each user. So then I would have 24 jobs, one for each half-hour interval.
I also thought about adding users to a queue whenever they save their profiles. However, I couldn’t find a way to get the queue to regenerate each day.