Integration Document

Written By Devin O'Neill ()

Updated at April 15th, 2025

Introduction

Emarsys empowers digital marketing leaders and business owners with the only omnichannel customer engagement platform built to accelerate business outcomes. By rapidly aligning desired business results with proven omnichannel customer engagement strategies crowdsourced from leading brands across your industry, our platform enables you to accelerate time to value, deliver a superior 1:1 experience, and produce measurable results fast.

Prerequisites

  • Username
  • Secret
  • List-Id
  • Field Ids

Log into Emarsys

  • Enter the following url link and enter login details.

https://suite54.emarsys.net

Steps to get Username & Secret

Navigate: More > Management > Security settings as shown in the following image.

  • It will open the following window. Click on the API Users as shown below.
     

Steps to get Field Ids:

Navigate: More > Management > Field Editor as shown in the following image.

Library Implementation

Functions

  1. createContact()

This function is used to add contact to Emarsys ESP.

Parameters:

Parameter Name Parameter Description Example
$listId (required) Id of the contact list. 837514338
$fieldData (required) Pass the field mapping array

[

[

"1" => "Suvarna",

"2" => "Punekar”, "3" => "annex.int.test6@test.com", "834" => "1500",

"930" => "1000",

"931" => "Bronze", "932" => '2020-12-31',

"933" => "", "934" => "2020-12-31",

"935" => "2020-12-31", "936" => "2020-12-31",

"937" => "2020-12-31",

"938" => "2000",

"1555" => "2020-12-31",

"1561" => "Yes", "1556" => "", "1557" => "2021-12-31",

"1558" => "1500”,

]

]

  1. updateContact()

This function is used to update the contact of Emarsys ESP.

Parameters:

Parameter Name Parameter Description Example
$listId (required) Id of contact list. 837514338
$fieldData (required) Pass the field mapping array.

[

[

"1" => "Suvarna",

"2" => "Punekar”, "3" => "annex.int.test6@test.com", "834" => "1500",

"930" => "1000",

"931" => "Bronze", "932" => '2020-12-31',

"933" => "", "934" => "2020-12-31",

]

]

  1. getLists()

This function is used to get all the lists of Emarsys ESP.

  1. getFields()

This function is used to get fields.

Parameters:

Parameter Name Parameter Description Example
$language (optional) en  
  1. addOrUpdateContact()

This function is used to update contacts from the list. It first checks whether the user exists or not and then updates it. If the user does not exist, then it adds the user to the list.

Parameters:

Parameter Name Parameter Description Example
$listId (required) Id of contact list. 837514338
$email (required) Pass the user’s email address annex.int.test6@test.com
$fieldData (required) Pass the field mapping array

[

[

"1" => "Suvarna",

"2" => "Punekar”, "3" => "annex.int.test6@test.com", "834" => "1500",

"930" => "1000",

"931" => "Bronze", "932" => '2020-12-31',

"933" => "", "934" => "2020-12-31",

]

]

  1. Example usage of class:

$username = ‘penfactory_sandbox002’;

$secret = ‘8rzL95f3lheywBjv9MUB’;

$emarsysObject = new Emarsys($username, $secret);

$listId = ‘837514338;

$email = ‘annex.int.test6@test.com’;

$fieldData = [

[

"1" => "Suvarna",

"2" => "Punekar”,

"3" => "annex.int.test6@test.com",

"834" => "1500",

"930" => "1000",

"931" => "Bronze",

"932" => '2020-12-31',

"933" => "",

"934" => "2020-12-31",

"935" => "2020-12-31", "936" => "2020-12-31",

"937" => "2020-12-31",

"938" => "2000",

"1555" => "2020-12-31",

"1561" => "Yes",

"1556" => "",

"1557" => "2021-12-31",

"1558" => "1500”,

]

];

$emarsysObject->addOrUpdateContact($listId, $email, $fieldData);