Hi, Im planning to integrate infusionsoft with drupal,

Anyone can give me an indea how this to be done.

Your suggestion would be much much appreciated.

Thanks

Comments

j_ten_man’s picture

What are you planning on doing? We have done a little bit of integration but the stuff is not really ready to be contributed back. I can try to get some code samples up for you tomorrow if you would like.

shehateme’s picture

Hi, thanks for the reply, I want to have a subscription page using infusionsoft and post it to my drupal site. After the subscription application is successfully complete, I want to add the user on my drupal site. Have any idea on how to work this up??

Thanks

j_ten_man’s picture

I didn't do anything with subscriptions in infusionsoft. You can look at using the infusionsoft library (PHP SDK) which I did and writing something up. I am not sure how the subscription api stuff works with infusionsoft but I know it is there.

shehateme’s picture

Good Day

Can i see a sample codes that you work in infusionsoft and drupal for my reference? If so please email me at shehateme@gmail.com

Many thanks

drubage’s picture

I thought they had something out of the box but I am not so sure now. I need it to be a recurring subscription system where it creates an account when they buy a product and promotes the user to "Premium Member" status. If the billing expires or they cancel it should send them to the "authenticated user" status. Anyone had success with this?

shehateme’s picture

You can do it, you can create a php snippet on a node and run an Http post on infusionsoft that points to that node, I hope that helps

j_ten_man’s picture

Sorry this code has taken so long. Here are some of the basics of what I've done:

/**
 * Primay callback function to send an API request to infusionsoft.
 * $request_type - the API function to call 
 */
function infusionsoft_send_request($request_type = 'loadCon') {
  $values = func_get_args();
  //Remove the $request_type variable
  array_shift($values);
  
  $vals = array();
  //Put the values in the correct form. Each entry in $vals looks like $values[0], $values[1], etc
  foreach ($values as $key => $value) $vals[] = '$values['. $key .']';
  //Create the function call.
  $function_call = 'return $myApp->'. $request_type .'('. implode(', ', $vals) .');';
  
  //Don't alart users of issues with infusionsoft
  ob_start();
  $myApp = infusionsoft_load_myApp();
  if ($return = $myApp->cfgCon("mykey")) {
    $return = eval($function_call);
  }
  
  if (!$return && ($error = ob_get_contents())) {
    watchdog('infusionsoft', 'Unable to send request of type !type(!error).', array('!type' => $request_type, '!error' => $error));
  }
  ob_end_clean();
  
  return $return;
}

/**
 * Function to load the sdk so as to not create a million instances.
 */
function infusionsoft_load_myApp($new = 0) {
  static $myApp = NULL;
  if ($new || !$myApp) {
    require_once('library/isdk.php');
    $myApp = new iSDK;
  }
  return $myApp;
}

So now to make any request, look at the sdk documentation to see what variables are needed and make the call. For example:

/**
 * Send an e-mail to the given contact(s)
 */
function infusionsoft_send_email($contacts, $subject, $text_body = '', $html_body = '', $type = 'text', $from = '~Owner.Email~', $to = '~Contact.Email~', $cc = '', $bcc = '') {
  if (!is_array($contacts)) $contacts = array($contacts); //The contact ids for who the message is to go
  foreach($contacts as $key => $contact) $contacts[$key] = intval($contact);
  
  return infusionsoft_send_request('sendEmail', $contacts, $from, $to, $cc, $bcc, $type, $subject, $html_body, $text_body);
}
shehateme’s picture

Thanks you very much for the help :)

westwesterson’s picture

-- thanks this problem is now solved! --

westwesterson’s picture

You can check out the Infusionsoft API module