Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jon 17 posts 40 karma points
    Sep 30, 2010 @ 11:17
    Jon
    1

    Unsubscribe with new Mailchimp Datacenters

    Hi Thomas. I noticed on Codeplex that you'd updated the MC4Umbraco sourcecode to allow for the new mailchimp datacenters. This works great in the AddSubscriber method but it looks like the UnSubscribe method still errors. I copied your approach in the other method and changed the code as follows on my version:

    string dataCenter = String.Empty;
    if (!String.IsNullOrEmpty(_APIKey))
    {
    dataCenter = _APIKey.Substring(_APIKey.Length - 3, 3) + ".";
    }
    string APIUrl = string.Format("http://{3}api.mailchimp.com/1.2/?method=listUnsubscribe&apikey={0}&id={2}&email_address={1}&delete_member=1&send_goodbye=1&send_notify=0&output=xml", _APIKey, emailAddress, mailChimpListId, dataCenter);
     

    It's playing nicely now. Just thought I'd let you know, in case it's of any use to you.

    Cheers

    Jon

  • Thomas Vestergaard 52 posts 138 karma points
    Sep 30, 2010 @ 15:33
    Thomas Vestergaard
    0

    Hey Jon

    You are absolutely right. Thanks a lot!

    /Thomas

  • Antonio Amézquita 35 posts 52 karma points
    Dec 12, 2011 @ 09:27
    Antonio Amézquita
    0

    Hi there, thanks for sharing the great package!

     

    The unsubscribe template gives me an error like this one:

    Invalid Mailchimp API Key: (X). You are accessing the wrong datacenter - your client library may not properly support our datacenter mapping scheme. (104)

     

    I tought this might be related, I am on an Umbraco v 4.0.3 installation , .NET Version: 4.0, MailChimp4Umbraco 0.92

     

    Is there a .dll or something that needs to be replaced for this to work? 

    Thanks for any help!

    Antonio

     

  • Thomas Vestergaard 52 posts 138 karma points
    Dec 12, 2011 @ 09:39
    Thomas Vestergaard
    0

    Hi Antonio

    There is a bug in the current version, causing the error you see.
    If it's urgent, I suggest that you download the package sourcecode from codeplex here: http://mailchimp4umbraco.codeplex.com/releases/view/47230

    In the BusinessLogic project, open ChimpApi/MailChimpCommunicator.cx swap the contents of the UnSubscribe method with the code below.
    When that's done, you should be able to compile a new Mailchimp4Umbraco.Businesslogic.dll and overwrite the version you have on your sever.
    I'm sorry for the inconvenience, I will fix the package once I get the time :)

              // Build API call URL
                string dataCenter = String.Empty;
                if (!String.IsNullOrEmpty(_APIKey))
                {
                    dataCenter = _APIKey.Substring(_APIKey.Length - 3, 3) + ".";
                }

              // Build API call URL
                string APIUrl = string.Format("http://{4}api.mailchimp.com/1.2/?method=listUnsubscribe&apikey={0}&id={2}&email_address={1}&delete_member=1&send_goodbye=1&send_notify=0&output=xml", _APIKey, emailAddress, mailChimpListId, dataCenter);

                #region Call API
                try
                {
                    byte[] data = _webClient.DownloadData(APIUrl);
                    return new MailChimpResponse(ASCIIEncoding.ASCII.GetString(data));

                }
                catch (Exception)
                {
                    // If we end up here, the MailChimp API URL is not valid
                    return new MailChimpResponse(string.Empty);
                }
                #endregion

  • Antonio Amézquita 35 posts 52 karma points
    Dec 15, 2011 @ 12:54
    Antonio Amézquita
    0

    Hi Thomas 

    So it worked, I just had to add the list Id into the unsubscribe macro and it all worked awesome!

    Thanks much!

     

     

Please Sign in or register to post replies

Write your reply to:

Draft