Find Me On

Quick Question?

First Name *
Email *
My Quick Question is:

The vault

Member Login





Lost your password?
Not a member? Sign up here

Additional Functions and Services

In the Additional Functions and Services section of this SDK you will find functions that are not a direct port to an API Method but will make life easier when coding for Infusionsofts API. You will also find methods for the Email Service, Affiliate Service and Service Call Service.
This is the main part of the SDK that will grow when updates are released.

Function Description Return Value Arguments
cfgCon Connects you to an infusionsoft application. Boolean 1
infuDate Formats a date string to meet Infusionsofts requirements. Date 1
attachEmail Takes in an email, stores, and attaches it to a contact. Boolean 13
createEmailTemplate Creates an email template for sending out emails. Integer 10
optIn Opts in an email address marked as non-marketable. Boolean 1/2
optOut Opts out an emails address. Boolean 1/2
sendEmail Sends an email through the application and links the sent email to the given contact. Boolean 9
affClawbacks Return all claw backs in the date range for the specified affiliate. Array 3
affCommissions Return all sale commissions in the date range for the specified affiliate. Array 3
affPayouts Return all payouts in the date range for the specified affiliate. Array 3
affRunningTotals Pulls the running totals for a list of affiliates. Array 1
affSummary Get the summary for a list of affiliates for the specified date range. Array 3
addMoveNotes Adds move notes to existing tickets. Boolean 4
moveTicketStage Moves the stage of a ticket. Boolean 4

cfgCon( [string] Application Handle);

Top Menu

The cfgCon function is mandatory to make a connection between the script and your applications API server. You need to have set up your conn.cfg file first. In conn.cfg you will enter connection details for applications that are delimited with colons(:). The order in which you enter your data is: Application Handle, Application Name, Application type(i/m), API key, Notes

#Below is what the entry in conn.cfg looks like
#demo:AppName:i:My_API_Key:Demo Application for use in training documents.

$myApp = new iSDK;
if ($myApp->cfgCon("demo")) {
    echo "Connected...";
}

The cfgCon function is boolean so it will return true or false allowing you to determine if you have successfully connected.


infuDate( [string] Date in String Format );

Top Menu

A big question commonly asked prior to this SDK was how to format dates to work with Infusionsoft. To eliminate this question from ever being asked again, infuDate was born. it takes one argument, a string that must be a date in one of these formats

Below is a sample of using infuDate

$myDate = infuDate("12-31-2008");

If infuDate does not accept the date format you need to use or have a need to format the dat yourself, Infusion requires the date to be in YYYYMMDDTHH:MM:SS format. This format can be achieved with date(‘Ymd\TH:i:s’)


attachEmail( [int] contactId, [String] fromName, [String] fromAddress, [String] toAddress, [String] ccAddresses, [String] bccAddresses, [String] contentType, [String] subject, [String] htmlBody, [String] textBody, [String] header, [String] receivedDate, [String] sentDate );

Top Menu

This function takes all the parts of an email and stores them inside Infusionsoft and attaches it to a contacts recent email history.

$status = $app->attachEmail(123,"John Doe","JDoe@test.com","Tester@test.com","",
                            "","TEXT","Test Subject","","Test Body Can Be Anything",
                            $emlHeader,$receivedDate,$sentDate);

The function returns a boolean value so if it completes successfully it will return “TRUE”.


createEmailTemplate( [String] templateTitle, [int] userId, [String] fromAddress, [String] toAddress, [String] ccAddresses, [String] bccAddresses, [String] contentType, [String] subject, [String] htmlBody, [String] textBody );

Top Menu

Creates an email template for sending out emails and stores it in Infusionsoft for later use.

$tmpId = $app->createEmailTemplate("This is my template",1,"Info@test.com",
                                   "~Contact.Email~","","","HTML","My Test Email",
                                   "<b>This is my test body</b>","");

This function will return the ID of the new template.


optIn( [String] Email, [optional String] Reason );

Top Menu

This function takes 1 or 2 arguments.

1- The email you want to opt in.
2- The reason you opted it in.

If you exclude argument 2 the reason will default to “API Opt In”.

