Title: Integrations??
Last modified: December 15, 2018

---

# Integrations??

 *  Resolved [silviossilvestrou](https://wordpress.org/support/users/silviossilvestrou/)
 * (@silviossilvestrou)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/integrations-3/)
 * Hello!
    There is a any way that it could connect (Integration) HappyForms with
   Mailchimp? Thanks!
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fintegrations-3%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 9 replies - 1 through 9 (of 9 total)

 *  [thethemefoundry](https://wordpress.org/support/users/thethemefoundry/)
 * (@thethemefoundry)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/integrations-3/#post-10992775)
 * Hey there, [@silviossilvestrou](https://wordpress.org/support/users/silviossilvestrou/)!
 * While it’s possible to integrate with MailChimp using HappyForms PHP hooks, there’s
   no visual way to do it yet, we’re sorry! That’s already on our roadmap though,
   so stay tuned!
 * If you’re in a hurry instead, and would like to know more about manually integrating
   with MailChimp, just let us know and we’ll share some useful pointers.
 * Let us know what you think!
 *  Thread Starter [silviossilvestrou](https://wordpress.org/support/users/silviossilvestrou/)
 * (@silviossilvestrou)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/integrations-3/#post-10992786)
 * Hi,
    yes, please! if are not difficult, I would like to know! Thanks
 *  [thethemefoundry](https://wordpress.org/support/users/thethemefoundry/)
 * (@thethemefoundry)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/integrations-3/#post-11001334)
 * Got it, [@silviossilvestrou](https://wordpress.org/support/users/silviossilvestrou/)!
 * Before sharing actual pointers, could you share some details about what kind 
   of integration you’d like to pull off?
 * Let us know!
 *  Thread Starter [silviossilvestrou](https://wordpress.org/support/users/silviossilvestrou/)
 * (@silviossilvestrou)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/integrations-3/#post-11003202)
 * Hi [@thethemefoundry](https://wordpress.org/support/users/thethemefoundry/) !
 * BasicallyI, would like if I could connect the HappyForms with Mailchimp-(Lists)!
 * Thanks!
 *  [thethemefoundry](https://wordpress.org/support/users/thethemefoundry/)
 * (@thethemefoundry)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/integrations-3/#post-11008017)
 * Thanks, [@silviossilvestrou](https://wordpress.org/support/users/silviossilvestrou/)!
 * Just to be clear, does that mean you’d like to subscribe an email address submitted
   through the form to your MailChimp list automatically?
 * Let us know if that’s what you’re after.
 *  Thread Starter [silviossilvestrou](https://wordpress.org/support/users/silviossilvestrou/)
 * (@silviossilvestrou)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/integrations-3/#post-11008795)
 * Hello [@thethemefoundry](https://wordpress.org/support/users/thethemefoundry/),
 * Yes , that corect!!
 * i am using Elementor forms (newsletter), and they are easyly conect with my Mailchimp
   lists!
 * Thanks
 *  [thethemefoundry](https://wordpress.org/support/users/thethemefoundry/)
 * (@thethemefoundry)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/integrations-3/#post-11011133)
 * Got it, [@silviossilvestrou](https://wordpress.org/support/users/silviossilvestrou/)!
 * Consider a much easier integration method is already planned for HappyForms. 
   In the meanwhile, here’s how you can hook up a connection yourself using PHP.
 * Before starting:
 * 1. Grab your [MailChimp API key](https://mailchimp.com/help/about-api-keys).
   
   2. Grab your datacenter ID: to do that, look at your URL in your MailChimp dashboard.
   My URL looks like: `https://us18.admin.mailchimp.com` and my datacenter ID is`
   us18`. 3. Grab your [list ID](https://mailchimp.com/help/find-your-list-id/).
   4. In your HappyForms edit form screen, grab the labels (the value of your Title
   part field) of your first name, last name and email parts. We’ll use those labels
   to identify the parts whose values will actually end up in your MailChimp subscriber
   data.
 * Adding the integration:
 * 1. Open your theme `functions.php` file, and pop in this snippet replacing with
   your actual IDs, key values and labels:
 *     ```
       $datacenter = '[your datacenter ID]';
       $api_key = '[your api key]';
       $list_id = '[your list ID]';
       $first_name_label = '[your first name part label]';
       $last_name_label = '[your last name part label]';
       $email_label = '[your email part label]';
       ```
   
 * 2. Pop in this snippet, which handles submission to MailChimp:
 *     ```
       function child_theme_mailchimp_subscribe( $first_name, $last_name, $email ) {
       	global $datacenter, $api_key, $list_id;
   
       	$api_url = "https://{$datacenter}.api.mailchimp.com/3.0/lists/{$list_id}/members/";
       	$data = array(
       		'email_address' => $email,
       		'status' => 'subscribed',
       		'merge_fields' => array(
       			'FNAME' => $first_name,
       			'LNAME' => $last_name,
       		),
       	);
   
       	$args = array(
       		'headers' => array(
       			'Content-Type' => 'application/json; charset=utf-8',
       			'Authorization' => 'Basic ' . base64_encode( "any:{$api_key}" ),
       		),
       		'body' => json_encode( $data ),
       	);
   
       	wp_remote_post( $api_url, $args );
       }
       ```
   
 * 3. Finally pop in this snippet, which hooks HappyForms to the submission function:
 *     ```
       function child_theme_submission_success( $submission, $form, $message ) {
       	global $first_name_label, $last_name_label, $email_label;
   
       	$parts = wp_list_pluck( $form['parts'], 'label', 'id' );
       	$first_name = '';
       	$last_name = '';
       	$email = '';
   
       	foreach( $parts as $id => $label ) {
       		switch( $label ) {
       			case $first_name_label:
       				$first_name = $submission[$id];
       				break;
       			case $last_name_label:
       				$last_name = $submission[$id];
       				break;
       			case $email_label:
       				$email = $submission[$id];
       				break;
       		}
       	}
   
       	child_theme_mailchimp_subscribe( $first_name, $last_name, $email );
       }
   
       add_action( 'happyforms_submission_success', 'child_theme_submission_success', 20, 3 );
       ```
   
 * That’s a bit verbose, but hopefully not too complex! Let us know how that goes.
   🙂
    -  This reply was modified 7 years, 5 months ago by [thethemefoundry](https://wordpress.org/support/users/thethemefoundry/).
    -  This reply was modified 7 years, 5 months ago by [thethemefoundry](https://wordpress.org/support/users/thethemefoundry/).
    -  This reply was modified 7 years, 5 months ago by [thethemefoundry](https://wordpress.org/support/users/thethemefoundry/).
 *  Thread Starter [silviossilvestrou](https://wordpress.org/support/users/silviossilvestrou/)
 * (@silviossilvestrou)
 * [7 years, 5 months ago](https://wordpress.org/support/topic/integrations-3/#post-11012861)
 * Hi [@thethemefoundry](https://wordpress.org/support/users/thethemefoundry/)
 * Thanks for the direct response!
    i will give the try, otherwise I will wait for
   you are new update!
 * Thank you 👍
 *  [newtowordpressmatters](https://wordpress.org/support/users/newtowordpressmatters/)
 * (@newtowordpressmatters)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/integrations-3/#post-11305878)
 * Hi [@thethemefoundry](https://wordpress.org/support/users/thethemefoundry/)
    
   I’m following along the post and I’m not sure of this feature has been implemented
   or not. I used the snippets you suggested and I get 500 error code (Internal 
   server error)
 * I trust the code you wrote is good. Any idea what might be the reason and hpw
   to fix it?
 * Thank you

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Integrations??’ is closed to new replies.

 * ![](https://ps.w.org/happyforms/assets/icon-256x256.png?rev=2778164)
 * [Happyforms - Form Builder for WordPress: Drag & Drop Contact Forms, Surveys, Payments & Multipurpose Forms](https://wordpress.org/plugins/happyforms/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/happyforms/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/happyforms/)
 * [Active Topics](https://wordpress.org/support/plugin/happyforms/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/happyforms/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/happyforms/reviews/)

 * 9 replies
 * 3 participants
 * Last reply from: [newtowordpressmatters](https://wordpress.org/support/users/newtowordpressmatters/)
 * Last activity: [7 years, 2 months ago](https://wordpress.org/support/topic/integrations-3/#post-11305878)
 * Status: resolved