ContactService API

ContactService API

ContactService is used to manage contacts. You can add, update and find contacts in addition to managing follow up sequences, tags and action sets.


ContactService.add

Creates a new contact record from the data passed in the associative array

Required Parameters

Parameter Name Type Definition
Key string Your Infusionsoft API key
data array an associative array of the data for this new contact record. The array key is the field name to store the value within

Sample Request

<?xml version='1.0' encoding='UTF-8'?>
<methodCall>
  <methodName>ContactService.add</methodName>
  <params>
    <param>
      <value><string>privateKey</string></value>
    </param>
    <param>
      <value><struct>
        <member><name>FirstName</name>
          <value><string>John</string></value>
        </member>
        <member><name>LastName</name>
          <value><string>Doe</string></value>
        </member>
        <member><name>Email</name>
          <value><string>there_he_go@itsjohndoe.com</string></value>
        </member>
      </struct></value>
    </param>
  </params>
  </methodCall>

Sample Response

<?xml version='1.0' encoding='UTF-8'?>
<methodResponse>
  <params>
    <param>
      <value><i4>contactIDNumber</i4></value>
    </param>
  </params>
</methodResponse>

PHP iSDK Sample

$conDat = array('FirstName' => 'John',
                'LastName'  => 'Doe',
                'Email'     => 'JDoe@email.com');

$conID = $app->addCon($conDat);

ContactService.merge

Merge two contacts together

Required Parameters

Parameter Name Type Definition
privateKey string Your Infusionsoft API key
contactId int the contact Id number you want to merge
duplicateContactId int the Id of the duplicate contact you would like to merge

Sample Request

<?xml version="1.0"?>
<methodCall>
	<methodName>ContactService.merge</methodName>
	<params>
		<param>
			<value><string>privateKey</string></value>
		</param>
		<param>
			<value><int>contactId</int></value>
		</param>
		<param>
			<value><int>duplicateContactId</int></value>
		</param>
	</params>
</methodCall>

Sample Response

<?xml version="1.0" encoding="UTF-8"?>
<methodResponse>
    <params>
        <param>
            <value>
                <boolean>1</boolean>
            </value>
        </param>
    </params>
</methodResponse>

PHP iSDK Sample

$carray = array(
php_xmlrpc_encode($app->key),
php_xmlrpc_encode(16),
php_xmlrpc_encode(24));

$app->methodCaller("ContactService.merge",$carray);

ContactService.addToCampaign

Adds a contact to a follow-up sequence (campaigns were the original name of follow-up sequences)

Required Parameters

Parameter Name Type Definition
Key string Your Infusionsoft API key
contactId int the contact Id number you would like to start the follow-up sequence for
campaignId int the Id number of the follow-up sequence you would like to start

Sample Request

<?xml version='1.0' encoding='UTF-8'?>
<methodCall>
  <methodName>ContactService.addToCampaign</methodName>
  <params>
    <param>
      <value><string>privateKey</string></value>
    </param>
    <param>
      <value><int>contactIDNumber</int></value>
    </param>
    <param>
      <value><int>campaignIDNumber</int></value>
    </param>
  </params>
</methodCall>

Sample Response

<?xml version="1.0" encoding="UTF-8"?>
<methodResponse>
    <params>
        <param>
            <value>
                <boolean>0</boolean>
            </value>
        </param>
    </params>
</methodResponse>

PHP iSDK Sample

$contactId = 123;
$campId = 456;
$result = $app->campAssign($contactId, $campId)

ContactService.addToGroup

Adds a tag to a contact record

Required Parameters

Parameter Name Type Definition
Key string Your Infusionsoft API key
contactId int the contact Id number you would like to add to a group
groupId int the Id number of the group you wish to add the contact to

Sample Request

<?xml version='1.0' encoding='UTF-8'?>
<methodCall>
  <methodName>ContactService.addToGroup</methodName>
  <params>
    <param>
      <value><string>privateKey</string></value>
    </param>
    <param>
      <value><int>contactIDNumber</int></value>
    </param>
    <param>
      <value><int>groupIDNumber</int></value>
    </param>
  </params>
</methodCall>

Sample Response

<?xml version='1.0' encoding='UTF-8'?>
<methodResponse>
  <params>
    <param>
      <value><boolean>0</boolean></value>
    </param>
  </params>
</methodResponse>

PHP iSDK Sample

$contactId = 123;
$groupId = 456;
$result = $app->grpAssign($contactId, $groupId);

ContactService.getNextCampaignStep

Returns the Id number of the next follow-up sequence step for the given contact

Required Parameters

Parameter Name Type Definition
Key string Your Infusionsoft API key
contactId int the Id number of the contact record you would like to get the next sequence step for
followUpSequenceId int the follow-up sequence Id number you would like to get the next step for the given contact

