From Pro Sites to Active Campaign

Hi,

I would like to get people who register for a site through Pro sites into Active Campaign automatically so I can follow up with them.

What is the best way to do this?

Thanks in advance!

Justin

  • Bojan Radonic

    Hey there @Justin,

    I've checked the service that you're using and the there is no automatic way of doing this out of a box.

    The only way to do this would be to actually export your users to CSV file and import them to active campaign. Either way you'll have to do this manually so it is the same as adding those user manually to active campaign.

    Also, if you need to customize this then you can post a job in our job board where you can hire a developer to assist further:

    https://premium.wpmudev.org/wpmu-jobs/

    Best regards,
    Bojan

  • Hannah

    Here's a way to push new WordPress signup data to ActiveCampaign: http://wpandbeyond.com/integrate-wordpress-user-signups-active-campaign-email-marketing/

    You use this code -- all you need to do is switch out the API key, API URL, and ActiveCampaign list # (then drop into your theme's functions.php):

    <?php
    
    function add_user_to_active( $user_id ){
    
      $user = new WP_User($user_id);
      $user_first = stripslashes($user->first_name);
      $user_last  = stripslashes($user->last_name);
      $user_email = stripslashes($user->user_email);
    
      // Enter your unique URL that is generated from Active Campaign
      // http://www.activecampaign.com/help/using-the-api/
      $url = 'http://your-list-name.api-us1.com';
    
      $params = array(
    
          // the API Key can be found on the "Your Settings" page under the "API" tab.
          // replace this with your API Key
          'api_key'      => '123456789',
    
          // this is the action that adds a contact
          'api_action'   => 'contact_add',
    
          // define the type of output you wish to get back
          // possible values:
          // - 'xml'  :      you have to write your own XML parser
          // - 'json' :      data is returned in JSON format and can be decoded with
          //                 json_decode() function (included in PHP since 5.2.0)
          // - 'serialize' : data is returned in a serialized format and can be decoded with
          //                 a native unserialize() function
          'api_output'   => 'serialize',
      );
    
      // here we define the data we are posting in order to perform an update
      $post = array(
          'email'                    => $user_email,
          'first_name'               => $user_first,
          'last_name'                => $user_last,
          //'phone'                    => '+1 312 201 0300',
          //'tags'                     => 'api',
          //'ip4'                    => '127.0.0.1',
    
          // any custom fields
          //'field[345,0]'           => 'field value', // where 345 is the field ID
          //'field[%PERS_1%,0]'      => 'field value', // using the personalization tag instead (make sure to encode the key)
    
          // assign to lists:
          'p[123]'                   => 4, // example list ID
          'status[123]'              => 1, // 1: active, 2: unsubscribed
          //'form'          => 1001, // Subscription Form ID, to inherit those redirection settings
          //'noresponders[123]'      => 1, // uncomment to set "do not send any future responders"
          //'sdate[123]'             => '2009-12-07 06:00:00', // Subscribe date for particular list - leave out to use current date/time
          // use the folowing only if status=1
          'instantresponders[123]' => 1, // set to 0 to if you don't want to sent instant autoresponders
          //'lastmessage[123]'       => 1, // uncomment to set "send the last broadcast campaign"
    
          //'p[]'                    => 345, // some additional lists?
          //'status[345]'            => 1, // some additional lists?
      );
    
      // This section takes the input fields and converts them to the proper format
      $query = "";
      foreach( $params as $key => $value ) $query .= $key . '=' . urlencode($value) . '&';
      $query = rtrim($query, '& ');
    
      // This section takes the input data and converts it to the proper format
      $data = "";
      foreach( $post as $key => $value ) $data .= $key . '=' . urlencode($value) . '&';
      $data = rtrim($data, '& ');
    
      // clean up the url
      $url = rtrim($url, '/ ');
    
      // This sample code uses the CURL library for php to establish a connection,
      // submit your request, and show (print out) the response.
      if ( !function_exists('curl_init') ) die('CURL not supported. (introduced in PHP 4.0.2)');
    
      // If JSON is used, check if json_decode is present (PHP 5.2.0+)
      if ( $params['api_output'] == 'json' && !function_exists('json_decode') ) {
          die('JSON not supported. (introduced in PHP 5.2.0)');
      }
    
      // define a final API request - GET
      $api = $url . '/admin/api.php?' . $query;
    
      $request = curl_init($api); // initiate curl object
      curl_setopt($request, CURLOPT_HEADER, 0); // set to 0 to eliminate header info from response
      curl_setopt($request, CURLOPT_RETURNTRANSFER, 1); // Returns response data instead of TRUE(1)
      curl_setopt($request, CURLOPT_POSTFIELDS, $data); // use HTTP POST to send form data
      //curl_setopt($request, CURLOPT_SSL_VERIFYPEER, FALSE); // uncomment if you get no gateway response and are using HTTPS
      curl_setopt($request, CURLOPT_FOLLOWLOCATION, true);
    
      $response = (string)curl_exec($request); // execute curl post and store results in $response
    
      // additional options may be required depending upon your server configuration
      // you can find documentation on curl options at http://www.php.net/curl_setopt
      curl_close($request); // close curl object
    
      if ( !$response ) {
          die('Nothing was returned. Do you have a connection to Email Marketing server?');
      }
    
    }
    
    // This function is triggered whenever a new user
    // signs up for an account on your WordPress website
    add_action('user_register', 'add_user_to_active', 10, 1);

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.