Email marketing platforms are interesting, and I’m sure Mailchimp brings its own weirdness to the table, because setting up an email to have application driven dynamic content was not the smoothest. With that said, low and behold the new email from Weekendr.

Weekendr Notification Email

It is still a work in progress as I still need to style the links and work on a bit more content, but I am happy with the overall direction of this email. The fact that this was created from my application, sent through Mailchimp with all the deliverability measures taken care of, opened in my inbox and tracked in Mailchimp’s dashboard, I couldn’t be more excited. It is starting to feel real.

With all that said, I learned a few things about Mailchimp and email marketing in general (I think). First, a Campaign is a singular instance of an email that gets sent out to loads of people. You can’t resend a Campaign, because thats now how this works. If you want to send another email to the same people, you make another Campaign. I was hoping to have one dummy Campaign with boilerplate, then fill in the dynamic piece with links and then blast it out to the same Segment, over and over. 

Nope. This doesn’t make sense, because how would one track that. Each Campaign needs to be separate so we can track how each one does when they get sent out. So I have to make a new Campaign every time a new email for a given Segment goes out. This might be a problem down the line, but for now it seems ok. If it becomes cumbersome to manage tracking, I’ll look further into how other people do it, or find/implement some stats tracking solution outside of the Mailchimp dashboard. 

Next thing is all the documentation about dynamic content is entirely driven by the Merge Fields. This is specific data points on each contact like their first name, email address, or airport. I didn’t really find any information regarding injecting data from my application, so I had to get a bit creative. I decided to get the raw html of the template I designed in Mailchimp, and moved it to my application. I then inserted some blade markup (Laravel views jargon) into the html so I could plug in flight deals. Once the html was finalized, I updated the Campaign’s content to be the html I just generated. Now I have a Campaign with dynamic flight deals fully created by my backend application.

Ok, so I have lots of Campaigns now. These Campaigns need Segments. Segments are groups of contacts on a given list, that all share some data point in common. When I get a new deal for NYC, I need to email all the users of NYC. I achieve this by creating a Campaign with content about flights leaving from NYC. I then need to attach all of the contacts with NYC as their airport code, therefore I attach the NYC airport Segment. The trick is, whenever a user signs up, I need to see if that user is the first with that airport. If he/she is, then I need to create a new Segment on the fly. This is where webhooks come in. I created a webhook whenever a new user signs up to see if they are first of their airport. If they are, I create a new Segment with that airport for future Campaigns. If they aren’t first, I do nothing.

Now I have my application adjusting the template by inserting the dynamic flight deals, creating a Campaign, attaching the right Segment, and sending the Campaign, all in one fell swoop. Next steps will be to adjust the Weekendr sign up site. I need to start collecting airport codes from people. I will also need to reach out to the current subscribers and get their airport codes as well.


Also published on Medium.