Note that addCon will now automatically run optIn and also has the optional second argument.

$result = $myApp->optIn("sample@test","override reason");

optOut( [String] Email, [optional String] Reason );

Top Menu

This function takes 1 or 2 arguments.

1- The email you want to opt out.
2- The reason you opted it out.

If you exclude argument 2 the reason will default to “API Opt Out”.

$result = $myApp->optOut("sample@test","override reason");

sendEmail( [Int Array] contactList, [String] fromAddress, [String] toAddress, [String] ccAddresses, [String] bccAddresses, [String] contentType, [String] subject, [String] htmlBody, [String] textBody );

Top Menu

This function will send an email out to a list of Infusionsoft contacts. You pass the function an array of contact IDs(integers) and the properties of the email and it will be scheduled to send out inside of Infusionsoft.

$clist = array(123,456,789);
$status = $app->sendEmail($clist,"Test@test.com","~Contact.Email~",
                          "","","TEXT","Test Subject","","This is the body");

After you call the function it will return a boolean value to let you know what the result was. Note that the returned value is based off of whether or not it was scheduled properly, it has nothing to do with any of the email results.


affClawbacks( [int] affiliateId, [Date] filterStartDate, [Date] filterEndDate );

Top Menu

The affClawbacks method is used for obtaining all of an affiliates claw backs within a specified date range.

$start = $date('Ymd\TH:i:s',mktime(00,00,00,09,01,2008));
$finish = $date('Ymd\TH:i:s',mktime(00,00,00,09,30,2008));
$claws = $app->affClawbacks(123,$start,$finish);

The above code will return a list of payouts with information about each payout within the month of September 2008.


affCommissions( [int] affiliateId, [Date] filterStartDate, [Date] filterEndDate );

Top Menu

The affCommissions function is used to return all commisions for a specified affiliate within a date range.

$start = $date('Ymd\TH:i:s',mktime(00,00,00,09,01,2008));
$finish = $date('Ymd\TH:i:s',mktime(00,00,00,09,30,2008));
$comms = $app->affCommissions(123,$start,$finish);

The above code will return a list of all sale commissions within the month of September 2008.


affPayouts( [int] affiliateId, [Date] filterStartDate, [Date] filterEndDate );

Top Menu

The affPayouts function is used to return all payouts for a specified affiliate within a date range.

$start = $date('Ymd\TH:i:s',mktime(00,00,00,09,01,2008));
$finish = $date('Ymd\TH:i:s',mktime(00,00,00,09,30,2008));
$pays = $app->affPayouts(123,$start,$finish);

The above code will return a list of all payouts for the specified affiliate in September 2008.


affRunningTotals( [int array] affiliateIds );

Top Menu

The affRunningTotals function is used to return the totals for a list of affiliates. The returned value includes the AffiliateId, AmountEarned, Clawbacks, Payments, and RunningBalance.

$affs = array(123,456,789);
$totals = $app->affPayouts($affs);

affSummary( [int array] affiliateIds, [Date] filterStartDate, [Date] filterEndDate );

Top Menu

The affSummary function is used to return the summary for the list of affiliates in the given date range.

$affs = array(123,456,789);
$start = $date('Ymd\TH:i:s',mktime(00,00,00,09,01,2008));
$finish = $date('Ymd\TH:i:s',mktime(00,00,00,09,30,2008));
$pays = $app->affSummary($affs,$start,$finish);

addMoveNotes( [String Array] ticketIds, [String] moveNotes, [int] moveToStageId, [String Array] notifyIds );

Top Menu

The addMoveNotes function will add move notes to the specified tickets.

$ticks = array(1,2,3,4);
$notify = array(123,456,789);
$status = $app->addMoveNotes($ticks,"These are test notes",2,$notify);

The function returns a Boolean value to report the status of operation.


moveTicketStage( [int] ticketId, [int] targetStage, [String] moveNotes, [String Array] notifyIds );

Top Menu

The moveTicketStage function will move the stage of a ticket add move notes and notify the listed users.

$notify = array(123,456,789);
$status = $app->moveTicketStage(123,2,"Test Move Notes", $notify);

This concludes the Additional Functions and Services. Happy Coding!