How to Use Postman, Mandrill and Mailchimp for Separation of Engineering Concerns

Not too long ago we started moving our team and product architecture from Full Stack PHP to a service-oriented, 12-factored, concern-separated model here at ReFUEL4. Of course there are pros and cons to this kind of team and product organization, but to us the pros have been far greater than the cons.


The basic idea


As a whole product team, this leads to large gains in efficiency. Now all of a sudden our mobile app becomes much more easily accomplished. The same goes for an admin panel and for many other views into the same data.


For hiring managers, this makes finding great people easier. You no longer have to find full-stack pros. You now only have to find people who are either great at frontend or backend, not both.


Small steps first

While for an organization, splitting concerns is clearly optimal, for an engineering team that is used to operating in a full-stack fashion, it’s always good to start with small steps first.  


One of the easiest ways to get used to operating in this separated fashion is to start with splitting email services off your full stack architecture by implementing a frontend / backend hand off process. Similar processes can later be used to transition other architectural pieces until the whole architecture is service oriented.


Email is a great place to start because:

  • Email is copywriting and design heavy, so it’s a great place to bring more designers, marketing and frontend people into the fray.

  • Now when marketing wants some email copy changed, they don’t have to ask a developer. They likely already use MailChimp for the newsletter, so they can just login and change the email template.

  • Sending email the old way from your own server is complicated and doesn’t play well with modern spam filters. Using a dedicated email service provider (ESP) will result in better deliverability.

  • ESPs offer open and click tracking.

  • Most ESPs allow you to see and audit every email sent.  This means that if a customer says they didn’t get your email, you can actually go find out if it was sent and look at the final rendered email they got sent with just a few clicks.


Here’s what we’re going to do:

So in order separate concerns for email, we’ll start by designing an email template in MailChimp, creating some dummy data and testing with Postman, and sending the actual email with Mandrill (our ESP). Finally we’ll hand off to our backend team, who can implement the Mandrill send with whatever technology they choose.


3Introducing MailChimp and Mandrill

Most likely your team is already familiar with MailChimp – it’s an easy to use a WYSIWYG (What You See Is What You Get) tool for email marketing.

If you’ve used MailChimp you probably already know you can include “Merge Tags” like *|FIRST_NAME|* which get rendered from data in the mailing list.

What most MailChimp users may not know is that in 2012 MailChimp created a startup called Mandrill which allows developers to send the same MailChimp templated email via API.  The only difference is that now in Mandrill merge tags have changed from *|this|* to {{this}}, and a few new tags like {{#IF}}, which creates conditionals and {{#EACH}}, which allows you to iterate through a list, have been added.

Editing a transactional email template in MailChimp’s easy WYSIWYG user interface:


As you might expect, MailChimp and Mandrill integrate seamlessly. Sending this template to Mandrill’s own template management system is just two clicks away:


Note: If you use another ESP (Like MailGun, Sendgrid or Amazon SES) you can still use most of this process, but you’ll have to export your template as HTML and copy it to your ESP.

And now a backend engineer can go send this email, or can they?

Gluing it all together with Postman

Actually you can’t hand off the template just yet, since you haven’t properly tested it.  

MailChimp’s tools for testing are great if you’re just sending to a mailing list, but as you can see here, I’ve actually used MailChimp’s code block to include 15 lines of basic HTML to render the list of images, as required by our product spec.


Handling loops and Code Blocks in MailChimp and Mandrill

So how am I supposed to test this?  Enter Postman:

Below you can see I’ve defined a simple data structure in Postman to send to the Mandrill Template API (docs here: https://mandrillapp.com/api/docs/messages.JSON.html#method=send-template) – including all of the elements I’ve described in my email above among them FNAME, for first name, and the list of images.


Sending the JSON payload from Postman

So now, I click “Send” and I can fully test my email:

This is a test email sent from postman

This is a test email sent from postman

The handoff

Now that I’ve created the email template I want in MailChimp and tested it with dummy data, I can easily hand it off to a backend engineer.  With a JSON payload and REST Request parameters, the engineer will have everything they need to send the exact same email without so much as checking documentation. And to top it off, Postman makes that handoff super easy. They’ve recently released Postman for Teams — a paid product that syncs the whole request to all my teammate’s computers every time I click save. Boom. That was easy.


Alex Miller

Alex Miller heads up the product team at ReFUEL4. Previously Alex spent 10 years in China freelancing jeep tours, translation and photography, as well as building China's first social advertising platform at Renren.com. He then spent 3 years in Silicon Valley, where he founded/cofounded 3 funded startups and was EIR at 500 Startups.