PHP icontact API integration

2.1k Views Asked by At

I am using icontact api 2.0 for integrating the icontact list in my site. I face an issue with creating new list and adding new message its not create any list using the API.But i can create contact and subscribe and so on.. Code used is

require_once('lib/iContactApi.php');


// Give the API your information
iContactApi::getInstance()->setConfig(array(
    'appId'       => 'my_APIID', 
    'apiPassword' => 'my_password', 
    'apiUsername' => 'my_username'
));

// Store the singleton
$oiContact = iContactApi::getInstance();

$oiContact->addList('test', 4424, true, false, false, 'Just an example list',"test");

$oiContact->addMessage('An Example Message', 585, '<h1>An Example Message</h1>', 'An Example Message', 'ExampleMessage', 33765, 'normal');
// Schedule send
$oiContact->sendMessage(array(33765), 179962, null, null, null, mktime(0, 0, 0, 10, 03, 2012));

Also checked some help but not found any soulution http://www.softwareprojects.com/resources/programming/t-icontact-20-api-integration-php-example-1925.html

1

There are 1 best solutions below

4
On BEST ANSWER

The problem is probably on the second parameter to addList

$oiContact->addList('test', 4424, true, false, false, 'Just an example list',"test");

4424 - has to be a valid message id that already exists for one of your list, if you go to your icontact dashboard and create a welcome message for one of your list and then edit it, you will see on the url an "iMessageId" parameter. You can use this as the second parameter and it should work.

https://app.sandbox.icontact.com/icp/core/code/message/edit/?token=ff1a8748b08088d41e69215c75295c98&iMessageId=1979804&sHubId=41254750ca180a4e7b3

ref: http://developer.icontact.com/documentation/lists/