Set up future email sending dates (scheduled API)


I have two data points that I’m trying to turn into a schedule of API workflows that sends out a mail at a specified frequency. The end user has filled out a few fields contained within a Data Type:

Recipients (list of User’s and their email addresses)
Frequency (number of days between each distribution, for example 7 days for weekly email)
Start date: First date of sending

So, I need to set up API workflow that sends out a mail on the Start date, and every X day thereafter. I realize this would basically make up an infinite amount of workflows, so it might make sense to split it into two workflows (send mail every X days until Y, and then at Y set up a new workflow).

Thoughts? I haven’t used scheduled workflows before, so I’m hoping to set it up as efficiently as possible – which is why I’m resorting to the forum first :slight_smile:

Hello petter
Did you succeed in your research about sending email?

I did, by changing the approach a bit. Instead of scheduling X number of mails in advance, I only schedule one, which then schedules the next after it’s sent, and so on.

I keep the scheduled time up to date by updating a field called “Next publication”, by adding X days to the last publish date.


petter: I was wondering if you could share your workflow settings or some screenshots how did you achieved that? It would be wonderful!

Thanks in advance.

Sure! Could you describe just what you want to accomplish? There are several aspects to this, so it will probably be easier to follow if I can display just the part you actually need :slight_smile:

Wow, that’s was a really fast reply. :grinning:
So, basically idea is quite simple: there are list of “events” which has a deadline date (up to exact minutes) and users can “subscribe” to this “event” by entering their emails.

And what I’m trying to achieve is:

  1. When deadline for “event” is reached - set Expired to YES
  2. When deadline for “event” is reached - send email to email list with “event” text

I’ve already create workflow so users email adding to database, but I’m really lost in this “automation” part.

Actually, I think this thread will answer your question pretty spot on – but let me know if it doesn’t:

In few words, what you will need to do is:

  • Configure your app to use API workflows (if not already done)
  • Set up a workflow that emails the user, and sets Expired to YES
  • Schedule the API workflow that triggers on deadline time/date
  • Configure your app to use API workflows (if not already done) - Done
  • Set up a workflow that emails the user, and sets Expired to YES

Well, this is something that I’m trying to achieve for the last couple of days.

  • On which page I should create this workflow?
  • This workflow purpose to receive some parameters: 1) which “event” should be marked as expired and 2) which email list should be used in email sending
    And how should I pass those parameters in this workflow?

This is something that Documentation - Video lessons is really need.

On which page I should create this workflow?
This part is a bit confusing the first time, but you will find the API Workflow editor in the same place where you find Pages and Reusables:

The reason you need to build this workflow in the API editor rather than on a page, is because the workflows you place on pages are dependent on that page being open. In other words, if you close the window, they wont’t run. API workflows on the other hand, run independently. Instead of relying on elements on the page and user actions, they rely on (as you say) Parameters.

Set up workflow
You set up a new API workflow by clicking on:

I would assume you need two paramters for this:

  • The USER receving the mail
  • The EVENT in question

    At this point, you have an API endpoint that is ready to receive those two parameters.

Now that the end point is ready, you can insert the actions you need, which is to a) send the email, and b) set “expired” to yes.

As you can see, you can now refer to the parameters you set in the endpoint, from the workflows.

Scheduling the workflow
Now that the end point and workflow is ready, you can schedule it from the page where the user signs up to receive updates:

You specify what the parameters should be (which User and Event), and you’re ready to go. The date can be set, or dynamic.

To confirm that the workflow has been scheduled, you can check the list of scheduled workflows here:

Hope that helps.


Thank You so much, petter.
This is something that should be in those Lessons! That’s for sure!
I think I’ve started to understand the philosophy of Scheduled API.

The last this that I might missing is: how do I change for example: Expiration parameter for specific “event”?
Should I implement and add some kind of ID (probably unique) for each event and do a search or there some more simpler way?

The reason I was a little fuzzy on that part, is because it depends on how your events are saved.

Are each event saved as an entry in a Data Type? With a specified deadline and expired boolean?

Like this example:

In that case, the parameters would be the Event itself (a unique ID is already automatically added to all entries in the database), and a User, probably fetched from Current User.

So the API workflow receives the following parameters when you schedule it:
Event = Current Page’s event (or wherever you choose to fetch that info)
User = Current User

And the workflow changes the Event->Expired? to “Yes”.

Thank you again, petter.

Your manual is truly helped me a lot. :slight_smile:
I’ve managed to do this with “Event” as an object.
I have a very last question, but it’s not regarding this topic.

So I will ask this question in PM.

Thank you again!

This topic was automatically closed after 70 days. New replies are no longer allowed.