We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 31566
    • 14 Posts
    I have the "There was a problem subscribing you" error message.

    And I didn’t succeed in calling the MailChimp List Snippet for debugging. How do I call it?
    I copied-pasted the code of the MailChimp List Snippet in a new snippet that I named "mailchimpList".

    Here’s my snippets ’calls :
    [!mailchimpSubscribe?form=`mailchimpForm` &listId=`000050477e`!]
    [!mailchimpList!]


    If I look inside the mailchimpSubscripe snippet code I found that the error message is fired by :
    if (!$retVal) {
    			if ($debug == true) {
    				$debugOutput .= "Unable to load listSubscribe()!\n";
    				$debugOutput .= "\tCode=".$api->errorCode."\n";
    				$debugOutput .= "\tMsg=".$api->errorMessage."\n";
    			}
    			$modx->setPlaceholder('MailChimp.message', 'There was a problem subscribing you');


    That probably means there’s a problem with the fields names I gave in my form. But I can’t figure out what names Mailchimp is awaiting.
    I already changed the original mc_FIRST and mc_LAST by FNAME and LNAME (or mc_FNAME and mc_LNAME) with no result.

    I tried to change in the snippet this line :
    $retVal = $api->listSubscribe($listId, $_POST['mc_EMAIL'], $mergeVars);

    by this one :
    $retVal = $api->listSubscribe($listId, $_POST['EMAIL'], $mergeVars);


    No better.
    What I am missing ?
    • I’m having the same problem here.
      I tried the &debug parameter and i get « Unable to load lists()! Code=104 Msg=Invalid Mailchimp API Key: *API key here*. You are accessing the wrong datacenter - your client library may not properly support our datacenter mapping scheme. »
      I saw either that the API is now 1.2, but i guess the 1.1 should still work.

      Any hint/idea where to look at would be much welcomed
      • Does this snippet work in Revolution? I haven’t tried yet, but may have a need in the near future - anyone else had experience huh
          Helen Warner
          Number one pixel!
          Proud to be linked with MODX at Crimson Pixel
          • 8434
          • 5 Posts
          I managed to get this working in Revolution. I’ve removed the need for the username&password and now only require an API key. So, starting from Garry’s snippet, do the following:

          EDIT: Forgot to mention you need to update the API to 1.3 - I just added this at point 2.

          1) Find your Mailchimp API key in Mailchimp by going to Account (very top left) -> API Keys & Info (bottom). The key will look something like 45g7453redf3b26r019d230a543e84fg-us2

          2) Download the latest Mailchimp PHP API (as of this post, 1.3) - http://www.mailchimp.com/api/downloads/#php. Replace the API in classes/MCAPI.class.php with the one you just downloaded.

          3) Erase everything in config.inc.php and replace with:
          <?php
          $apikey = 'YOUR MAILCHIMP APIKEY';
          


          4) In the snippet code (subscribe.snippet.php), go to line 20 and replace
          $api = new MCAPI($username, $password);

          with
          $api = new MCAPI($apikey);


          5) Replace the chunk (subscribe.form.tpl), with the following. It changes the evo tags to revo and swaps mc_FIRST/mc_LAST with mc_FNAME and mc_LNAME (what MC will expect):
          <p>[[+MailChimp.message]]</p>
          <form method="post" action="[[~[[*id]]]]">
          	<label>First Name: <input type="text" name="mc_FNAME" value="" /></label><br />
          	<label>Last Name: <input type="text" name="mc_LNAME" value="" /></label><br />
          	<label>Email: <input type="text" name="mc_EMAIL" value="" /></label>
          	<input type="submit" name="subscribe" value="Subscribe" />
          </form>
          


          5) Snippet call becomes: (evo->revo)
          [[!mailchimpSubscribe?form=`mailchimpForm` &listId=`<YOUR LIST ID>`]]


          That’s it. I’m going to work on an lightweight AJAX version using Jquery shortly.
            - Brent
            • 8609
            • 607 Posts
            Sweet! Thanks for sharing this, will give it a try



            Quote from: ecreate at Dec 01, 2010, 05:47 PM

            I managed to get this working in Revolution. I’ve removed the need for the username&password and now only require an API key. So, starting from Garry’s snippet, do the following:

            EDIT: Forgot to mention you need to update the API to 1.3 - I just added this at point 2.

            1) Find your Mailchimp API key in Mailchimp by going to Account (very top left) -> API Keys & Info (bottom). The key will look something like 45g7453redf3b26r019d230a543e84fg-us2

            2) Download the latest Mailchimp PHP API (as of this post, 1.3) - http://www.mailchimp.com/api/downloads/#php. Replace the API in classes/MCAPI.class.php with the one you just downloaded.

            3) Erase everything in config.inc.php and replace with:
            <?php
            $apikey = 'YOUR MAILCHIMP APIKEY';
            


            4) In the snippet code (subscribe.snippet.php), go to line 20 and replace
            $api = new MCAPI($username, $password);

            with
            $api = new MCAPI($apikey);


            5) Replace the chunk (subscribe.form.tpl), with the following. It changes the evo tags to revo and swaps mc_FIRST/mc_LAST with mc_FNAME and mc_LNAME (what MC will expect):
            <p>[[+MailChimp.message]]</p>
            <form method="post" action="[[~[[*id]]]]">
            	<label>First Name: <input type="text" name="mc_FNAME" value="" /></label><br />
            	<label>Last Name: <input type="text" name="mc_LNAME" value="" /></label><br />
            	<label>Email: <input type="text" name="mc_EMAIL" value="" /></label>
            	<input type="submit" name="subscribe" value="Subscribe" />
            </form>
            


            5) Snippet call becomes: (evo->revo)
            [[!mailchimpSubscribe?form=`mailchimpForm` &listId=`<YOUR LIST ID>`]]


            That’s it. I’m going to work on an lightweight AJAX version using Jquery shortly.
              • 20014
              • 200 Posts
              excellent one ecreate, thanks so much for sharing and not keeping it in your personal stash!
                • 25201
                • 94 Posts
                That’s it. I’m going to work on an lightweight AJAX version using Jquery shortly.

                @ecreate: any work to share on this? Would love to use ajax for subscriptions.

                Update: am using the ajax examples at the mailchimp api website, works great!

                rnd
                  • 13736
                  • 345 Posts
                  There is a Wordpress plugin for MailChimp that allows subscribe/unsubscribe from multiple lists. Would that help someone figure out a Revolution snippet to do the same? Not sure what the copyright is.

                  http://wordpress.org/extend/plugins/autochimp/


                  And the Mailchimp webhooks reference. http://apidocs.mailchimp.com/webhooks/
                    • 6504
                    • 23 Posts
                    Quote from: ecreate at Dec 01, 2010, 05:47 PM

                    I managed to get this working in Revolution. I’ve removed the need for the username&password and now only require an API key. So, starting from Garry’s snippet, do the following:

                    EDIT: Forgot to mention you need to update the API to 1.3 - I just added this at point 2.

                    1) Find your Mailchimp API key in Mailchimp by going to Account (very top left) -> API Keys & Info (bottom). The key will look something like 45g7453redf3b26r019d230a543e84fg-us2

                    2) Download the latest Mailchimp PHP API (as of this post, 1.3) - http://www.mailchimp.com/api/downloads/#php. Replace the API in classes/MCAPI.class.php with the one you just downloaded.

                    3) Erase everything in config.inc.php and replace with:
                    <?php
                    $apikey = 'YOUR MAILCHIMP APIKEY';
                    


                    4) In the snippet code (subscribe.snippet.php), go to line 20 and replace
                    $api = new MCAPI($username, $password);

                    with
                    $api = new MCAPI($apikey);


                    5) Replace the chunk (subscribe.form.tpl), with the following. It changes the evo tags to revo and swaps mc_FIRST/mc_LAST with mc_FNAME and mc_LNAME (what MC will expect):
                    <p>[[+MailChimp.message]]</p>
                    <form method="post" action="[[~[[*id]]]]">
                    	<label>First Name: <input type="text" name="mc_FNAME" value="" /></label><br />
                    	<label>Last Name: <input type="text" name="mc_LNAME" value="" /></label><br />
                    	<label>Email: <input type="text" name="mc_EMAIL" value="" /></label>
                    	<input type="submit" name="subscribe" value="Subscribe" />
                    </form>
                    


                    5) Snippet call becomes: (evo->revo)
                    [[!mailchimpSubscribe?form=`mailchimpForm` &listId=`<YOUR LIST ID>`]]


                    That’s it. I’m going to work on an lightweight AJAX version using Jquery shortly.

                    I have made the changes and updated the zip (which is attached) for those who can’t be bothered to update the code tongue

                    Well done eCreate!!! Great Contribution!
                    • Someone should submit this to the Add-ons.
                        Ryan Thrash, MODX Co-Founder
                        Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me