WordPress is not able to “wake up” the server at a specific time to send a notification.
So when is the notification actually sent?
The only way to “wake up” the server is to make it receive a request, that is, a visit.
The scheduled notifications can therefore only be sent when the site is visited.
It does not matter the user, the page visited, etc. it only takes one visit.
When should my site be visited?
Your site must be visited within your scheduled notification delay before / after each booked event.
However, the minimum interval between two checks is 15 minutes. This minimum interval ensures that your server is not overloaded.
You have configured a notification to be sent 30 minutes before an event,
So, theoretically, your site should be visited between 0 and 30 minutes before the event.
However, it is possible that the last check took place 31 minutes before the event, so your site should actually also be visited between 0 and 16 minutes before the event.
The Notification Pack add-on offers two solutions:
- Wait for a visitor to visit your site
- Configure an external robot (a cron) to visit your site every 15 minutes
Option 1. Wait for someone to visit your site
Go to Booking Activities > Settings > Notifications tab > Set the “Scheduled notifications trigger” option on “On any page load (no cron required)“
If you choose this option, you are betting that a visitor will visit your site in time before / after each event. The reliability of this solution therefore depends on three parameters:
– the frequency of visits to your site
– the interval between your booked events
– the delays of your scheduled notifications (the most important factor)
if your scheduled notification must be sent 1 day before an event, then a maximum of one visit per day per event will be required on your site. A single visit can trigger multiple notifications if it occurs within the period of multiple events, so you will most likely not need that many visits.
If you do not want to use an external cron, you will therefore have to set sufficiently high delays and accept that there may be hiccups.
Moreover, this solution has another drawback:
– If the “Asynchronous notifications” option is turned OFF, the page loading time is extended for the visitor who will trigger the sending of scheduled notifications
– If you turn it ON, the visitor won’t way longer, but you will need two visits instead of one to send each scheduled notification
Option 2. Set up an external cron
Go to Booking Activities > Settings > Notifications tab > Set the “Scheduled notifications trigger” option on “On a specific page load (external cron required)“
If your notification delays are demanding (a few minutes, or a few hours), you will need to set up a robot outside your site to visit the provided URL every 15 minutes. This is called a “cron job“.
It must be an external cron, a WordPress plugin would encounter the same restrictions as Booking Activities.
What cron to use?
- Most web hosts allow you to set up cron jobs. The procedure is different for each host. Consult your host’s documentation (or contact them if necessary) to find out how to proceed.
- You can use an online cron service, such as easycron.com. Again, it will be necessary to consult the documentation of the chosen service.
Can I set a lower frequency?
You can completely configure the cron job to be executed every 30 minutes for example. Just make sure your notifications delays are a multiple of 30 minutes too.