Sitecore 8.2 Get mailing list from MailChimp API

Xing Liu • 3/20/2017

Connecting Mailchimp newsletters to Sitecore content management system

Recently, there was a project requirement that needed to get a list of email addresses from a MailChimp account’s existing list.  MailChimp provides a 3.0 API to retrieve the necessary information. You can find the MailChimp API references from the following link: http://developer.mailchimp.com/documentation/mailchimp/

Furthermore, there is a developed MailChimp API 3.0 wrapper for .Net framework already, which is good for integration with Sitecore project.  It’s available for Nuget package download called MailChimp.Net, which is a MailChimp 3.0 API wrapper developed by Brandon Seydel. https://github.com/brandonseydel/MailChimp.Net With this wrapper, you can easily retrieve the subscribers from a MailChimp list using the calls below:

List<string> emails = new List<string>();
IMailChimpManager mailChimpManager = new MailChimpManager(Settings.GetSetting("MailChimpAPIKey"));
var mailChimpListCollection = mailChimpManager.Members.GetAllAsync(Settings.GetSetting("MailChimpBlogListId")).Result;

The function mailChimpManager.Members.GetAllAsync(ListId).Result returns a list of members from the MailChimp List, which you can retrieve the email from each member and do a bulk email messages operation from this point. 

Xing Liu

Xing Liu is a Sitecore MVP with expertise in all aspects of ASP.NET and SQL Server development across a variety of industries including Government, Banking, Healthcare and Energy. He provides technical thought leadership and consulting to SymSoft and client development teams. Xing has deep expertise in using Sitecore Helix in an Agile delivery model to streamline the construction of complex Sitecore websites, portals and their associated authoring environments. Xing is also a globally recognized photographer with an Instagram following approaching 100,000.

Explore topics:

Other Blog Posts from Xing Liu