A library to help you interact with the SIM (Selligent Interactive Marketing) Soap webservice.
To use the web service, it’s mandatory to create an ‘automation’ user in the SELLIGENT Manager. It is this user that will be used for authentication in the API calls.
To do so, go to User/Group Management and create a new user, give it a name and password and only rights to “automation”.
To setup the library include the file of the PHP-class you need (BroadcastClient.class.php to use the Broadcast API, IndividualClient.class.php to use the Individual API).
You also have to create a configarray with your webservice url and credentials.
use SimClient\IndividualClient;
use SimClient\BroadcastClient;
require_once('IndividualClient.class.php');
require_once('BroadcastClient.class.php');
$config = array(
'individual_url' => 'http://mydomain.example/automation/Individual.asmx?WSDL',
'broadcast_url' => 'http://mydomain.example/automation/Broadcast.asmx?WSDL',
'login' => 'yourusername',
'password' => 'yourpassword'
);
The easiest thing to check is the status of the webservice.
$query = new IndividualClient($config);
$result = $query->getSystemStatus();
If you want to add a user to a list you have to define the list id and add the properties to the query object. You can find the list ID in your manager by clicking the map your list is in.
$query = new IndividualClient($config);
$result = $query->setList(295)
->addProperty('NAME', 'R2D2')
->addProperty('MAIL', '[email protected]')
->createUser();
$query = new IndividualClient($config);
$result = $query->setList(295)
->setUserId(21)
->getUserById();
Example response:
Array
(
[ID] => 34327
[MAIL] => [email protected]
[NAME] =>
[OPTOUT] =>
[TESTUSER] => 0
[ONLY_TEXT] =>
[OPTOUT_SOURCE] =>
[SUBSCRIBE_SOURCE] =>
[CREATED_DT] => 18/10/2013 14:52:53
[MODIFIED_DT] => 3/12/2013 11:52:49
[OPTOUT_DT] =>
[OPTIN] => 1
)
$query = new IndividualClient($config);
$result = $query->setList(295)
->setUserId(21)
->addProperty('NAME', 'Luke Skywalker')
->addProperty('MAIL', '[email protected]')
->updateUser();
Get a user by defining a filter.
$query = new IndividualClient($config);
$result = $query->setList(295)
->addFilter('MAIL', '[email protected]')
->getUserByFilter();
Example response:
Array
(
[ID] => 34327
[MAIL] => [email protected]
[NAME] =>
[OPTOUT] =>
[TESTUSER] => 0
[ONLY_TEXT] =>
[OPTOUT_SOURCE] =>
[SUBSCRIBE_SOURCE] =>
[CREATED_DT] => 18/10/2013 14:52:53
[MODIFIED_DT] => 3/12/2013 11:52:49
[OPTOUT_DT] =>
[OPTIN] => 1
)
You can also get an array of user ID's by defining filters.
$query = new IndividualClient($config);
$result = $query->setList(295)
->addFilter('GENDER', 'male')
->addFilter('COUNTRY', 'Belgium')
->getUsersByFilter();
By default the API will return up to 10 results. If you want more or less you can set the maximum count:
$query->setMaxcount(20);
Using the getUserByConstraint() method you can use statements like "LIKE".
$query = new IndividualClient($config);
$result = $query->setList(295)
->setConstraint("MAIL like '[email protected]'")
->getUserByConstraint();
$query = new IndividualClient($config);
$result = $query->setList(295)
->setConstraint("MAIL like '%gmail%'")
->getUsersByConstraint();
By default the API will return up to 10 results. If you want more or less you can set the maximum count:
$query->setMaxcount(20);
Retrieve a hashcode for a specific user
$query = new IndividualClient($config);
$result = $query->setList(295)
->setGate(5)
->setUserId(21)
->retrieveHashForUser();
This method is not tried or tested but is implemented according to the docs of the Selligent webservice. In theory this method needs the following properties to be set:
$query->addProperty($key, $value);
$query->setGate($gateId);
$query->triggerCampaign();
This method is not tried or tested but is implemented according to the docs of the Selligent webservice. In theory this method needs the following properties to be set:
$query->setXml($key, $value);
$query->setGate($gateId);
$query->triggerCampaignByXML();
This method is not tried or tested but is implemented according to the docs of the Selligent webservice. In theory this method needs the following properties to be set:
$query->setUserId($uid);
$query->setGate($gateId);
$query->addProperty($key, $value);
$query->triggerCampaignForUser();
I have not used or tested any of the Broadcast Client functionality but I did implement them in the library. So be carefull with them!!
$query = new IndividualClient($config);
$result = $query->setCampaignId($campaignId)
->setXml($xml)
->createCampaign();
$query = new IndividualClient($config);
$result = $query->setCampaignId($campaignId)
->setState($state)
->setCampaignState();
$query = new IndividualClient($config);
$result = $query->setXml($xml)
->processUserData();
- Test and write documentation for the Broadcast API
- Look into the new REST-api