Okay
  Public Ticket #2885522
cronjob
Closed

Comments

  •  5
    Rohan Yoon started the conversation

    Hi 

    I am running wp site on the AWS lightsail whereby it doenst have server cron feature. so I am controlling the cron jobs using the plugin called 'WP Cron'. 

    I saw your article regarding the cron job from https://wpamelia.com/notifications/

    */15 * * * * https://yourwebsite.com/wp-admin/admin-ajax.php?action=wpamelia_api&call=/notifications/scheduled/send

    but in WP Cron, I need to know the name of the Hook

    image5-187.png

    You can refer https://www.cloudways.com/blog/wordpress-cron-job/

    So my question is 

    How / where do i get the hook? Is it even possible? 

    Please guide me 

    Thank you

  • [deleted] replied

    Hi Rohan,

    thank you for reaching out to ussmile.png

    You copy only the URL from below a scheduled notification:

    7810032183.png

    Then, go to Tools/Cron Events, and click on "Cron Schedules" tab. In it, add a 15 minute interval:

    2487877415.png

    Then go back to "Cron Events" tab and click on "Add new":

    9085918175.png

    Below it, select "PHP Cron event" radio button, and add the URL you copied from Amelia/Notifications in this form:

    file_get_contents("yourURL");
    2095163400.png

    Below it add the name, and set it to run a few minutes in the future, using the provided time format. So, if you're adding the cron event at 12:45 (local, current time), set it to run at 12:50; and then select the schedule you previously selected:

    7642938415.png

    Click on Add Event, and that's it.

    The cron runs every 15 minutes, and checks if there's an email to be sent. So, in Amelia Notifications, your scheduled notifications are set to run every day at a certain time. If you set that time to be 15:00 (for example), the emails will be sent when the cron runs after that time.

    For example, there's an appointment booked for tomorrow, and it's currently 14:44 - the cron runs, but since it's not yet 15:00, it doesn't send anything. It runs again after 15 minutes, so at 14:59, but there are still no emails flagged by Amelia, so it doesn't send anything. Then it runs again at 15:14 and it sees there's an email that should've been sent at 15:00, so it sends the email. It will only send emails when Amelia sees an appointment scheduled for the next day.

    I hope that helps.

  •  5
    Rohan Yoon replied

    Thank you so much for the info. 

    One last.. 

    Is there a way / steps that I can confirm the cronjob that I set this way is working fine? 

    Thank you

  • [deleted] replied

    Hi Rohan,

    in order to make sure 100% you would need to make a fictional appointment for an email that you have access to so that you can check the notifications arriving in real time.