.Net wrapper for MailChimp v3.0


A lot of you probably have already used MailChimp to market your product on the internet. I have used it several times for my client and portal experience is really a hassle free. For those of you who don’t know what mailchimp is let me simply state it in one line –

“MailChimp is a simple email marketing software (EMS) which gives you a number of easy options for designing, sending and saving templates of your emails.”

In the mid of 2015, MailChimp have officially released version 3.0 API and they start to deprecate their earlier version. Since they were deprecating their earlier version the only stable .Net wrapper for v2.0 also start losing its light. I followed danesparza on his github and he was planning to work for v3.0 but did not mention any date. I thought to give a pull request but then I realize mailchimp v2.0 is a weird hybrid of RESTful and RPC, almost all of their API interaction has changed in v3.0 . So, its better to design the whole wrapper from scratch. I also came across to their official blog where Pete Holiday says a good api should not need an sdk which clearly gave hint that they are not going to offer any wrapper/sdk for any language!

So, I Did one for .Net  😀

Its not fully done yet, but most of the features that you might need in your day to day business is already implemented. The best part is, it is open source in github here, so you can have a look on the code base and send me a pull request any time you want 🙂

You can fetch campaign analytic report, can manage your Template,  can create and send campaign, can automate the workflow. Pretty much all the features are already baked in with this wrapper, check the Read Me file  for details.

How to use it :

It’s dead simple. Fire up an console application and open the Package manager console and type:


Open the config file and add the following line.

<add key="MailChimpApiKey" value="--Your_MailChimp_APIKey--" />

Once you are done with this settings, you are good to use the entire wrapper 🙂

One question that you might be wondering with which class you are going to interact. Well, all class are prefixed with the word MailChimp. If you are using Visual Studio you can take the advantage of IntelliSense.


For example, if you want to work with Report then you should probably want to instantiate MailChimpReports class.

Following code demonstrate how you can Create a campaign, upload raw email template and send mail to its subscriber :

MailChimpCampaigns campaign = new MailChimpCampaigns();
Recipients recipients = new Recipients()
list_id = "0a84a63afc" //Put your list id
Settings campaignSettings = new Settings()
subject_line = "Write down your subject line ",
title = "We are Ready !!!!",
from_name = "Shahriar Hossain",
reply_to = "shossain@desme.com",
template_id = 18073, //Put your template id that you want to use
authenticate = true,
auto_footer = false
Tracking campaignTracking = new Tracking()
opens = true,
html_clicks = true,
text_clicks = true
ResultWrapper<Campaign> campaignCreationResult = campaign.CreateCampaignAsync(CampaignType.regular, recipients, campaignSettings, campaignTracking).Result;
if (campaignCreationResult.HasError == false)
///Upload email template
ContentSetting cSetting = new ContentSetting();
string path = @"file_directory\fileName_with_extension";
FileParser parser = new FileParser();
cSetting.html = parser.EmailParser(path);
var setContentStatus = campaign.SetCampaignContentAsync(campaignCreationResult.Result.id, cSetting).Result;
///Alternatively you can Set template as well
//ContentTemplate template = new ContentTemplate()
// id = "18073" //Put your template id that you want to use
//var setContentStatus = campaign.SetCampaignContentAsync(campaignCreationResult.Result.id, template).Result;
var checkListResult = campaign.GetCampaignContentAsync(campaignCreationResult.Result.id).Result;
if (checkListResult.is_ready)
var sendStatus = campaign.SendCampaignAsync(campaignCreationResult.Result.id).Result;
String.Format("Best of Luck! I can't handle :p");

Disclaimer :

I have tried my best to make it a bug free, have checked the entire solution against test data and it passed all the time. But that really doesn’t ensure its fully bug free, this is because the data that I used to check the process was created by me! I have asked the mailchimp support team to provide test data/test account for this purpose and they said they don’t have anything like that! Anyway, great hanselman once said A Bug Report is a Gift.  So it is! If you find any bug feel free to create an issue. Please be specific about what’s not working.

Thats pretty much everything I could write about MailChimp.Api.Net. Buzz me in the comment section if you have any feedback.