Import Contacts to Your MailChimp Audience with Cron and Python

February 11, 2021

Are you doing a repetitive task that feels like it could be automated? I was. Every day for the past year I’d been importing new users for an app into MailChimp by hand. No more! Now that I’ve learned how to code I’ve handed that task over to Python and Cron.

The Boring Task to Be Automated:

  1. Download a CSV file with the app users from Google Drive (this file is automatically updated daily).
  2. Sort the CSV rows by the column “id” and pull only the new users (deleting the other 10,000+ rows).
  3. Delete the unnecessary columns, leaving only the information that is used by MailChimp.
  4. Log into Mailchimp and upload the new CSV.
  5. Tag the new subscribers with “Downloaded app.”

Gosh that was a mouthful, now you understand why I was eager to automate this. I’d been talking with the app developers for some time about directly connecting the app with the MailChimp API - but it just wasn’t a priority for them. Hence I *finally* took matters into my own hands.

The Tools I Used to Automate this Task:

  1. Google Drive API
  2. MailChimp API
  3. Python
  4. Cron

That’s all I’ll be saying here, watch the video at the top of this post or check out my github repository if you’re curious to learn more.

Stayed tuned for the next post in this series - I'll be talking about Selenium.

P.S. I had a lot of fun making this video and tapping into the Photoshop and After Effects skills I’d learned for my old job.