qortex / php-emarsys-connector
Provides connection to Emarsys Omnichannel Customer Engagement Platform API v2
Requires
- php: ^7.4|^8
- guzzlehttp/guzzle: ^7
Requires (Dev)
- phpunit/phpunit: ^9
README
If you are developing with Laravel, concider using laravel-emarsys-connector instead. I allows to use connector as an injected dependency.
Install
$ composer require qortex/php-emarsys-connector
Use
First, obtain credentials for Emarsys API User.
Then, pass these credentials as username and secret to EmarsysConnector
constructor:
use Qortex\Emarsys\Services\Connector as EmarsysConnector; $emarsysConnector = new EmarsysConnector($username, $secret);
Last, use any of the following EmarsysConnector
methods to communicate with Emarsys Omnichannel Customer Engagement Platform:
function queryContacts(string $key, string $value)
Queries all contacts matching $key
with the $value
in Emarsys contacts database, regardless the contact lists.
Emarsys API List Contact Data
function createContact(string $key, array $properties)
Creates a contact in Emarsys contacts database and populates its properties with $properties
. $key
is used to provide uniqueness of the contact.
Emarsys API Create Contacts
function deleteContact(string $key, string $value)
Deletes a contact with $key
equals $value
from Emarsys contacts database.
Emarsys API Delete a Contact
function addContactToContactListById(int $listId, int $contactId)
Adds a contact defined by $contactId
to a contact list defined by $listId
.
Emarsys API Add Contacts to a Contact List
function removeContactFromContactListById(int $listId, int $contactId)
Removes a contact defined by $contactId
from a contact list defined by $listId
.
Emarsys API Remove Contacts from a Contact List
function countContactsInAContactList(int $listId)
Counts contacts in a contact list defined by $listId
Emarsys API Count Contacts in a Contact List