Looking for ideas about automated workflow implementation

Hi all! I am working on implementing an automation workflow that is now available in most email marketing platforms. A basic workflow goes like this:

  1. User signs up to a mailing list
  2. Wait for a configurable duration (1hr/1day etc)
  3. Send a marketing mail

This is the most basic example and I am wondering how should I go about implementing it using Oban. The sticking point is that the duration between sign up and the next email should be configurable by the customer for each automation and all steps depend on the successful completion of the previous step (there can be multiple follow-up emails/steps). And the customers can have multiple automations running at the same time.

I am looking for suggestions and potential solutions for this. If it helps, I am planning on using Ash framework and Oban for this.

we’re doing something very similar with Oban and it works quite reliable. We also find and cancel the upcoming jobs if some condition happens, like user unsubscribes. The scale is between tens of thousands upcoming jobs and low hundreds of thousands, and it works fine with some extra indexes on the Oban job arguments.

2 Likes

You don’t need Oban for this, assuming you are already planning on storing users in a database. Just run a task every hour that looks for all users who haven’t received an email yet and for whom now - inserted_at > the customer’s delay value. Then send an email to each of them.

AshOban will let you do this with its triggers :slight_smile:

trigger :send_email do
  # this is an example, to add an interval your expression will need to use datetime_add or from_now
  where expr(email_not_received and now() > email_scheduled + configured_delay)
end
1 Like