Sample Request

<?xml version='1.0' encoding='UTF-8'?>
<methodCall>
  <methodName>ContactService.getNextCampaignStep</methodName>
  <params>
    <param>
      <value><string>privateKey</string></value>
    </param>
    <param>
      <value><int>contactIDNumber</int></value>
    </param>
    <param>
      <value><int>followUpSequenceId</int></value>
    </param>
  </params>
</methodCall>

Sampe Response

<?xml version='1.0' encoding='UTF-8'?>
<methodResponse>
<params>
    <param>
      <value>
        <i4>15</i4>
      </value>
    </param>
  </params>
</methodResponse>

PHP iSDK Sample

$cStep = $app->getNextCampaignStep($contactIdNumber,2);

ContactService.findByEmail

Finds all contacts with the given email address. This searches the Email, Email 2, and Email 3 fields

Required Parameters

Parameter Name Type Definition
Key string Your Infusionsoft API key
email string The email address to search contacts by
selectedFields array The contact fields you would like returned

Sample Request

<?xml version='1.0' encoding='UTF-8'?>
<methodCall>
  <methodName>ContactService.findByEmail</methodName>
  <params>
    <param>
      <value><string>privateKey</string></value>
    </param>
    <param>
      <value><string>there_he_go@itsjohndoe.com</string></value>
    </param>
    <param>
      <value><array>
        <data>
          <value><string>Id</string></value>
          <value><string>FirstName</string></value>
          <value><string>LastName</string></value>
        </data>
      </array></value>
    </param>
  </params>
</methodCall>

Sampe Response

<?xml version='1.0' encoding='UTF-8'?>
<methodResponse>
  <params>
    <param>
      <value>
        <array>
          <data>
            <value>
              <struct>
                <member>
                  <name>FirstName</name>
                  <value>John</value>
                </member>
                <member>
                  <name>Id</name>
                  <value><i4>16</i4></value>
                </member>
                <member>
                  <name>LastName</name>
                  <value>Doe</value>
                </member>
              </struct>
            </value>
            <value>
              <struct>
                <member>
                  <name>FirstName</name>
                  <value>Ron</value>
                </member>
                <member>
                  <name>Id</name>
                  <value><i4>18</i4></value>
                </member>
                <member>
                  <name>LastName</name>
                  <value>Doe</value>
                </member>
              </struct>
            </value>
          </data>
        </array>
      </value>
    </param>
  </params>
</methodResponse>

PHP iSDK Sample

$email = 'test@example.com';
$returnFields = array('Id', 'FirstName', 'LastName');
$data = $app->findByEmail($email, $returnFields);

ContactService.load

Load data from a specific contact record

Required Parameters

Parameter Name Type Definition
Key string Your Infusionsoft API key
contactId int The Id number of the contact you would like to load data from
selectedFields array An array of strings where each string is the database field name of the field you would like sent back

Sample Request

<?xml version='1.0' encoding='UTF-8'?>
<methodCall>
<methodName>ContactService.load</methodName>
  <params>
    <param>
      <value><string>privateKey</string></value>
    </param>
    <param>
      <value><int>contactIDNumber</int></value>
    </param>
    <param>
      <value><array>
        <data>
          <value><string>Id</string></value>
          <value><string>FirstName</string></value>
          <value><string>LastName</string></value>
        </data>
      </array></value>
    </param>
  </params>
</methodCall>

Sampe Response

<?xml version='1.0' encoding='UTF-8'?>
<methodResponse>
  <params>
    <param>
      <value>
        <struct>
          <member>
            <name>FirstName</name>
            <value>Ron</value>
          </member>
          <member>
            <name>Id</name>
            <value><i4>18</i4></value>
          </member>
          <member>
            <name>LastName</name>
            <value>Doe</value>
          </member>
        </struct>
      </value>
    </param>
  </params>
</methodResponse>

PHP iSDK Sample

$returnFields = array('Email', 'FirstName', 'LastName', '_myCustomField');
$conDat = $app->loadCon(123, $returnFields);

ContactService.pauseCampaign

Pauses a follow-up sequence for the given contact record

Required Parameters

Parameter Name Type Definition
Key string Your Infusionsoft API key
contactId int The Id number of the contact record you are pausing the sequence on
sequenceId int The follow-up sequence Id number

Sample Request

<?xml version='1.0' encoding='UTF-8'?>
<methodCall>
<methodName>ContactService.pauseCampaign</methodName>
  <params>
    <param>
      <value><string>privateKey</string></value>
    </param>
    <param>
      <value><int>22</int></value>
    </param>
    <param>
      <value><int>2</int></value>
    </param>
  </params>
</methodCall>

