Schedule Transactional Emails with Zeplo

When building web applications, transactional emails are those emails sent to users when they perform actions like

  • sign up
  • make a payment
  • get an invitation
  • change their settings

One of the challenges around transactional emails is sending them out with a delay, or on a schedule. One use case for this is if a user deletes their account, you could add a 15 day waiting period before fully deleting the data. In this case, you may want to schedule a reminder email to go right before the 15 days are up.

Transactional email flow

To add this kind of scheduling behavior, we often have to set up a stateful service — using Redis or similar database. This can be a pain to set up and maintain.

This is the perfect case for using Zeplo’s HTTP request queue.

Zeplo has a scheduling feature, accessed by appending _delay=<seconds> or _cron=*|*|*|*|* to the request.

For example, if we wanted to use the Mailgun API to send an email 14 days from now, we would use this endpoint:

zeplo.to/https://api.mailgun.net/v3/<domain>/messages?_delay=1555200

You would add any additional parameters, headers or body required to send the message as outlined in Mailgun’s docs. Zeplo will pass all of these on to the final request.

Really that’s it — the Mailgun API would get called exactly 14 days from the time you call the Zeplo API. That’s how you schedule transactional emails with Zeplo.

Return to Blog