Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Subscribing Users to MailChimp using ASP.NET

I've been tasked with developing a simple package to post from a newsletter signup form to MailChimp. Easy enough for me to do in PHP, but this has to be in ASP.NET, which I don't know at all.

I've found my way to PerceptiveMCAPI, gotten my API keys, my list id, and my form fields set up, but I just have no idea how I'm supposed to create the actual listSubscribe command. The only examples I can find are for listBatchSubscribe, which I haven't been able to water down to only work for a single iteration.

Please help! I need to be pointed in the right direction, or given an example of how to actually build this command.

Thanks in advance.

like image 393
cdukes Avatar asked Sep 22 '11 16:09

cdukes


1 Answers

Hope you understand c# code.

listSubscribe cmd = new listSubscribe();

listSubscribeParms newlistSubscribeParms = new listSubscribeParms 
{ 
    apikey = apikey,
    id = listid,
    email_address = "[email protected]",
    merge_vars =  new Dictionary<string, object>(),
    double_optin = false,
    email_type = EnumValues.emailType.html,
    replace_interests = true,
    send_welcome = false,
    update_existing = true 
};            

listSubscribeInput newlistSubscribeInput = new listSubscribeInput(newlistSubscribeParms);

var subscribeSuccess = cmd.Execute(newlistSubscribeInput);

The listSubscribe, listSubscribeParms, listSubscribeInput come from the PerceptiveMCAPI library.

hope this helps.

if it does, then don't forget to mark as answer.

like image 114
Ravi Shankar Avatar answered Sep 27 '22 20:09

Ravi Shankar