Sample Response

<?xml version='1.0' encoding='UTF-8'?>
<methodResponse>
  <params>
    <param>
      <value>
        <boolean>
          1
        </boolean>
      </value>
    </param>
  </params>
</methodResponse>

PHP iSDK Sample

$contactId = 123;
$seqId = 456;
$result = $app->campPause($contactId, $seqId);

ContactService.removeFromCampaign

Removes a follow-up sequence from a contact record

Required Parameters

Parameter Name Type Definition
Key string Your Infusionsoft API key
contactId int The Id number of the contact you want to remove the sequence from
followUpSequenceId int The Id number of the sequence you would like to remove the contact from

Sample Request

<?xml version='1.0' encoding='UTF-8'?>
<methodCall>
<methodName>ContactService.removeFromCampaign</methodName>
  <params>
    <param>
      <value><string>privateKey</string></value>
    </param>
    <param>
      <value><int>contactIDNumber</int></value>
    </param>
    <param>
      <value><int>campaignIDNumber</int></value>
    </param>
  </params>
</methodCall>

Sampe Response

<?xml version='1.0' encoding='UTF-8'?>
<methodResponse>
  <params>
    <param>
      <value>
        <boolean>
          1
        </boolean>
      </value>
    </param>
  </params>
</methodResponse>

PHP iSDK Sample

$contactId = 123;
$fusId = 456;
$result = $app->campRemove($contactId, $fusId);

ContactService.removeFromGroup

Removes a tag from a contact (groups were the original name of tags)

Required Parameters

Parameter Name Type Definition
Key string Your Infusionsoft API key
contactId int The Id number of the contact you would like to remove the tag from
TagId int The tag Id number. This is found on the Setup->Tags menu

Sample Request

<?xml version='1.0' encoding='UTF-8'?>
<methodCall>
<methodName>ContactService.removeFromGroup</methodName>
  <params>
    <param>
      <value><string>privateKey</string></value>
    </param>
    <param>
      <value><int>contactIDNumber</int></value>
    </param>
    <param>
      <value><int>groupIDNumber</int></value>
    </param>
  </params>
</methodCall>

Sample Response

<?xml version='1.0' encoding='UTF-8'?>
<methodResponse>
  <params>
    <param>
      <value><boolean>0</boolean></value>
    </param>
  </params>
</methodResponse>

PHP iSDK Sample

$contactId = 123;
$groupId = 456;
$result = $app->grpRemove($contactId, $groupId);

ContactService.resumeCampaignForContact

Resumes a follow-up sequence that has been stopped/paused for a given contact

Required Parameters

Parameter Name Type Definition
privateKey string Your Infusionsoft API key
contactId int The Id number of the contact you would like to remove the tag from
seqId int The follow-up sequence Id number

Sample Request

<?xml version='1.0' encoding='UTF-8'?>

Sample Response

<?xml version='1.0' encoding='UTF-8'?>

PHP iSDK Sample

$contactId = 123;
$groupId = 456;
$result = $app->grpRemove($contactId, $groupId);

ContactService.rescheduleCampaignStep

Immediately performs the given follow-up sequence stepId for the given contacts

Required Parameters

Parameter Name Type Definition
privateKey string Your Infusionsoft API key
contactIds array An array of contact Id numbers you would like to reschedule the step for
sequenceStepId int The Id number of the particular sequence step you would like to reschedule

Sample Request

<?xml version="1.0"?>
<methodCall>
  <methodName>ContactService.rescheduleCampaignStep</methodName>
    <params>
      <param>
        <value><string>privateKey</string></value>
      </param>
    <param>
    <value><array>
      <data>
        <value><int>22</int></value>
        <value><int>12</int></value>
        <value><int>16</int></value>
      </data>
    </array></value>
    </param>
    <param>
      <value><int>2</int></value>
    </param>
  </params>
</methodCall>

Sample Response

<?xml version='1.0' encoding='UTF-8'?>
<methodResponse>
  <params>
    <param>
      <value>
        <i4>
          3
        </i4>
      </value>
    </param>
  </params>
</methodResponse>

PHP iSDK Sample

$conIds = array(123,456,789);
$numCons = $app->rescheduleCampaignStep($conIds, 23);

ContactService.removeFromGroup

Removes a tag from a contact (groups were the original name of tags)

Required Parameters

Parameter Name Type Definition
privateKey string Your Infusionsoft API key
contactId int The Id number of the contact you would like to remove the tag from
tagId int The tag Id number. This is found on the Setup->Tags menu

Sample Request

<?xml version='1.0' encoding='UTF-8'?>
<methodCall>
<methodName>ContactService.removeFromGroup</methodName>
  <params>
    <param>
      <value><string>privateKey</string></value>
    </param>
    <param>
      <value><int>contactIDNumber</int></value>
    </param>
    <param>
      <value><int>groupIDNumber</int></value>
    </param>
  </params>
