DEV Community

Cosmin Rusu
Cosmin Rusu

Posted on

Emails Duty Labs

Check out my lastest blog article: rusu.io/emails. Hope you enjoy it.

I just launched a new tool to help developers implement emails in their
applications faster. I've had to write email automations for more than
4 clients until now.

The usual conversation goes like this:

  • We want you to send a suite of emails whenever some events happen.

  • I write the first version of the emails.

  • They want me to change the verbiage of almost all emails.

  • We iterate on that, we try to test the logic (which btw is very tricky and I usually
    change the email automation to wait a few minutes instead of a few days so we can test quickly)

  • We are satisfied with the implementation, but we don't quite have a way to test how
    well the implementation behaves in term of business returns - whether users bought
    something after we sent an email, whether they read the email, clicked the links,
    and so on.

  • We come up with some hacks to measure the success.

  • We are pretty much done.

After some time....

  • We want to add new emails/compaigns/change the verbiage.

  • Here we go again.

It quickly came into my brain that this is quite a common problem, and so, I did
what any sane person would do and built and MVP in a few days. You can check it live
at https://emails.dutylabs.ro.

The app has two main parts: the dashboard and the API.

1. Dashboard

Currently, the dashboard serves two main purposes:

  • Activate your sending domains so that the app is able to send emails from these verified domains.
    For example, I activated my dutylabs.ro domain.

  • Create email templates: basically you have a what-you-see-is-what-you-get interface
    where you define the body of the email you want to be delivered and you asign it a
    unique code. For example: the email welcome_email with the body:

  Hi { {email} }`,

  We are thrilled to welcome you to our Uber for Pets app.

  We hope you enjoy it,

  Best,
  The Uber for Pets team

You can also set the subject of the template and the default from-address.

That's it! Now comes the fun part: the API integration.

2. API

The API is a set of routes where you could trigger (and in the future - schedule)
emails to be delivered to your customers.

First, get your API Key from your dashboard account, and set it in the
X-Emails-Duty-Labs-Api-Key header.

The simplest API call is the following:

End point

POST https://emails.dutylabs.ro/api/v1/emails

Body

{
  "email": {
    "to_email": "send-to@dutylabs.ro",
    "template_code": "welcome_email"
  }
}

You can also specify the subject and the from_email in the params to override the template
default ones.

{
  "email": {
    "to_email": "sendto@dutylabs.ro",
    "template_code": "welcome_email",
    "from_email": "another@dutylabs.ro",
    "subject": "Hello there"
  }
}

Be sure to check out the API Docs to see
more. If you are interested in trying out the API (for free), shoot me an email
to cosmin@dutylabs.ro.

I'm very excited about this launch as this fulfills one goal that I had in
mind for a long time ago, which is to build a product that solves a pain. I'm
sure many of us have this problem, and if not, I'm probably just gonna
use this for my future clients and side projects.

If you have any feedback, you know how to reach me - just be nice!

Cheers 🥂,

Cosmin

Top comments (0)