Scheduling and calling triggers

Hello,

I am trying to schedule an automation that sends a message to a user every Sunday. For testing purposes, I tried sending the message every minute. I used the automation designer with the following steps:

  1. Start + cron trigger = “*****”
  2. Send to specified recipient

When I invoke this template however, the email is sent immediately but only once. I’ve been messing around with this but cannot seem to send out regularly scheduled notifications. I noticed when I go to the preview page of the designer (before the invoking stage), the “steps” JSON attribute does not contain a start action. Also, I noticed in my “logs” channel that for a few of my previously tested calls, there have been errors in sending due to “invalid brand ID”. I am confused by this since I am just using a pre-set notification template for this automation and do not even pass a brand id value.

Here are some pictures to hopefully clarify:

More screenshots

Hey there @josephmcgold ,

Thanks for bringing this up. I tried reproducing this and it looks like the cron scheduler is in fact firing after initial invocation. I used crontab guru for the cron expression and it still fired right away. I’m going to keep testing this and bring it up to my team if it turns out to be a bug.

The JSON viewer for automations only shows the steps in the automation not the actual trigger.

For the “invalid brand ID” error I would check your notification template and see if there is any brand mapped to it, or if your request has a brand_id parameter with an invalid value in the request anywhere.

ok thanks. let me know if there are updates.

Hey @josephmcgold,

Wanted to quickly update you about this. I did some tests for the cron job to trigger a notification on the hour and I got it to work by adding a ‘delay’ step to the automation. For this test I set the delay to 1’ and was able to receive the notification every hour(ignore some of the time changes, I was playing around with the delay).

I’m still testing this, but I wanted to let you know on my findings so far.

Thanks @rodrigo really appreciate your help and effort. Will try it out.

So far I have tried this method for emails every 2 minutes and every 30 minutes. However, this does not seem to be working after the initial send. I will now try hourly notifications.

Also, I was wondering if it is possible to automate notifications to a list of users, rather than just a single recipient. The POST request for automation “invoke” takes a single recipient parameter but I was wondering if I could somehow pass a list ID or if there was another way to send scheduled messages to lists of users.

Hi @josephmcgold,

You can use a ‘send-list’ step in your automation to send to a list of recipients. Going to continue the cron testing today with minutes and see what comes up. :slightly_smiling_face:

Back again @josephmcgold,

You can use this expression: */30 * * * * for sending every half hour.

Also, this is how you would send it to a list.


Cheers.

@rodrigo thanks as usual, the one hour notification works well. I only plan on sending weekly notifications so everything looks good on that end. I will try list automations next.

@rodrigo so the scheduling seems to work fine now… however, I am trying to send out notifications with dynamically rendered data. I have two use cases for this:

  1. I would like to send the user a daily update with some new data. For testing, let’s pretend the data is a company’s stock price. Right now, I get user input for a company, and then I will email them the stock price of the company each day. I am a little confused how to include the stock price API call data into my automations message. So far, I get the user’s input and then store it in their courier user profile as a variable called “company”. I then tried messing around with the “fetch data” field in the automations section but was unable to get my desired result (I added my API call url to the ‘url’ field of the webhook JSON). Please let me know if I am on the right track or if there’s a better way to send scheduled notifications to a list of users with personalized data.

  2. My other use case is similar to the one above, except that I do not plan to make any API calls and instead use values from my database. For example, let’s say that my app is a food calorie tracker: the user inputs how many calories they consumed for the day, and I send them a weekly email with their total calorie count for the week. Right now, I create a variable in the courier user profile called “calories”. When the user enters their calorie count for the day in my app, I increment the calories variable in their courier profile appropriately. In my automation notification template, I simply then send this message: “You consumed a total of {$.profile.calories} this week!”. I am wondering if this is a good way of handling user data that changes regularly and sending this data in notifications or if there is a better way.

Sorry for the long message and let me know if anything is unclear. Thanks a lot!