</methodCall>

Sample Response

<?xml version='1.0' encoding='UTF-8'?>
<methodResponse>
  <params>
    <param>
      <value><boolean>0</boolean></value>
    </param>
  </params>
</methodResponse>

PHP iSDK Sample

$contactId = 123;
$groupId = 456;
$result = $app->grpRemove($contactId, $groupId);

ContactService.runActionSequence

Runs an action set on a given contact record

Required Parameters

Parameter Name Type Definition
privateKey string Your Infusionsoft API key
contactId int The Id number of the contact record you want to run the action set on
actionSetId int The Id number of the action set you would like to run. This is found on the Setup->Action sets menu

Sample Request

<?xml version='1.0' encoding='UTF-8'?>
<methodCall>
<methodName>ContactService.runActionSequence</methodName>
  <params>
    <param>
      <value><string>privateKey</string></value>
    </param>
    <param>
      <value><int>contactIDNumber</int></value>
    </param>
    <param>
      <value><int>1</int></value>
    </param>
  </params>
</methodCall>

Sample Response

<?xml version='1.0' encoding='UTF-8'?>
<methodResponse>
  <params>
    <param>
      <value>
        <array>
          <data>
            <value>
              <struct>
                <member>
                  <name>
                    Action
                  </name>
                  <value>
                    Apply/Remove Tag
                  </value>
                </member>
                <member>
                  <name>
                    Message
                  </name>
                  <value>
                    tags applied to Contact: Nurture Subscriber
                  </value>
                </member>
                <member>
                  <name>
                    IsError
                  </name>
                  <value>
                    <boolean>
                      0
                    </boolean>
                  </value>
                </member>
              </struct>
            </value>
          </data>
        </array>
      </value>
    </param>
  </params>
</methodResponse>

PHP iSDK Sample

$contactId = 123;
$actionId = 456;
$result = $app->runAS($contactId, $actionId);

ContactService.addWithDupCheck

Adds or updates a contact record based on matching data

Required Parameters

Parameter Name Type Definition
privateKey string Your Infusionsoft API key
data array An associative array of the data for this new contact record. The array key is the field name to store the value within
dupCheckType string Determines how to consider a duplicate record. Options: 'Email', 'EmailAndName', 'EmailAndNameAndCompany'

Sample Request

<?xml version="1.0"?>
<methodCall>
	<methodName>ContactService.addWithDupCheck</methodName>
		<params>
			<param>
				<value><string>c94a1f2b395a9ab97d4263b37f7b0923</string></value>
			</param>
			<param>
				<value>
					<struct>
						<member>
							<name>FirstName</name>
							<value><string>mytest</string></value>
						</member>
						<member>
							<name>LastName</name>
							<value><string>duh</string></value>
						</member>
						<member>
							<name>Email</name>
							<value><string>me@testingthis.com</string></value>
						</member>
					</struct>
				</value>
			</param>
			<param>
				<value><string>EmailAndName</string></value>
			</param>
		</params>
</methodCall>

Sample Response

<?xml version="1.0" encoding="UTF-8"?>
<methodResponse>
    <params>
        <param>
            <value>
                <i4>40</i4>
            </value>
        </param>
    </params>
</methodResponse>

PHP iSDK Sample

$app->addWithDupCheck(array('FirstName' => 'test', 'LastName' => 'test', 'Email' => 'test@test.com'), 'EmailAndName');

ContactService.update

Updates the data on a contact record

Required Parameters

Parameter Name Type Definition
privateKey string Your Infusionsoft API key
contactId int The Id number of the contact you wish to update
data array An associate array of the data for this contact. The array key needs to be the field name in which you store the value

Sample Request

<?xml version='1.0' encoding='UTF-8'?>
<methodCall>
<methodName>ContactService.update</methodName>
  <params>
    <param>
      <value><string>privateKey</string></value>
    </param>
    <param>
      <value><int>contactIDNumber</int></value>
    </param>
    <param>
      <value><struct>
        <member><name>fieldToUpdate1</name>
          <value><string>field1</string></value>
        </member>
        <member><name>fieldToUpdate2</name>
          <value><string>field2</string></value>
        </member>
      </struct></value>
    </param>
  </params>
</methodCall>

Sample Response

<?xml version='1.0' encoding='UTF-8'?>
<methodResponse>
  <params>
    <param>
      <value><i4>contactIDNumber</i4></value>
    </param>
  </params>
</methodResponse>

PHP iSDK Sample

$conDat = array('Email' => 'JDoe2@email.com');
$conID = $app->updateCon(123, $conDat);