I’m needing to be able to have automatic regular weekly emails sent to users, with the email itself being dynamic content.
Is anyone able to show me how to set up a recurring weekly task to email a constrained list of users?
I’m on the professional plan (daily scheduled workflows available) with API Workflows set up, and using SendGrid, if that helps.
Thanks in advance
I was able to accomplish this with the following high-level steps (I am sure there are more efficient ways, but I use this structure throughout):
- Create a data type called Batch Process with the fields Name and Frequency (note you cannot dynamically set Frequency of recurring endpoints based on app data, would be nice if you could… so the frequency is really just for information purposes)
- Create a data type called Process Logs that has the fields Start Time, End Time, Process Name, and Result
- Added a Field to the User data type called “Last Weekly Summary” with a data type of Process Logs
- Create an API endpoint is recursive on itself. Use the Make Changes to User… action update the first user that meets the criteria you have to receive an email that week, then the API loops through itself until there are no users remaining to update. The second step of the recursive endpoint is an API call I created to send the emails to the email address of the result of step 1.
When you actually call the endpoint within itself, you need to be careful to get the Only When condition right so that eventually the loop stops…
My last step in the recurring workflow is to update the Process Log so I know when it completed.
- Create a Recurring Endpoint with a “Type of Thing” of Batch Process
Step 1 of the Recurring Endpoint is create a new Process Logs and set Process Name to the name of my Recurring Endpoint and Start Time = current date/time, then step 2 uses the Result of step 1 as the input for the recursive endpoint
Once you complete something similar to the steps above, you then need to actually schedule the Recurring workflow. I created an Admin page in my app to do this through the application, however you can do this. Here is the action behind the button in the application.
Hope that helps! For more info on the recursive workflow concept, take a look here - [New Feature] Scheduling API workflows can now be done recursively
This topic was automatically closed after 70 days. New replies are no longer allowed.