Hey @jessefarquhar48 take a look at the below and let me know how you get on. Funnily enough the indexes were actually super necessary for sending reminders.
First up we’re going to create an API workflow (backend workflow) that sends the reminder.
It will have one action which is to send the notification, whether this is via SMS or OneSignal (or could be both). In my instance here, I’ve just got it sending an email.
Next up we’re going to create another API workflow (backend workflow) that schedules this ‘send_reminder’ workflow for the right time of day.
It has one action which is to schedule that API workflow ‘send_reminder’. What we’re doing here is taking the current date/time and changing the hours and seconds so that they are the hours and seconds stored against the reminder in the database.
Next up we’re going to create a final ‘daily_reminder_check’ API workflow (backend workflow) which runs at midnight every day and picks up all the reminders that are due to be sent today.
It has two actions, one to tell the ‘schedule_reminder’ workflow which reminders it needs to schedule, and second action to run this daily_reminder_check at midnight the next day.
You can see that we’re using the “Indexes of the week” field here, and what we’re doing is looking for all reminders where the day is the current day. the :extract day modifier actually returns the index in the same way that you have them stored in the db, which is perfect.
The last piece of the puzzle is to kick this off in the first place, for that, we’ll just create a button on some random admin page (not the dashboard) you have and it will have one action. We will only ever click this once, never needs to be clicked again.
Finally, to show that this actually works, here’s my database.
And here’s the scheduled workflows, the first one to send the reminder for today and the second to run the daily_reminder_check at 12am tomorrow.
The only caveat to this is it doesn’t handle different timezones, but this foundational structure outlined above can be modified slightly to support it.
As for the redirecting to the specific page and showing popup, this is also straightforward. Back in our earlier send_reminder workflow, we’re going to add an extra action at the start, the magic link.
You can then include the link in your email/SMS/push notification. What we have here though is a specific ‘reminder_redirect’ page (you’ll need to create this) which has one workflow that fires on page load.
It redirects to whatever page you want to take the user to (in this case, the index) and adds a reminder=true parameter. Now you can add a workflow on the page that you’re trying to send the user to (in this case index) to show the popup like below.