<?xml version="1.0"?><!-- generator="bbPress" -->

<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
>

<channel>
<title>MachForm Community Forums Topic: HOW TO:  Add Mailchimp integration via Mailchimp API</title>
<link>https://www.machform.com/forums/</link>
<description>MachForm Community Forums Topic: HOW TO:  Add Mailchimp integration via Mailchimp API</description>
<language>en</language>
<pubDate>Thu, 11 Jun 2026 03:17:38 +0000</pubDate>

<item>
<title>tmparisi on "HOW TO:  Add Mailchimp integration via Mailchimp API"</title>
<link>https://www.machform.com/forums/topic/how-to-add-mailchimp-integration-via-mailchimp-api#post-15070</link>
<pubDate>Fri, 15 Jun 2012 22:51:05 +0000</pubDate>
<dc:creator>tmparisi</dc:creator>
<guid isPermaLink="false">15070@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;I don't know much about groupings as I have not utilized them.  However, from a quick glance it seems that a record is not inserted into a group, but rather, the record is given a classification of, in your case, Group A, Group B, or Group C.  I am going to assume that this means the user is provided with some type of option in your MachForm, such as a checkbox list of options to be enrolled into.&#60;/p&#62;
&#60;p&#62;So:&#60;/p&#62;
&#60;p&#62;User goes to your form, enters their personal information, selects all of their interests from a group of up to 3, clicks submit, user now has record in mailchimp with linkages to the selected interest/groups.&#60;/p&#62;
&#60;p&#62;This is just a guess and has not been tested, but I would try something along the lines of:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;$merge_vars = Array( &#38;#39;EMAIL&#38;#39; =&#38;gt; $table_data[&#38;#39;element_2&#38;#39;], &#38;#39;FNAME&#38;#39; =&#38;gt; $table_data[&#38;#39;element_1_1&#38;#39;], &#38;#39;LNAME&#38;#39; =&#38;gt; $table_data[&#38;#39;element_1_2&#38;#39;] , &#38;#39;GROUPINGS&#38;#39; =&#38;gt; array(array(&#38;#39;name&#38;#39; =&#38;gt; &#38;#39;User Interests&#38;#39;, &#38;#39;groups&#38;#39; =&#38;gt; &#38;#39;Group A&#38;#39;),));&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;At this point we have defined the record to be correlated with group title &#34;user interests&#34; and group name &#34;group a&#34;.  However, MachForm wont understand this, so perhaps we could set up some sort of if/then/else statement in PHP to grab the proper group(s) that the user selected on your MachForm.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;if $table_data[&#38;#39;element_7&#38;#39;] group a is selected
{
    if $table_data[&#38;#39;element_7&#38;#39;] group b is selected
    {
        if $table_data[&#38;#39;element_7&#38;#39;] group c is selected
        {
            $merge_vars = Array( &#38;#39;EMAIL&#38;#39; =&#38;gt; $table_data[&#38;#39;element_2&#38;#39;], &#38;#39;FNAME&#38;#39; =&#38;gt; $table_data[&#38;#39;element_1_1&#38;#39;], &#38;#39;LNAME&#38;#39; =&#38;gt; $table_data[&#38;#39;element_1_2&#38;#39;] , &#38;#39;GROUPINGS&#38;#39; =&#38;gt; array(array(&#38;#39;name&#38;#39; =&#38;gt; &#38;#39;User Interests&#38;#39;, &#38;#39;groups&#38;#39; =&#38;gt; &#38;#39;Group A, Group B, Group C&#38;#39;),));
        }
    }
    else
    {
    $merge_vars = Array( &#38;#39;EMAIL&#38;#39; =&#38;gt; $table_data[&#38;#39;element_2&#38;#39;], &#38;#39;FNAME&#38;#39; =&#38;gt; $table_data[&#38;#39;element_1_1&#38;#39;], &#38;#39;LNAME&#38;#39; =&#38;gt; $table_data[&#38;#39;element_1_2&#38;#39;] , &#38;#39;GROUPINGS&#38;#39; =&#38;gt; array(array(&#38;#39;name&#38;#39; =&#38;gt; &#38;#39;User Interests&#38;#39;, &#38;#39;groups&#38;#39; =&#38;gt; &#38;#39;Group A, Group B&#38;#39;),));
    }
}
else
{
$merge_vars = Array( &#38;#39;EMAIL&#38;#39; =&#38;gt; $table_data[&#38;#39;element_2&#38;#39;], &#38;#39;FNAME&#38;#39; =&#38;gt; $table_data[&#38;#39;element_1_1&#38;#39;], &#38;#39;LNAME&#38;#39; =&#38;gt; $table_data[&#38;#39;element_1_2&#38;#39;] , &#38;#39;GROUPINGS&#38;#39; =&#38;gt; array(array(&#38;#39;name&#38;#39; =&#38;gt; &#38;#39;User Interests&#38;#39;, &#38;#39;groups&#38;#39; =&#38;gt; &#38;#39;Group A&#38;#39;),));
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Maybe something like this?  This assumes your checkboxes are element_7.  Also, I am not sure how MachForm deals with checkboxes in terms of how it tells if they are checked or not (E.g. 1 = checked, 0 = not checked?).&#60;/p&#62;
&#60;p&#62;Anyhow, I realize this is VERY rough and not the easiest solution, but it is just off the top of my head.  Perhaps someone else may have a little more insight.  If you are unable to figure it out, I would suggest either writing a support ticket OR going to stackoverflow.com as those guys are awesome over there!&#60;/p&#62;
&#60;p&#62;Whatever you figure out, please post your solution here for others to use.  Thanks!
&#60;/p&#62;</description>
</item>
<item>
<title>fpgrenier on "HOW TO:  Add Mailchimp integration via Mailchimp API"</title>
<link>https://www.machform.com/forums/topic/how-to-add-mailchimp-integration-via-mailchimp-api#post-15068</link>
<pubDate>Fri, 15 Jun 2012 21:45:49 +0000</pubDate>
<dc:creator>fpgrenier</dc:creator>
<guid isPermaLink="false">15068@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;Yes, the code works beautifully...&#60;/p&#62;
&#60;p&#62;It currently drops the subscription into the list I have specified with $listId...  but within that list, I have a few groups set-up (group A, group B, group C...) and I would love for the subscriptions to automaticaly get inserted into one of those.&#60;/p&#62;
&#60;p&#62;I found some information on the subject (http://apidocs.mailchimp.com/api/1.3/listsubscribe.func.php), but I can't seem to get it to work with your script.&#60;/p&#62;
&#60;p&#62;Thanks again!
&#60;/p&#62;</description>
</item>
<item>
<title>tmparisi on "HOW TO:  Add Mailchimp integration via Mailchimp API"</title>
<link>https://www.machform.com/forums/topic/how-to-add-mailchimp-integration-via-mailchimp-api#post-15057</link>
<pubDate>Fri, 15 Jun 2012 06:40:13 +0000</pubDate>
<dc:creator>tmparisi</dc:creator>
<guid isPermaLink="false">15057@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;So you want to force it and disregard the &#34;opt-in&#34; email...?  Just want to make sure I understand fully.  And, have you been successful with this code despite that issue?
&#60;/p&#62;</description>
</item>
<item>
<title>fpgrenier on "HOW TO:  Add Mailchimp integration via Mailchimp API"</title>
<link>https://www.machform.com/forums/topic/how-to-add-mailchimp-integration-via-mailchimp-api#post-15054</link>
<pubDate>Fri, 15 Jun 2012 00:44:09 +0000</pubDate>
<dc:creator>fpgrenier</dc:creator>
<guid isPermaLink="false">15054@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;Thanks a bunch for sharing this Tmparisi!&#60;/p&#62;
&#60;p&#62;I've been trying to force the subscription to a certain group but, unfortunately, I can't get it to work.  Anyone tried this already?
&#60;/p&#62;</description>
</item>
<item>
<title>tmparisi on "HOW TO:  Add Mailchimp integration via Mailchimp API"</title>
<link>https://www.machform.com/forums/topic/how-to-add-mailchimp-integration-via-mailchimp-api#post-14323</link>
<pubDate>Wed, 11 Apr 2012 08:17:06 +0000</pubDate>
<dc:creator>tmparisi</dc:creator>
<guid isPermaLink="false">14323@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;Just a note: This code currently only works with Single Page Forms.  The Machform team is currently helping me make proper adjustments so it works with multipage forms.
&#60;/p&#62;</description>
</item>
<item>
<title>williamansley on "HOW TO:  Add Mailchimp integration via Mailchimp API"</title>
<link>https://www.machform.com/forums/topic/how-to-add-mailchimp-integration-via-mailchimp-api#post-14304</link>
<pubDate>Mon, 09 Apr 2012 22:48:00 +0000</pubDate>
<dc:creator>williamansley</dc:creator>
<guid isPermaLink="false">14304@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;@tmparisi: Thanks a lot for sharing this information on the forum. We don't have any current plans to integrate Mailchimp with Machform, but it is very nice to have this information available, in case we decide to do so in the future.
&#60;/p&#62;</description>
</item>
<item>
<title>tmparisi on "HOW TO:  Add Mailchimp integration via Mailchimp API"</title>
<link>https://www.machform.com/forums/topic/how-to-add-mailchimp-integration-via-mailchimp-api#post-14281</link>
<pubDate>Sat, 07 Apr 2012 07:09:22 +0000</pubDate>
<dc:creator>tmparisi</dc:creator>
<guid isPermaLink="false">14281@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;So it was an issue with your form's personal element numbering?  Of course, this numbering will differ for each individual and from form to form.  In any case, I am glad you got it working!
&#60;/p&#62;</description>
</item>
<item>
<title>radixbv on "HOW TO:  Add Mailchimp integration via Mailchimp API"</title>
<link>https://www.machform.com/forums/topic/how-to-add-mailchimp-integration-via-mailchimp-api#post-14279</link>
<pubDate>Sat, 07 Apr 2012 03:44:30 +0000</pubDate>
<dc:creator>radixbv</dc:creator>
<guid isPermaLink="false">14279@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;Oke.&#60;/p&#62;
&#60;p&#62;Retest it again.&#60;br /&#62;
The problem was the field numbering.&#60;/p&#62;
&#60;p&#62;I deleted the name field and put in a new one with more field. I moved that to the top. It gave field number 1.&#60;br /&#62;
But the input didn't appear in $table_data['element_1_1']&#60;br /&#62;
For some strange reason the email field was also not the assigned number, but one higher.&#60;/p&#62;
&#60;p&#62;I made a new form and then it worked as described as above.&#60;/p&#62;
&#60;p&#62;Right setting as standard (644) are oke.&#60;/p&#62;
&#60;p&#62;To debug output you can include echo fields&#60;/p&#62;
&#60;p&#62;something like:&#60;/p&#62;
&#60;p&#62;if ($api-&#38;gt;errorCode){&#60;br /&#62;
	echo &#34;\tfname=&#34;.$table_data['element_1_1'].&#34;\n&#34;;&#60;br /&#62;
	echo &#34;\tfname=&#34;.$table_data['element_1_2'].&#34;\n&#34;;&#60;br /&#62;
        echo &#34;\temail=&#34;.$table_data['element_2'].&#34;\n&#34;;&#60;br /&#62;
} else {&#60;br /&#62;
    echo &#34;Subscribed \n&#34;;&#60;br /&#62;
}
&#60;/p&#62;</description>
</item>
<item>
<title>tmparisi on "HOW TO:  Add Mailchimp integration via Mailchimp API"</title>
<link>https://www.machform.com/forums/topic/how-to-add-mailchimp-integration-via-mailchimp-api#post-14277</link>
<pubDate>Sat, 07 Apr 2012 02:49:27 +0000</pubDate>
<dc:creator>tmparisi</dc:creator>
<guid isPermaLink="false">14277@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;I am not entirely sure what you are asking.  Also, what is the error you are receiving?
&#60;/p&#62;</description>
</item>
<item>
<title>radixbv on "HOW TO:  Add Mailchimp integration via Mailchimp API"</title>
<link>https://www.machform.com/forums/topic/how-to-add-mailchimp-integration-via-mailchimp-api#post-14276</link>
<pubDate>Sat, 07 Apr 2012 01:12:54 +0000</pubDate>
<dc:creator>radixbv</dc:creator>
<guid isPermaLink="false">14276@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;seems to work besides on on little nasty detail.&#60;br /&#62;
The mailchimp api log gives a result error.&#60;/p&#62;
&#60;p&#62;To test i made the array to only email adress.&#60;/p&#62;
&#60;p&#62;I'm i missing a mialchimp setting to allow this?&#60;/p&#62;
&#60;p&#62;PS: I changed settings on MCAPI.class.php to 755, as the first api call didn't came trough. If it works i wil test to see if this is  needed.
&#60;/p&#62;</description>
</item>
<item>
<title>tmparisi on "HOW TO:  Add Mailchimp integration via Mailchimp API"</title>
<link>https://www.machform.com/forums/topic/how-to-add-mailchimp-integration-via-mailchimp-api#post-14273</link>
<pubDate>Fri, 06 Apr 2012 22:43:16 +0000</pubDate>
<dc:creator>tmparisi</dc:creator>
<guid isPermaLink="false">14273@https://www.machform.com/forums/</guid>
<description>&#60;p&#62;There are other threads on this forum that show how to add mailchimp integration via HTTP, which is fine if you don't mind confirmation emails.  However, I have a dropdown on my form that asks the user if they want to be added to our mailing list, if they select &#34;yes&#34;, I don't want them to receive another email asking them to confirm... that is just annoying.  In order to bypass this 'double opt-in' functionality, you must make use of the mailchimp API.  Here is the solution I created that seems to work flawlessly:&#60;/p&#62;
&#60;p&#62;1.  Go get yourself a copy of the API (MCAPI.class.php) from here: &#60;a href=&#34;http://apidocs.mailchimp.com/api/downloads/#php&#34; rel=&#34;nofollow&#34;&#62;http://apidocs.mailchimp.com/api/downloads/#php&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;2.  Place the MCAPI.class.php file in your machform/lib/ folder.&#60;/p&#62;
&#60;p&#62;3.  Edit machform/includes/post-functions.php&#60;/p&#62;
&#60;p&#62;Do a search for (should be around line 2326):&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;if(empty($error_elements) &#38;#38;&#38;#38; empty($process_result[&#38;#39;custom_error&#38;#39;])){
$process_result[&#38;#39;status&#38;#39;] = true;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;and right below this code, add the following:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;if($form_id == 8 &#38;#38;&#38;#38; $table_data[&#38;#39;element_8&#38;#39;] == 1){
	require_once &#38;#39;lib/MCAPI.class.php&#38;#39;;

	$apikey = &#38;#39;xxxxxxxxxxxxxxxxxxxxxxx&#38;#39;;
	$listId = &#38;#39;xxxxxxx&#38;#39;;
	$my_email = $table_data[&#38;#39;element_2&#38;#39;];
	$double_optin = false;
	$send_welcome = false;

	$api = new MCAPI($apikey);

	$merge_vars = Array(
		&#38;#39;EMAIL&#38;#39; =&#38;gt; $table_data[&#38;#39;element_2&#38;#39;],
		&#38;#39;FNAME&#38;#39; =&#38;gt; $table_data[&#38;#39;element_1_1&#38;#39;],
		&#38;#39;LNAME&#38;#39; =&#38;gt; $table_data[&#38;#39;element_1_2&#38;#39;]
	);

	$retval = $api-&#38;gt;listSubscribe( $listId, $my_email, $merge_vars, $double_optin, $send_welcome);
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;4.  Edit the code you just added to match your mailchimp account.  That is, enter your API Key, and List ID... both of which can be found at the mailchimp site (you may need to sign up for an API key still).&#60;/p&#62;
&#60;p&#62;5.  Edit any restriction parameters.  For example, my code only activates when we are dealing with Form #8 and if my dropdown (element_8) is equal to Yes, which is the 1st item in the dropdown, thus it is = 1.&#60;/p&#62;
&#60;p&#62;6.  Edit any other element IDs that you want.&#60;/p&#62;
&#60;p&#62;More information on the API and what parameters can be set are available here:  &#60;a href=&#34;http://apidocs.mailchimp.com/api/1.3/listsubscribe.func.php&#34; rel=&#34;nofollow&#34;&#62;http://apidocs.mailchimp.com/api/1.3/listsubscribe.func.php&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;There may be bugs I am not aware of, but it seems to work quite well.  If anyone sees any problems with the above code, please post it here!  Hope this helps someone!
&#60;/p&#62;</description>
</item>

</channel>
</rss>
