Sitecore 8.2 Get mailing list from MailChimp API
Posted by Xing Liu on 3/20/2017
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.