Golang Tutorial Extra Step 5 – Golang and Mailchimp



Golang Tutorial Extra Step 5 – Golang and Mailchimp

Golang Tutorial Extra Step 5 - Golang and Mailchimp

Today, we’re talking about Mailchimp because you have probably heard me talk about all this email marketing stuff. 

Dancingnomads has around 700–800 users as of the current writing. They are not on Mailchimp and if you have that many users, you want them on Mailchimp because it makes email marketing campaigns EASIER.

What We’re Trying to Do

We are trying to import our users from our database to Mailchimp. We are using Golang for our backend and we’re using an api that utilizes Golang and Mailchimp. Our package of choice will be hanzoai/gochimp3. Our Golang client for Mailchimp API 3.0. Go over there, and install the package and take a read over the “Usage”.

At this point, I encourage you to join our Youtube, Facebook, and Email communities (check below for links)!

I invite you to check out the member.go file. In here are functions that are particularly fascinating for us. CreateMember (to subscribe a user) and UpdateMember (to update a user’s information).

The Catch Me

I’m using Tags to set the dances that a dancer does in Mailchimp. This is so I can segment my dancers based on dances for targeted email campaigns in Mailchimp (you don’t want to send salsa related emails to ballroom dancers).

MailChimp Members (https://mailchimp.com/developer/reference/lists/list-members/)

This refers to CreateMember and UpdateMember from the functions above.
Under the Create tab, we have tags available under a Request Body Parameter. This is not the case under the Edit tab that we use for UpdateMember.

MailChimp Member Tags
(https://mailchimp.com/developer/reference/lists/list-members/list-member-tags/#post_/lists/-list_id-/members/-subscriber_hash-/tags)

Since Members does not have an option to update tags in the Edit API. We need to leverage Member Tags to update our Tags.

If you’re a budding business or a seasoned business and you don’t have a segmented email list, but you have a database of users with specifics about them, then I really suggest importing your users into Mailchimp segmented by tags. This will allow you to make more targeted marketing campaigns, which are more relatable for your users.

Accompanying medium article: https://medium.com/@donaldlee50/golang-tutorial-extra-step-5-9cb947b9f5e5

Don’t forget to like, comment, and subscribe!!!

========================================================
Reference Links
========================================================
Gochimp3: https://github.com/hanzoai/gochimp3
Gochimp3 members.go: https://github.com/hanzoai/gochimp3/blob/master/members.go
Tags not being set with list.UpdateUser: https://github.com/hanzoai/gochimp3/issues/34
Members Documentation: https://mailchimp.com/developer/reference/lists/list-members/
Member Tags Documentation: https://mailchimp.com/developer/reference/lists/list-members/list-member-tags/#post_/lists/-list_id-/members/-subscriber_hash-/tags
========================================================
Connect with me!
========================================================
Linkedin: https://www.linkedin.com/in/donaldlee50
Instagram: https://www.instagram.com/donlee50/
Twitter: https://twitter.com/donaldlee50
Youtube: https://youtube.com/coursehack
Mailing List: http://bit.ly/coursehack-mailing-list
Coursehack’s Facebook Group: http://bit.ly/join-coursehack-facebook-group

Don’t forget to like, comment, and subscribe!