Today’s goal was to integrate email into my application. Upon some investigation, trial and error, I first ditched Mailchimp for SendGrid, only to come back and realize it was the solution I was looking for all along.
Originally I found out that I could trigger emails via the API, but they have a one day delay. They have some other automations, but it all seemed like it didn’t quite fit into what I am looking for, so I started to look elsewhere.
I started searching for new solutions, and landed on SendGrid. It was free, and easy to setup. They had a working example in their documentation with integrating with Laravel and I was on my way pretty quickly. I was able to send an email to myself with some test copy and I received it. I felt like my issue was solved, until hours later, I started thinking about logistics. Chances are, I’m gonna have a group of deals for a given airport, and I am going to want to send that out to all my customers who belong to that airport. With the SendGrid method, I was going to send them out individually via my application, and that might be unreliable. If my list grows to even a hundred or so people to a given airport, that could potentially have deliverability issues or api issues that would lead to a user not receiving my email.
I decided to look again at what Mailchimp had, since my email sign up was setup through there, and landed on an interesting concept. What if I was to create everything on the fly with Mailchimp’s API. The process would look like this:
- Create a template with the deal information
- Create a campaign with the template and a segmented list of users
- Send or schedule that campaign
First thing to do would be to create a base template that has 90% of the html pre-written. Then inject my dynamic data from the flight deals for a given airport into that template on my server, grab the html and create a template in Mailchimp. Next step would be to dynamically create the campaign with a subject line, template I just created, and any other info required. Last step would be to send it or schedule it for a better time in the day.
Although this is more work, I feel like it helps solve my issue of logistics by limiting a given airport deal to a few api calls instead of running api calls for every single user in a given segment.
At first, I was pissed at myself for choosing Mailchimp right away to gather emails without really judging all of my needs. I started to look around and found a solution that seemed more of what I was looking for, but upon deeper examination, noticed that Mailchimp was actually what I needed all along. This process really gave me a better understanding of how to approach this problem. Instead of figuring out the problem of how to email a particular user with a given deal, I needed to look holistically at the segment of users as one. How do I send a single email to a list or segment of users when a deal comes in.
My work with setting up SendGrid was interesting and not in vain since I may keep the integration alive since their transactional email service is also free for up to 2,000 contacts and 40k emails a month. My main concern at this point is if there are limits on how many campaigns, templates, etc I can create in Mailchimp. My other concern is if it can become unruly to manage inside the dashboard. I think my only way to know is by trying it and seeing what happens. If I run up against some problems, I will deal with it then. This seems like an avenue I can go down and it’s worth trying.
Tomorrow, I am looking to have email squared away. These are my goals for tomorrow:
- Validate idea with Mailchimp regarding creating campaigns and templates on the fly via the API
- Design a template
- Receive email in my inbox via this method with real deals
Also published on Medium.