This plugin is intended to assist developers with integrating their WordPress installation with the official Infusionsoft SDK using OAuth 2.0 authentication. The plugin includes the latest version of the officially supported Infusionsoft PHP SDK.
As of version 2.0 the REST class is loaded by default. You can still use the XML-RPC class by passing 'xml'
as an argument to the Infusionsoft method.
- The Infusionsoft API requires an SSL connection
- Download the latest tagged archive (choose the "zip" option).
- Go to the Plugins -> Add New screen and click the Upload tab.
- Upload the zipped archive directly.
- Go to the Plugins screen and click Activate.
- Download the latest tagged archive (choose the "zip" option).
- Unzip the archive.
- Copy the folder to your
/wp-content/plugins/
directory. - Go to the Plugins screen and click Activate.
Check out the Codex for more information about installing plugins manually.
- You must have an account with Infusionsoft and be able to sign into that account.
- Register for a free Infusionsoft developers account.
- Obtain the Client ID and Client Secret keys from your Infusionsoft developer's account, which are available at https://keys.developer.infusionsoft.com/apps/mykeys.
- Paste the keys into their respective input boxes on the plugin settings page.
- After saving the keys you must click "Click here to authorize" to obtain an access token from Infusionsoft. If successful, you will be redirected back to the WordPress Dashboard and will see a message that says "Your Infusionsoft Token has been successfully added!".
- Once you have received an Infusionsoft token you can begin making API calls.
Your API calls will be very similar to what is presented in the Infusionsoft API documentation. The main difference is that a single line of code $infusionsoft = fj_infusionsoft_init();
replaces the following code found in the Infusionsoft documentation examples:
$infusionsoft = new \Infusionsoft\Infusionsoft(array(
'clientId' => CLIENT_ID,
'clientSecret' => CLIENT_SECRET,
'redirectUri' => REDIRECT_URL,
));
$infusionsoft->refreshAccessToken();
Example usage:
add_action( 'wp_login', 'fj_infusionsoft_api_sample_usage', 10, 2 );
/**
* Adds a user as an Infusionsoft contact after they log in to WordPress.
*
* @param string $user_login WP user login
* @param object $user WP user object
*/
function fj_infusionsoft_api_sample_usage( $user_login, $user ) {
// Instantiates the Infusionsoft object and ensures that we have a valid access token.
$infusionsoft = fj_infusionsoft_init();
// Gather relevant user data
$user_email = $user->data->user_email;
$user_first_name = get_userdata( $user->ID )->first_name;
$user_last_name = get_userdata( $user->ID )->last_name;
$contact = array(
'Email' => $user_email,
'FirstName' => $user_first_name,
'LastName' => $user_last_name
);
// Adds the WP user as an Infusionsoft contact if they are not already in Infusionsoft
$contact_id = $infusionsoft->contacts('xml')->addWithDupCheck( $contact, 'Email' );
}
Built by Tim Jensen