GithubHelp home page GithubHelp logo

skirondotnet / mailchimp.net Goto Github PK

View Code? Open in Web Editor NEW

This project forked from danesparza/mailchimp.net

0.0 2.0 0.0 771 KB

.NET Wrapper for the MailChimp v2.0 API

License: MIT License

C# 100.00%

mailchimp.net's Introduction

MailChimp.NET

.NET Wrapper for the MailChimp v2.0 API

Quick Start

  1. Add a reference to MailChimp.dll, or install the NuGet package (located here https://nuget.org/packages/MailChimp.NET/ )
  2. Next, you will need to provide MailChimp.NET with your API key in code. Need help finding your API key? Check here: http://kb.mailchimp.com/article/where-can-i-find-my-api-key

In your application, call:

MailChimpManager mc = new MailChimpManager("YourApiKeyHere-us2");
ListResult lists = mc.GetLists();

Examples

Getting the first 100 users in each list:
using MailChimp;
using MailChimp.Lists;

MailChimpManager mc = new MailChimpManager("YourApiKeyHere-us2");
ListResult lists = mc.GetLists();

//  For each list
foreach(var list in lists.Data)
{
    //  Write out the list name:
    Debug.WriteLine("Users for the list " + list.Name);

    //  Get the first 100 members of each list:
    MembersResult results = mc.GetAllMembersForList(list.Id, "subscribed", 0, 100);

    //  Write out each member's email address:
    foreach(var member in results.Data)
    {
        Debug.WriteLine(member.Email);
    }
}
Subscribe an email address to a list:
MailChimpManager mc = new MailChimpManager("YourApiKeyHere-us2");

//	Create the email parameter
EmailParameter email = new EmailParameter()
{
    Email = "[email protected]"
};

EmailParameter results = mc.Subscribe("YourListID", email);
Getting location data for each list:
MailChimpManager mc = new MailChimpManager("YourApiKeyHere-us2");
ListResult lists = mc.GetLists();

//  For each list
foreach(var list in lists.Data)
{
    Debug.WriteLine("Information for " + list.Name);

    //  Get the location data for each list:
    List<SubscriberLocation> locations = mc.GetLocationsForList(list.Id);

    //  Write out each of the locations:
    foreach(var location in locations)
    {
        Debug.WriteLine("Country: {0} - {2} users, accounts for {1}% of list subscribers", location.Country, location.Percent, location.Total);
    }
}

Status

Here is the progress so far (according to the MailChimp API docs ) :

  • Campaigns related: 93% (14 of 15)
  • Ecomm related: 0% (0 of 3)
  • Folder related: 100% (4 of 4)
  • List related: 66% (24 of 36)
  • Helper related: 60% (6 of 10)
  • Reports related: 11% (2 of 18)
  • Templates related: 100% (6 of 6)
  • User related: 100% (6 of 6)
  • Vip related: 0% (0 of 4)

Overall: 61% (62 of 102)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.