MailChimp.Net is licensed under the MIT license.
Install the NuGet package from the package manager console:
Install-Package MailChimp.Net.V3Using it in code
IMailChimpManagermanager=newMailChimpManager(apiKey);//if you have it in code<add key="MailChimpApiKey" value="apiKEY" />IMailChimpManager manager =newMailChimpManager();//if you have it in configHint: MailChimp needs at least TLS 1.2. To use this library you have to set TLS 1.2 in ServicePointManager
ServicePointManager.SecurityProtocol = ServicePointManager.SecurityProtocol | SecurityProtocolType.Tls12;
// Instantiate new managerIMailChimpManagermailChimpManager=newMailChimpManager(apiKey);varmailChimpListCollection=awaitthis.mailChimpManager.Lists.GetAllAsync().ConfigureAwait(false);varmailChimpListCollection=awaitthis.mailChimpManager.Lists.GetAllAsync(newListRequest{Limit=50}).ConfigureAwait(false);varlistId="TestListId";awaitthis.mailChimpManager.Members.GetAllAsync(listId).ConfigureAwait(false);varlistId="TestListId";// Use the Status property if updating an existing membervarmember=newMember{EmailAddress=$"githubTestAccount@test.com",StatusIfNew=Status.Subscribed};member.MergeFields.Add("FNAME","HOLY");member.MergeFields.Add("LNAME","COW");awaitthis.mailChimpManager.Members.AddOrUpdateAsync(listId,member);// Get reference to existing user if you don't already have itvarlistId="TestListId";varmembers=awaitthis.mailChimpManager.Members.GetAllAsync(listId).ConfigureAwait(false);varmember=members.First(x =>x.EmailAddress=="abc@def.com");// Update the usermember.MergeFields.Add("FNAME","New first name");member.MergeFields.Add("LNAME","New last name");awaitthis.mailChimpManager.Members.AddOrUpdateAsync(listId,member);Tagstags=newTags();tags.MemberTags.Add(newTag(){Name="Awesome Person",Status="active"});awaitthis.mailChimpManager.Members.AddTagsAsync(listId,"abc@def.com",tags);To remove the tag, use "inactive" as the Status.
Progress on full implementation
- API 100%
- Authorized Apps 100%
- Automations 100%
- Batch Operations 100%
- Campaigns 100%
- Campaign Content 100%
- Campaing Feedback 100%
- Campaign Folders 100%
- Campaing Send Checklist 100%
- Conversations 100%
- Conversations Messages 100%
- ECommerce Stores 100%
- File Manager Files 100%
- File Manager Folders 100%
- Lists 100%
- List Abuse Reports 100%
- List Activity 100%
- List Clients 100%
- List Growth History 100%
- List Interest Categories 100%
- List Members 100%
- List Segments 100%
- List Web Hooks 100%
- Template Folders 100%
- Templates 100%
- Template Default Content 100%
- Reports 100%
- Report Click Reports 100%
- Report Domain Performance 100%
- Report EepURL Reports 100%
- Report Email Activity 100%
- Report Location 100%
- Report Sent To 100%
- Report Sub-Reports 100%
- Report Unsubscribes 100%
- ECommerce Carts 100%
- ECommerce Customers 100%
- ECommerce Orders 100%
- ECommerce Order Lines 100%
- ECommerce Products 100%
- ECommerce Product Variants 100%
Total 100%
This project exists thanks to all the people who contribute. [Contribute].
Thank you to all our backers! 🙏 [Become a backer]
Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]