Search code examples
phpmysqlcodeigniterapiinfusionsoft

Connecting MySQL DB to InfusionSoft Contacts


We have a website (created using CodeIgnitor , which accepts users to signup using their Email or via LinkedIn. The data is stored in a MySQL backend. We also have incorporated InfusionSoft to work as a CRM and tracking of the users who signup.

My basic requirement thus is to create a trigger in PHP code, which allows a new contact to be created in InfusionSoft, after the user has registered.

(I want the contact information to be created in InfusionSoft, after the user has successfully signed up (registered) on the site and authenticated his Email ID. Else it will create too many false positives.)

Does anyone know of a API which allows me to automatically connect to InfusionSoft and transfer a selected set of fields into InfusionSoft from the MySQL DB Table?

I have looked up the InfusionSoft KB, but unable to come across any specific example which allows me to do this for selected fields:

https://novaksolutions.com/infusionsoft-api-gotchas/

https://developer.infusionsoft.com/code_samples

https://github.com/infusionsoft/API-Sample-Code/blob/master/PHP/ContactService-Sample.php

Solution

  • You should use the official InfusionSoft PHP-iSDK. It is the official wrapper for their API.

    You should then read the developer documentation to get familiar with the API. Specifically, the Contact Service.

    "Connecting" your MySQL database to your InfusionSoft database isn't how you should be thinking about it. Rather, you should be "firing" or running a function when an event happens.

    When a user confirms their email in your application, simply fire a ContactService.addWithDupCheck function to add the user to the InfusionSoft database. This will vary, depending on your application; but should look something like the following:

    <?php
    
    $app->addWithDupCheck(
        array(
            'FirstName' => 'test', // Pulled from your MySQL Database
            'LastName' => 'test', // Pulled from your MySQL Database
            'Email' => '[email protected]' // Pulled from your MySQL Database, or a $_GET variable
        ), 
        'EmailAndName'
    );
    

    EDIT: The iSDK is being deprecated in about a month. You should use the new, official infusionsoft-php wrapper instead. It works in a similar fashion.