NAV
json

General information

Authorization data

{
  "clientId":"your-client-id-123",
  "apiKey":"your-api-key-123",
  "requestTime":1327056031488,
  "sha":"2aa3927a7dee8c2a712adb5375f5fa36dd8fe00c"
}

Each API call, except for authentication, has to include authentication data.

Values of clientId can be found under the “Integration” bookmark in the “Settings” menu. The apiKey value is a random string used for authentication.
The sha value is generated using the SHA-1 algorithm from a string created from the combination: apiKey + clientId + apiSecret. ApiSecret is located on the above mentioned “Integration” bookmark. requestTime is a timestamp when the call is made.

All requests must be sent at:

http://www.salesmanago.pl/api

For example:

http://xyz.salesmanago.pl/api/contact/upsert

Where xyz is your server’s ID (www or app1, app2, app3…)

Accept: application/json, application/json
Content-Type: application/json;charset=UTF-8

Each request is sent using the HTTP POST method. If the HTTP GET method should be used, it is clearly stated in the user’s manual for each method.

The obligatory fields in the documentation are marked with an * .

Monitoring code integration

Once our account has been activated, we get access to the code monitoring our website. We will find the code on the main page, visible after logging in (until SALESmanago detects the code on our website), or under "Settings” > “Integration” menu.

alt text

Script[1] should be added to each page of our website, just before the end of the “body” section.
It is best if there is the possibility to download this script into the template of our website, so that the code is in one place and it is identically printed on all pages.

For example, the script in CMS Wordpress can be downloaded into the “footer.php” file. Here is an example:

alt text

After several minutes from implementation, if there are visits on our website, information about the need to implement the code will disappear from the SALESmanago main page.

Sending additional monitoring data

Sample code with a marked contactId value:

<script type="text/javascript">  
    var _smid = "your-client-id-123";
    var _smclientid = "contactIdFromResponse-123";
</script>
<script src="http://www.salesmanago.pl/static/sm.js" type="text/javascript"/>

Alternatively, by sending the form by AJAX, it is possible to record only the cookie:

    $.ajax({
        type:'POST',
        url:'/account/registerDemoVideo.htm',
        data:$("#registerForm").serialize(),
        cache:false,
        timeout:240000,
        success:function (data) {
            if (data == 'Wrong_Email') {
                alert('The email is not valid.');
                $("#email").focus();
            } else {
                createCookie('smclient', data, 365 * 10);
                $(".registeredInfo").show();
            }
        },
        error:function (data) {
            alert("Error - failed to register");
        }});

In response to a /contact/upsert call we receive a unique ID. In order to make monitoring of users’ behavior on the website more efficient, we must submit this parameter to at least one subpage visited by the user – eg. after logging in – at the moment of logging in we make a request /contact/upsert and the returned contactId value is printed with the JavaScript code of the SALESmanago monitoring system.

NextGen e-Commerce code implementation

Monitoring code:

<script type='text/javascript'>
      var _smShopId = '<-- YOUR_SHOP_ID -->';
      (function () {
            var sm = document.createElement('script');
            sm.type = 'text/javascript';
            sm.async = true;
            sm.src = ('https:' == document.location.protocol ? 'https://' :
            'http://') + '<-- YOUR_ENDPOINT -->.salesmanago.pl/static/smng.js';
            var s = document.getElementsByTagName('script')[0];
            s.parentNode.insertBefore(sm, s);
      })();
</script>

In order to gain NextGen functionality you need to add monitoring code presented below:

alt text

by adding CSS class (class) “sm-pid-{UnikalneId} sm-product-list”. Similar on product card:

alt text

by adding CSS class “sm-pid-{UnikalneId} sm-product-view” UniqueId should reflect ID inproducts XML feed.

API - Contact management

Adding a new contact or modifying the existing contact

An example of request data structure:

{
  "apiKey" : "your-api-key-123",
  "clientId" : "your-client-id-123",
  "contact" : { 
        "company" : "Benhauer",
        "email" : "test-1@konri.com",
        "fax" : "+48345543345",
        "name" : "Test",
        "phone" : "+48123321123",
        "company" : "Benhauer",
        "state" : "PROSPECT",
        "address":{
            "streetAddress":"Brzyczynska 123",
            "zipCode":"43-305",
            "city":"Krakow",
            "country":"PL"
      }
    },
  "owner" : "admin@vendor.pl",
  "newEmail" : "",
  "forceOptIn" : true,
  "forceOptOut" : false,
  "forcePhoneOptIn" : true,
  "forcePhoneOptOut" : false,
  "requestTime" : 1327059355361,
  "sha" : "08924f45afc2e4fb8b652c53cdb493c7ddb846a1",
  "tags" : [ "API","ADmanago"],
  "removeTags" : [ "Test_tag","New"],
  "properties" : {
        "custom.nickname":"Konri",
        "custom.sex":"M"
        },
  "dictionaryProperties": [{
        "name": "birthday",
        "type": "DATE",
        "value": 1488927600000
        },
        {
        "name": "visits",
        "type": "NUMBER",
        "value": 42
        }
  ],
  "birthday" : "19801017",
  "province" : "Małopolska",
  "useApiDoubleOptIn":true,
  "apiDoubleOptInEmailTemplateId":null,
  "apiDoubleOptInEmailAccountId":null,
  "apiDoubleOptInEmailSubject":null,
  "lang":"PL"

}

The contact is added by calling the method:
http://www.salesmanago.pl/api/contact/upsert

Basic elements that can be provided by adding a new contact in the structure include:

name – contact name
email – contact email*
phone – phone number
fax – fax number company – contact company
birthday – date of contact companybirth, sent as a string of signs in the form: yyyyMMdd or Mmdd (yyyy – a 4-digit year, MM – a two-digit month, dd – a two-digit day)
apiDoubleOptInEmailTemplateId – optional ID of template for double-opt-in, apiDoubleOptInEmailAccountId – optional ID of e-mail account for double-opt-in
apiDoubleOptInEmailSubject – optional message topic for double-opt-in
address – contact’s address     streetAddress – street and house number     zipCode – zip code
    city – town/city
    country – country

Additionally the request should be supplemented with the information about contact’s owner (account the contact will be attributed to):
owner – contact’s owner (SALESmanago user account email)*
Optionally we can change the contact’s e-mail address. The newEmail field should then be filled in: newEmail – new email address (if we want to modify it)

We can also force the so-called opt-in/opt-out of the contact. We must then fill in the forceOptIn or forceOptOut field.
In case of absence of this fields contact will be created with opt-in state.

forceOptOut – forcing opt-out after adding/modification forceOptIn – forcing opt-in after adding/modification (if the previous option has not been chosen)
forcePhoneOptOut – forcing opt-out from a phone after adding/modification forcePhoneOptIn – forcing opt-in to a phone after adding/modification (if the previous option has not been chosen)

In the request it is possible to mark a contact with tags and remove the existing tags. Tags are sent as an array of text strings in the tags field.

tags – array of contact’s tags
removeTags – array of tags to be removed

It is also possible to attribute any number of fields defined by the user to a contact. We send them through a map:

properties – contact attributes defined by the user. It is advised not to use Polish signs and spaces in the name, but it is allowed.

dictionaryProperties - user-defined attributes of the dictionary, the first to add a particular attribute can be used for the remaining contacts through re-enter the same name and type of the assigned another value.
    name - name (3-255 signs)
    type - type (NUMBER lub DATE)
    value - integer greater than 0

Result of request:

{ 
  "contactId" : "21c252a6-6de0-436b-bae8-9d0142363266",
  "message" : [  ],
  "success" : true 
}

As a result of request we receive:

success – truth value informing about the result of request (successful/not successful)
contactId – unique ID of the updated or newly added contact
message – array of additional information enabling error identification

Adding a new contact

Sample structure of request data:

{
  "apiKey" : "your-api-key-123",
  "clientId" : "your-client-id-123",
  "sha" : "08924f45afc2e4fb8b652c53cdb493c7ddb846a1",
  "requestTime" : 1327059355361,
  "contact" : { "company" : "Benhauer Sp. z o.o. Sp. K.",
      "email" : "test-1@konri.com",
      "fax" : "+48345543345",
      "name" : "Test",
      "phone" : "+48123321123",
    "company" : "Benhauer",
    "state" : "PROSPECT",
      "address":{
        "streetAddress":"Brzyczynska 123",
        "zipCode":"43-305",
        "city":"Krakow",
        "country":"PL"
      }
    },
  "owner" : "admin@vendor.pl",
  "forceOptOut" : false,
  "forcePhoneOptOut" : false,
  "tags" : [ "API",
      "ADmanago"
    ],
  "properties":{"custom.nickname":"Konri","custom.sex":"M"},
  "birthday": "19801017",
  "useApiDoubleOptIn":true,
  "lang":"PL"

}

We add a contact by calling the method:
http://www.salesmanago.pl/api/contact/insert

The basic elements that can be specified by adding a new contact are the same as in the upsert method, except for fields: forceOptIn, forcePhoneOptIn i removeTags.

Available fields in the request insert method:

Field Max. length Description
owner* 255 contact’s owner (SALESmanago user account email)
email* 255 contact email
name 255 contact name
phone 255 phone number
fax 255 fax number
company 255 contact company
state 255 contact’s state (PROSPECT,CUSTOMER,PROSPECT,OTHER,UNKNOWN)
externalId 255 External contact ID
birthday yyyyMMdd/Mmdd date of contact companybirth, sent as a string of signs in the form: yyyyMMdd or Mmdd (yyyy – a 4-digit year, MM – a two-digit month, dd – a two-digit day)
streetAddress 255 street and house number
zipCode 255 zip code
city 255 town/city
country 255 country
useApiDoubleOptIn true/false optional ID for the double-opt-in template
lang 255 optional subject for double-opt-in messages
forceOptOut true/false forcing opt-out after adding/modification
forcePhoneOptOut true/false forcing opt-out from a phone after adding/modification
tags 255/tag array of contact’s tags
properties 255/detal contact attributes defined by the user. It is advised not to use Polish signs and spaces in the name, but it is allowed.

Result of request:

{ 
  "contactId" : "21c252a6-6de0-436b-bae8-9d0142363266",
  "message" : [  ],
  "success" : true 
}

As a result of request we receive:

success – truth value informing about the result of request (successful/not successful)
contactId – unique ID of the updated or newly added contact
message – array of additional information enabling error identification

Modifying an existing contact

Sample structure of request data:

{
  "apiKey" : "your-api-key-123",
  "clientId" : "your-client-id-123",
  "email" : "konrad@salesmanago.pl",
  "contactId" : null,
  "contact" : { 
      "company" : "Benhauer Sp. z o.o. Sp. K.",
      "email" : "test-1@konri.com",
      "fax" : "+48345543345",
      "name" : "Test",
      "phone" : "+48123321123",
      "state" : "PROSPECT",
      "address":{
        "streetAddress":"Brzyczynska 123",
        "zipCode":"43-305",
        "city":"Krakow",
        "country":"PL"
      }
    },
  "owner" : "admin@vendor.pl",
  "forceOptIn" : true,
  "forceOptOut" : false,
  "forcePhoneOptIn" : true,
  "forcePhoneOptOut" : false,
  "requestTime" : 1327059355361,
  "sha" : "08924f45afc2e4fb8b652c53cdb493c7ddb846a1",
  "tags" : [ "API", "ADmanago"],
  "removeTags" : [ "Test_tag", "New"],
  "properties":{"custom.nickname":"Konri","custom.sex":"M"},
  "birthday": "1017"
}

We modify a contact by calling a method:
http://www.salesmanago.pl/api/contact/update

Request data are identical with the upsert method described above. A contact is identified by email or contactId (returned when adding a contact). If you specify the email address in the box contact e-mail address is updated.

Available fields in the request update method:

Field Max. length Description
owner* 255 contact’s owner (SALESmanago user account email)
email* 255 contact email
name 255 contact name
phone 255 phone number
fax 255 fax number
company 255 contact company
state 255 contact’s state (PROSPECT,CUSTOMER,PROSPECT,OTHER,UNKNOWN)
externalId 255 External contact ID
birthday yyyyMMdd/Mmdd date of contact companybirth, sent as a string of signs in the form: yyyyMMdd or Mmdd (yyyy – a 4-digit year, MM – a two-digit month, dd – a two-digit day)
streetAddress 255 street and house number
zipCode 255 zip code
city 255 town/city
country 255 country
forceOptOut true/false forcing opt-out after adding/modification
forceOptIn true/false forcing opt-in after adding/modification (if the previous option has not been chosen)
forcePhoneOptOut true/false forcing opt-out from a phone after adding/modification
forcePhoneOptIn true/false forcing opt-in to a phone after adding/modification (if the previous option has not been chosen)
tags 255/tag array of contact’s tags
removeTags 255/tag array of tags to be removed
properties 255/detal contact attributes defined by the user. It is advised not to use Polish signs and spaces in the name, but it is allowed

Result of request:

{ 
  "contactId" : "21c252a6-6de0-436b-bae8-9d0142363266",
  "message" : [  ],
  "success" : true 
}

As a result of request we receive:

success – truth value informing about the result of request (successful/not successful)
contactId – unique ID of the updated or newly added contact
message – array of additional information enabling error identification

Adding many contacts simultaneously

Sample request data structure:

{
  "clientId": "your-client-id-123",
  "apiKey": "your-api-key-123",
  "requestTime": 1348046897664,
  "sha": "8d893f41dd479bb0489686f04b0a169005d22559",
  "owner": "admin@vendor.pl",
  "upsertDetails": [
    {
      "newEmail": null,
      "contact": {
        "email": "batchtest2@benhauer.pl",
        "name": "Test1",
        "phone": "+48123321123",
        "fax": "+48345543345",
        "company": "Benhauer Sp. z o.o. Sp. K.",
        "externalId": null,
        "address": {
          "streetAddress": "Brzyczynska 123",
          "zipCode": "43-305",
          "city": "Krakow",
          "country": "PL"
        }
      },
      "tags": [
        "API",
        "ADmanago"
      ],
      "removeTags": [
        "Test_tag",
        "New"
      ],
      "properties": {
        "custom.nickname": "Konri1",
        "custom.sex": "M"
      },
      "birthday": "19801017",
      "forceOptIn" : true,
      "forceOptOut" : false,
      "forcePhoneOptIn" : true,
      "forcePhoneOptOut" : false
    },
    {
      "contact": {
        "email": "batchtest1@benhauer.pl",
        "name": "Test2",
        "phone": "+48123321123",
        "fax": "+48345543345",
        "company": "Benhauer Sp. z o.o. Sp. K.",
        "externalId": null
      },
      "newEmail": "batchtestNew@benhauer.pl",
      "forceOptIn": true,
      "forceOptOut": false,
      "forcePhoneOptIn": true,
      "forcePhoneOptOut": false,
      "tags": [
        "API",
        "ADmanago"
      ],
      "properties": {
        "custom.nickname": "Konri2",
        "custom.sex": "M"
      },
      "birthday": "19801017"
    }
  ],
  "useApiDoubleOptIn": true,
  "lang": "PL"
}

We add many contacts at the same time using the below method: http://www.salesmanago.pl/api/contact/batchupsert

In the request we provide an array of contacts in the upsertDetails field. Basic elements that can be provided in contact array element can be found above in the description of the upsert method (see Adding a contact).

Available fields in the request batchupsert method:

Field Max. length Description
owner* 255 contact’s owner (SALESmanago user account email)
email* 255 contact email
name 255 contact name
phone 255 phone number
fax 255 fax number
company 255 contact company
state 255 contact’s state (PROSPECT,CUSTOMER,PROSPECT,OTHER,UNKNOWN)
externalId 255 External contact ID
newEmail 255 new contact’s email
birthday yyyyMMdd/Mmdd date of contact companybirth, sent as a string of signs in the form: yyyyMMdd or Mmdd (yyyy – a 4-digit year, MM – a two-digit month, dd – a two-digit day)
streetAddress 255 street and house number
zipCode 255 zip code
city 255 town/city
country 255 country
forceOptOut true/false forcing opt-out after adding/modification
forceOptIn true/false forcing opt-in after adding/modification (if the previous option has not been chosen)
forcePhoneOptOut true/false forcing opt-out from a phone after adding/modification
forcePhoneOptIn true/false forcing opt-in to a phone after adding/modification (if the previous option has not been chosen)
tags 255/tag array of contact’s tags
removeTags 255/tag array of tags to be removed
properties 255/detal contact attributes defined by the user. It is advised not to use Polish signs and spaces in the name, but it is allowed
useApiDoubleOptIn true/false użycie opcji double opt in
lang 255 contact language

Result of request:

{
  "success":true,
  "message":[],
  "contactIds":{
    "batchtest2@benhauer.pl":"b257d328-2a95-41ce-915a-94b4274e6c29",
    "batchtest1@benhauer.pl":"bf4d6c03-1ca2-4b3f-8131-c28829236b02"
  }
}

In response we get a request status and, if it is successful, a list of IDs for added contacts:

success – truth value informing about the result of request (successful/not successful)
contactId – unique ID of the updated or newly added contact
message – array of additional information enabling error identification

Deleting a contact

Sample request data structure:

{ 
 "apiKey" : "your-api-key-123",
 "clientId" : "your-client-id-123",
 "sha" : "08924f45afc2e4fb8b652c53cdb493c7ddb846a1",
 "requestTime" : 1327059355361,
 "email" : "test@salesmanago.pl",
 "owner" : "admin@vendor.pl",
 "permanently": true
}

We delete a contact using the below method:
http://www.salesmanago.pl/api/contact/delete

A contact can be permanently deleted or only marked as deleted. To do this we set a field permanently

Available fields in the request delete method:

Field Max. length Description
owner* 255 contact’s owner (SALESmanago user account email)
permanently* true/false defines if a contact is to be fully deleted or only marked as deleted

As a result of request we receive:

success – truth value informing about the result of request (successful/not successful)
contactId – unique ID of the updated or newly added contact
message – array of additional information enabling error identification

Checking if a contact is already recorded

Sample request data structure:

{
  "clientId": "client-id",
  "apiKey": "api-key-123",
  "requestTime": 1481532212995,
  "sha": "abcd509ac6867955a5333d6eb0c460455c74ccc6",
  "email": "***@gmail.com",
  "owner": "admin@vendor.pl"
}

To check if a contact is already recorded in the database we use the below method:
http://www.salesmanago.pl/api/contact/hasContact

Available fields in the request hasContact method:

Field Max. length Description
owner* 255 contact’s owner (SALESmanago user account email)
email* 255 contact’s email

Result of request:

{
  "success": true,
  "message": [],
  "result": true,
  "contactId": "99cdc5fe-7376-436e-acb5-7180c97dadb6"
}

As a result of request we receive:

success – truth value informing about the result of request (successful/not successful)
message – array of additional information enabling error identification result - result of request
contactId - found ID contact

Import basic contact data by email address

Sample request data structure:

{
  "clientId": "client-id-123",
  "apiKey": "api-key-123",
  "requestTime": 1481533177752,
  "sha": "abcd56045567955a533c74ccc6683d09ac6eb0c4",
  "owner": "admin@vendor.pl",
  "email": [
    "piotr***@gmail.com"
  ]
}

The list of basic contacts data import by calling:
http://www.salesmanago.pl/api/contact/basic

Available fields in the request basic method:

Field Max. length Description
owner* 255 contact’s owner (SALESmanago user account email)
contactId* 255 array of identifiers for the imported contacts (** up to 50 contacts at once **)

Result of request:

{
  "success": true,
  "message": [],
  "contacts": [
    {
      "name": "Piotr",
      "email": "piotr****@gmail.com",
      "phone": "500100100",
      "fax": "",
      "score": 1920,
      "state": "regular",
      "optedOut": false,
      "optedOutPhone": false,
      "deleted": false,
      "invalid": false,
      "company": "Benhauer",
      "externalId": null,
      "address": {
        "streetAddress": "Grzegórzecka 21",
        "zipCode": "30-555",
        "city": "Kraków",
        "country": "Polska"
      },
      "contactId": "99cdc5fe-7376-436e-acb5-7180c97dadb6",
      "birthdayYear": null,
      "birthdayMonth": null,
      "birthdayDay": null,
      "modifiedOn": 1479215570000,
      "createdOn": 1432887727000,
      "lastVisit": 1481528930000
    }
  ]
}

success – information whether import was successful message – array of additional information enabling error identification contacts – imported contacts
name – contact name
email – contact email
phone – contact phone number
fax – contact’s fax number  score – number of points
state – contact’s state
optedOut – information whether the contact is unsubscribed from the mailing list
optedOutPhone - information if the contact is unsubscribed from sending sms
deleted – information if the contact is deleted
invalid – information if the contact is invalid
company – contact company name  externalId – contact external id
address – contact’s address
   streetAddress – street and house number
   zipCode – zip code
   city – town/city    country – country  contactId - contact id  birthdayYear – contact birthday year
birthdayMonth – contact birthday month
birthdayDay – contact birthday day
modifiedOn – last contact update date  createdOn – contact creation date
lastVisit – last visit contact date

Import basic contact data by contact ID

Sample request data structure:

{
  "clientId": "client-id-123",
  "apiKey": "api-key-123",
  "requestTime": 1481535098734,
  "sha": "abcd56045567955a533c74ccc6683d09ac6eb0c4",
  "owner": "admin@vendor.pl",
  "id": [
    "99cdc5fe-7376-436e-acb5-7180c97dadb6"
  ]
}

The list of basic contacts data import by calling:
http://www.salesmanago.pl/api/contact/basicById

Available fields in the request basicById method:

Field Max. length Description
owner* 255 contact’s owner (SALESmanago user account email)
contactId* 255 array of identifiers for the imported contacts (** up to 50 contacts at once **)

Result of request:

{
  "success": true,
  "message": [],
  "contacts": [
    {
      "name": "Piotr",
      "email": "piotr****@gmail.com",
      "phone": "500100100",
      "fax": "",
      "score": 1920,
      "state": "regular",
      "optedOut": false,
      "optedOutPhone": false,
      "deleted": false,
      "invalid": false,
      "company": "Benhauer",
      "externalId": null,
      "address": {
        "streetAddress": "Grzegórzecka 21",
        "zipCode": "30-555",
        "city": "Kraków",
        "country": "Polska"
      },
      "contactId": "99cdc5fe-7376-436e-acb5-7180c97dadb6",
      "birthdayYear": null,
      "birthdayMonth": null,
      "birthdayDay": null,
      "modifiedOn": 1479215570000,
      "createdOn": 1432887727000,
      "lastVisit": 1481528930000
    }
  ]
}

success – information whether import was successful message – array of additional information enabling error identification contacts – imported contacts
name – contact name
email – contact email
phone – contact phone number
fax – contact’s fax number  score – number of points
state – contact’s state
optedOut – information whether the contact is unsubscribed from the mailing list
optedOutPhone - information if the contact is unsubscribed from sending sms
deleted – information if the contact is deleted
invalid – information if the contact is invalid
company – contact company name  externalId – contact external id
address – contact’s address
   streetAddress – street and house number
   zipCode – zip code
   city – town/city    country – country  contactId - contact id  birthdayYear – contact birthday year
birthdayMonth – contact birthday month
birthdayDay – contact birthday day
modifiedOn – last contact update date  createdOn – contact creation date
lastVisit – last visit contact date

Import based on email address for the owner

Sample structure of request data:

{ 
  "apiKey" : "your-api-key-123",
  "clientId" : "your-client-id-123",
  "email" : [ "****@gmail.com" ],
  "owner" : "admin@vendor.pl",
  "requestTime" : 1329128188409,
  "sha" : "02bfe70541d3907cf487f26dc2665b184b1221a7"
}

We import contacts using the below method:
http://www.salesmanago.pl/api/contact/list

Available fields in the request list method:

Field Max. length Description
owner* 255 contact’s owner (SALESmanago user account email)
contactId* 255 array of identifiers for the imported contacts (** up to 50 contacts at once **)

Result of request:

{
  "success": true,
  "message": [],
  "contacts": [
    {
      "id": "99cdc5fe-7376-436e-acb5-7180c97dadb6",
      "name": "Konrad",
      "email": "your-contact-email@mail.com",
      "phone": "123456789",
      "fax": "987654321",
      "score": 775,
      "state": "PROSPECT",
      "optedOut": true,
      "optedOutPhone": false,
      "deleted": false,
      "invalid": false,
      "company": "Benhauer",
      "externalId": "externalId",
      "address": {
        "streetAddress": "Grzegórzecka 21",
        "zipCode": "",
        "city": "Kraków",
        "country": "Polska"
      },
      "birthdayYear": 2000,
      "birthdayMonth": 1,
      "birthdayDay": 1,
      "province": "Małopolska",
      "mainContactOwner": "admin@vendor.pl",
      "modifiedOn": 1479209074000,
      "createdOn": 1432887727000,
      "contactVisits": [
        {
          "conversationIntId": null,
          "host": "10.10.10.10",
          "time": 1328050810504,
          "duration": null,
          "visitSource": "NEXT",
          "visitSourceHost": "salesmanago.pl",
          "visitSourceKeywords": null,
          "visitScore": 1,
          "url": "/test.htm",
          "location": null
        }
      ],
      "contactTags": [
        {
          "tag": "ADMANAGO",
          "tagName": "ADMANAGO",
          "score": 12,
          "createdOn": 1432887757000,
          "tagWithScore": "ADMANAGO (1)"
        }
      ],
      "contactEvents": [
        {
          "date": 1432887757000,
          "description": "Note",
          "detail1": null,
          "detail2": null,
          "detail3": null,
          "detail4": null,
          "detail5": null
        }
      ],
      "emailMessages": [
        {
          "name": "Email",
          "subject": "Subject",
          "date": 1479209121000,
          "sent": false,
          "dateSent": null,
          "opened": false,
          "dateOpened": null,
          "clicked": false,
          "dateClicked": null,
          "emailConversation": 25584162,
          "deliveryStatus": null
        }
      ],
      "properties": [
        {
          "name": "detail",
          "value": "detail-value"
        }
      ],
      "contactFunnels": [
        {
          "salesFunnel": "SalesFunnel 1",
          "salesFunnelId": "5561397c-9792-4b60-aed1-a045b86c6b13",
          "salesStage": "Stage",
          "salesStageId": "de0cf594-b999-438a-b1f0-8578c36a8da5"
        }
      ],
      "contactNotes": [
        {
          "note": "Note",
          "date": 1479208770000,
          "priv": false
        }
      ],
      "contactTasks": [
        {
          "id": "395c5276-a40f-417c-bee8-1d6e80373adb",
          "note": "Task",
          "date": 1479250800000,
          "cc": "",
          "reminder": 1479249900000
        }
      ],
      "incomingEmailMessages": [
        {
          "subject": "Temat",
          "date": 1479209971000
        }
      ],
      "contactExtEvents": [
        {
          "eventId": "bd2fd558-29da-49b7-be31-6ee551cd5e13",
          "date": 1433449419000,
          "description": "Cart",
          "products": "7,6",
          "location": null,
          "value": 57.69,
          "contactExtEventType": "CART",
          "detail1": null,
          "detail2": null,
          "detail3": null,
          "detail4": null,
          "detail5": null,
          "detail6": null,
          "detail7": null,
          "detail8": null,
          "detail9": null,
          "detail10": null,
          "detail11": null,
          "detail12": null,
          "detail13": null,
          "detail14": null,
          "detail15": null,
          "detail16": null,
          "detail17": null,
          "detail18": null,
          "detail19": null,
          "detail20": null,
          "externalId": null
        }
      ],
      "coupons": [
        {
          "name": "Coupon",
          "coupon": "SB173",
          "validTo": 1480245622000
        }
      ],
      "smsMessages": [
        {
          "createdDate": 1479209040000,
          "dateSent": 1479209971000,
          "dateDelivered": null,
          "deliveryStatus": null,
          "dateReplied": null,
          "replayMsg": null,
          "content": "Test",
          "sentBy": "admin@vendor.pl"
        }
      ],
      "modifiedOn": 1479209074000,
      "createdOn": 1432887727000
    }
  ]
}

As a result of request we receive:

success – information whether import was successful message – array of additional information enabling error identification contacts – imported contacts  id – contact ID
name – contact name
email – contact email
phone – contact phone number
fax – contact’s fax number  score – number of points
state – contact’s state
optedOut – information whether the contact is unsubscribed from the mailing list
optedOutPhone - information if the contact is unsubscribed from sending sms
deleted – information if the contact is deleted
invalid – information if the contact is invalid
company – contact company name  externalId – contact external ID
  address – contact’s address
   streetAddress – street and house number
   zipCode – zip code
   city – town/city    country – country   birthdayYear – contact birthday year
  birthdayMonth – contact birthday month
  birthdayDay – contact birthday day
  province - contact’s province   mainContactOwner – contact’s main contact owner ID
  modifiedOn – last contact update date   createdOn – contact creation date
contactVisits – contact visits   conversationIntId – ID of mailing the visit comes from
  host - page visited by the contact
  time - time of visit
  duration - duration
  visitSource – source of visit, possible values of this field include:
EMAIL_CONVERSATION - visit from an email (clicked link)
SEARCH_ENGINE - entering from visit from a search engine  ADVERTISEMENT - ntering from visit from an ad box (AdWords)
REFERRER - ntering from visit from a referring website
  DIRECT - direct entrance or moving to next page
  visitSourceHost - referring host (referrer)   visitSourceKeywords - keywords
  visitScore – number of points   url – URL of visited page
  location - location
contactTags – contact tags   tag – tag text   tagName – tag name
  score – tag score   createdOn – tag creation date
  tagWithScore – tag name with score
contactEvents – events   date – date of event
  description – event description
  detail1-5 – event details
emailMessages – email messages
  name – message name   subject – message subject   date – message creation date   sent – information if the email has been sen   dateSent – message sent date   opened – information if the email has been opened
  dateOpened – message opened date
  clicked – information if the email has been clicked
  dateClicked – message clicked date
  emailConversation – conversation ID
  deliveryStatus – delivery status  properties – contact details
  name – detail name   value – detail value  contactFunnels – contact sales funnels
  salesFunnel – funnel name   salesFunnelId – funnel id   salesStage – funnel stage name
  salesStageId – funnel stage ID  contactNotes - notes   note – note content
  date – note creation date   priv – information If note is private
contactTasks – events
  id – event ID   note – event content
  date – event creation date
  cc – crystal copy of email reminder
  reminder – reminder date
incomingEmailMessages – incoming email messages
  subject – incoming email message subject
  date – incoming message planned delivery date
contactExtEvents – external events   eventId – external event ID
  date – event date
  description – event description
  products – value of “product” field ( e.g. product ID’s)   location – localization
  value – event value
  contactExtEventType – event type   detail1-20 – event detail (max 20)
  externalId – event external ID  coupons - coupons
  name – coupon name   coupon – string of coupon marks
  validTo – coupon valid date
smsMessages – sms messages
  createdDate – message creation date   dateSent – message sent date   dateDelivered – message delivery date
  deliveryStatus – delivery status
  dateReplied – message reply date   replayMsg – reply content
  content – message content
  sentBy – email sender messages

Import based on contact’s ID for the owner

Sample structure of request data:

{ 
  "apiKey" : "your-api-key-123",
  "clientId" : "your-client-id-123",
  "contactId" : [ "123-XYZ" ],
  "owner" : "admin@vendor.pl",
  "requestTime" : 1329128188409,
  "sha" : "02bfe70541d3907cf487f26dc2665b184b1221a7"
}

We import contacts using the below method:
http://www.salesmanago.pl/api/contact/listById

Available fields in the request listById method:

Field Max. length Description
owner* 255 contact’s owner (SALESmanago user account email)
contactId* 255 array of identifiers for the imported contacts (** up to 50 contacts at once **)

Request result is returned as JSON structure identical with the previous request.

Import based on email address

Sample structure of request data:

{ 
  "apiKey" : "your-api-key-123",
  "clientId" : "your-client-id-123",
  "email" : [ "****@gmail.com" ],
  "requestTime" : 1329128188409,
  "sha" : "02bfe70541d3907cf487f26dc2665b184b1221a7"
}

Contacts by email address (regardless of the owner) import by calling:
http://www.salesmanago.pl/api/contact/listAll

Available fields in the request listAll method:

Field Max. length Description
owner* 255 contact’s owner (SALESmanago user account email)
contactId* 255 array of identifiers for the imported contacts (** up to 50 contacts at once **)

Request result is returned as JSON structure identical with the previous request.

Import based on contact’s ID

Sample structure of request data:

{ 
  "apiKey" : "your-api-key-123",
  "clientId" : "your-client-id-123",
  "email" : [ "****@gmail.com" ],
  "requestTime" : 1329128188409,
  "sha" : "02bfe70541d3907cf487f26dc2665b184b1221a7"
}

Contacts by email address (regardless of the owner) import by calling:
http://www.salesmanago.pl/api/contact/listAllById

Available fields in the request listAllById method:

Field Max. length Description
owner* 255 contact’s owner (SALESmanago user account email)
contactId* 255 array of identifiers for the imported contacts (** up to 50 contacts at once **)

Request result is returned as JSON structure identical with the previous request.

Importing the list of recently modified contacts

Sample structure of request data:

{ 
    "apiKey" : "your-api-key-123",
    "clientId" : "your-client-id-123",
    "requestTime":1362056589362,
    "sha":"64656d78b80d5df677700dabd363e1ffe51b59a7",
    "owner":"admin@vendor.pl",
    "from":1359673200361,
    "to":1363042800362
}

We import contacts using the below method:
http://www.salesmanago.pl/api/contact/modifiedContacts

Available fields in the request modifiedContacts method:

Field Max. length Description
owner* 255 contact’s owner (SALESmanago user account email)
from* 255 beginning range of modification dates
to* 255 ending range of modification dates

Result of request:

{
    "success":true,
    "message":[],
    "modifiedContacts":[
        {
            "id":"f66ca32b-c117-4b52-b3b8-863be077e710",
            "email":"aleksander.***@benhauer.pl"
        },
        {
            "id":"426e0ef8-675f-47fc-8ea8-745ac1706904",
            "email":"konrad.***@salesmanago.pl"
        },
        {
            "id":"1775d70e-cd61-4dd6-983a-64f067486adf",
            "email":"marek.***@salesmanago.pl"
        }
    ]
}

As a result of request we receive:

success – truth value informing about the result of request (successful/not successful) message – array of additional information enabling error identification
modifiedContacts – contacts modified in the given time frame
  id – contact’s ID
  email – contact’s email

Import list of recently created contacts

Sample request data structure:

{
  "clientId": "h4jsu6pc5txybj04",
  "apiKey": "qwetreryuii",
  "requestTime": 1481531514145,
  "sha": "abcd509ac6eb0c460455c74ccc66867955a5333d",
  "owner": "admin@vendor.pl",
  "from": 1478939514146,
  "to": 1481531514132
}

We import contacts using the below method:
http://www.salesmanago.pl/api/contact/createdContacts

Available fields in the request createdContacts method:

Field Max. length Description
owner* 255 contact’s owner (SALESmanago user account email)
from* 255 beginning range of modification dates
to* 255 ending range of modification dates

Result of request:

{
  "success": true,
  "message": [],
  "createdContacts": [
    {
      "id": "c3477890-3da7-4010-96d0-45aab0586b7f",
      "email": "***@gmail.com"
    }
  ]
}

As a result of request we receive:

success – truth value informing about the result of request (successful/not successful) message – array of additional information enabling error identification
createdContacts – contacts modified in the given time frame
  id – contact’s ID
  email – contact’s email

Contacts’ activity

Sample structure of request data:

{ 
  "apiKey" : "your-api-key-123",
  "clientId" : "your-client-id-123",
  "requestTime" : 1329128188409,
  "sha" : "02bfe70541d3907cf487f26dc2665b184b1221a7",
  "from":1328050800504,
  "to":1333231200504,
  "allVisits":true,
  "ipDetails":true
}

We can obtain information about the activity of contacts in a given period from SALESmanago. To do this we use the below method: http://www.salesmanago.pl/api/contact/recentActivity

Available fields in the request recentActivity method:

Field Max. length Description
owner* 255 contact’s owner (SALESmanago user account email)
from* 255 beginning date (timestamp, i.e. time in milliseconds that passed from midnight 1 January 1970 UTC)
to* 255 ending date (timestamp, i.e. time in milliseconds that passed from midnight 1 January 1970 UTC)
allVisits true/false if set at true, SALESmanago will return in visit details information about all pages opened by the customer in a given period
ipDetails true/false if set at true, SALESmanago will return in visit details additional information searched for client IP

Result of request:

{
    "success":true,
    "message":[],
    "monitoredContacts": 12300,
    "totalContacts":234000,
    "recentActivities": {
        "from":1328050800504,
        "to":1333231200504,
        "customers":[{
        "uuid": 191615173,
            "host": "salesmanago.pl",
            "time":1330239675000,
            "duration":22000,
            "visitSource":"REFERRER",
            "visitSourceHost":null,
            "visitSourceKeywords":"localhost",
            "visitSourceDetails":null,
            "visitScore":120,
            "client":"Benhauer Sp. z o.o. Sp. K. - Konrad Pawlus",
            "email":"konradpawlus@gmail.com",
            "contactId":"1d8cba47-f4b2-4efe-8250-5bdab5346628",
        "url": "/test.htm",
            "ipOrganization": "TP SA",
            "vid": 7,
            "cid": null,
            "ipDetails": {
                "ip" : "123.123.123.123",
                "countryCode" : "PL",
                "countryName" : "Poland",
                "regionCode" : "77",
                "regionName" : "Malopolskie",
                "city" : "Cracow",
                "postalCode" : "",
                "latitude" : "50.083300",
                "longitude" : "19.916700",
                "isp" : "Neostrada Plus",
                "organization" : "Neostrada Plus"
             },
                "contactVisits": [{ "conversationIntId": null,
                "host": "10.10.10.10",
                "time": 1328050810504,
                "duration": null,
                "visitSource": "NEXT",
                "visitSourceHost": "salesmanago.pl",
                "visitSourceKeywords": null,
                "visitScore": 1,
                "url": "/test.htm",
                "location": null,
                "minutesAgo": 8,
                "daysAgo": 1
            }]}],
        "partners":["... jw. ..."],
        "prospects":["... jw. ..."],
        "anonymous":["... jw. ..."],
        "visitSources": [
            {"label": "example.com", "value": 123}, 
            {"label": "other", "value": 1432}
        ],
        "visitSearchTerms": [
            {"label": "tell me google", "value": 123}, 
            {"label": "what is life?", "value": 1432},
        ],
        "visitStats": [
            {
                "date": 1330239675000, 
                "partnersVisits": 123,
                "prospectsVisits": 234,
                "customersVisits": 456,
                "otherVisits": 4321
            }
        ]
    }
}

As a result of request we receive:

success – truth value informing about the result of request (successful/not successful)
message – array of additional information enabling error identification
monitoredContacts – the number of monitored contacts
totalContacts – the number of all contacts recentActivity – structure consisting from three arrays of visits: customers, partners, prospective customers (prospects)
from – beginning date
to – ending date
customers – list of customer visits  partners – list of partner visits  prospects – list of prospective customer visits
anonymous – list of anonymous visits
 element of client’s visit in lists:   host – page that was visited
  time – time of visit
  duration – duration
  visitSource – visit resources
  visitSourceKeywords – key words
  visitSourceHost – host
  visitSourceDetails – visit details
  visitScore – number of points
  url – URL of visited page
  client – client name
  email – client’s email
  contactId – unique client’s ID
  vid - vendor ID
  cid - contact ID
  ipDetails – details decoded from client’s IP
   ip – IP number    countryCode – ISO code of the country (2-digits)
   countryName – country name    regionCode – region code
   regionName – region name
   city – city/town
   postalCode – zip code    latitude – latitude
   longitude – longitude
   isp – ISP name    organization – organization’s name   contactVisits – contact’s visits    conversationIntId – conversation ID    time – time of visit
   duration – duration    visitSource – visit’s resources    visitSourceKeywords – key words
   visitSourceHost – host
   visitScore – number of points
   url – URL of visited page
   location – visit location    minutesAgo – the number of minutes since visits    daysAgo – the number of days since visits  visitSources – list of visit sources:   label – source name   value – number of visits
visitSearchTerms – list of searched terms:   label – searched term
  value – number of visits
visitStats – visit statistics from the last week:
  date – time of visit
  partnersVisits – the number of partner’s visits   prospectsVisits – the number of prospective customers’ visits
  customersVisits – the number of customers’ visits   otherVisits – the number of other visits

Paged contact list

Sample structure of request data:

{
  "clientId": "clientId",
  "apiKey": "api-key-123",
  "requestTime": 1481206581347,
  "sha": "5333dabcd509455c74ccc6ac6eb0c4606867955a",
  "owner": "admin@vendor.pl",
  "page": 0,
  "size": 100
}

The request returns a paged contact list. We use the below method:
http://www.salesmanago.pl/api/contact/paginatedContactList

Available fields in the request paginatedContactList method:

Field Max. length Description
owner* 255 contact’s owner (SALESmanago user account email)
page* - current page
size* - the number of returned lines (up to 1000)

Result of request:

{
  "success": true,
  "message": [],
  "contacts": ["..."],
  "hasMore": true
}

success – truth value informing about the result of request (successful/not successful)
message – array of additional information enabling error identification
contacts – array of contacts on the structure identical to the method contact/list
hasMore - boolean value that indicates if there is another party contacts

Changing the main owner contact

Sample request data structure:

{
   "clientId": "your-client-id-123",
   "apiKey": "your-api-key-123",
   "requestTime": "1327056031488",
   "sha": "2aa3927a7dee8c2a712adb5375f5fa36dd8fe00c",
   "contact": "contact@email.com",
   "newOwner": "newOwner@email.com"
}

We set new owner using the below method:
http://www.salesmanago.pl/api/contact/setMainOwner

Available fields in the request recentActivity method:

Field Max. length Description
contact* 255 contact’s email
newOwner* 255 new contact’s owner (SALESmanago user account email)

Result of request:

{
   "success": true,
   "message": []
}

As a result of request we receive:

success – truth value informing about the result of request (successful/not successful) message – array of additional information enabling error identification

API - Managing discount coupons

Redemption of coupon for contact

Sample request data structure:

{ 
 "apiKey" : "your-api-key-123",
 "clientId" : "your-client-id-123",
 "sha" : "08924f45afc2e4fb8b652c53cdb493c7ddb846a1",
 "requestTime" : 1327059355361,
 "email" : "test@salesmanago.pl",
 "coupon" : "SAMPLE-COUPON-123"
}

You can redeem coupon via API method call:
http://www.salesmanago.pl/api/contact/useContactCoupon

Available fields in the request useContactCoupon method:

Field Max. length Description
email* 255 contact email
coupon* 255 coupon name

Result of method call is used/error depending on success or failure of given call.

Adding coupon for contact

Sample request data structure:

{
  "clientId": "client-id",
  "apiKey": "api-key-123",
  "requestTime": 1481528920123,
  "sha": "abcd5460455c09ac6eb0c74cc333dc66867955a5",
  "name": "Coupon123",
  "email": "***@gmail.com",
  "length": 7,
  "valid": 1484207320124,
  "coupon": "couponVal"
}

You can add coupon via API method call:
http://www.salesmanago.pl/api/contact/addContactCoupon

Available fields in the request addContactCoupon method:

Field Max. length Description
email* 255 contact email
name* 255 coupon name
length - length of coupon in case of automatic generation
valid* 255 expiration date of coupon
coupon 255 optional value of coupon, if the field is empty, the coupon will be generated

Result of request:

{
  "success": true,
  "message": [],
  "result": null,
  "coupon": "couponVal"
}

As a result of request we receive:

success – truth value informing about the result of request (successful/not successful)
message – array of additional information enabling error identification
result - result of request
coupon - created coupon value

API - Managing mailing list (Opt-in / Opt-out)

Unsubscribing a contact from the list (Opt-out)

Sample structure of request data:

{ 
  "apiKey" : "your-api-key-123",
  "clientId" : "your-client-id-123",
  "requestTime" : 1329128188409,
  "sha" : "02bfe70541d3907cf487f26dc2665b184b1221a7",
  "email" : "john.doe@email.com"
}

We unsubscribe a contact from the mailing list using the below method:
http://www.salesmanago.pl/api/contact/optout

Available fields in the request optout method:

Field Max. length Description
email* 255 contact’s email

Result of request:

{ 
  "contactId" : "21c252a6-6de0-436b-bae8-9d0142363266",
  "message" : [  ],
  "success" : true 
}

As a result of request we receive:

success – truth value informing about the result of request (successful/not successful)
contactId – unique ID of the updated or newly added contact
message – array of additional information enabling error identification

Adding a contact to the list (Opt-in)

Sample structure of request data:

{ 
  "apiKey" : "your-api-key-123",
  "clientId" : "your-client-id-123",
  "requestTime" : 1329128188409,
  "sha" : "02bfe70541d3907cf487f26dc2665b184b1221a7",
  "email" : "konrad-test-optout-1@konri.com"
}

We add a contact to the mailing list using the below method:
http://www.salesmanago.pl/api/contact/optin

Available fields in the request optin method:

Field Max. length Description
email* 255 contact’s email

Result of request:

{ 
  "contactId" : "21c252a6-6de0-436b-bae8-9d0142363266",
  "message" : [  ],
  "success" : true 
}

As a result of request we receive:

success – truth value informing about the result of request (successful/not successful) contactId – unique ID of the updated or newly added contact message – array of additional information enabling error identification

Mass unsubscribing contacts from the list (Opt-out)

Sample structure of request data:

{ 
  "apiKey" : "your-api-key-123",
  "clientId" : "your-client-id-123",
  "requestTime" : 1329128188409,
  "sha" : "02bfe70541d3907cf487f26dc2665b184b1221a7",
  "emails" : [
    "batchtest2@benhauer.pl", "batchtest1@benhauer.pl"
  ]
}

We unsubscribe mass contacts from the mailing list using the method below:
http://www.salesmanago.pl/api/contact/batchoptout

Available fields in the request batchoptout method:

Field Max. length Description
emails* 255/email array of contacts email

Result of request:

{
  "success":true, 
  "message":[], 
  "contactIds":{
    "batchtest2@benhauer.pl":"b257d328-2a95-41ce-915a-94b4274e6c29",
    "batchtest1@benhauer.pl":"bf4d6c03-1ca2-4b3f-8131-c28829236b02"
  }
}

As a result of request we receive:

success – truth value informing about the result of request (successful/not successful)
contactIds – unique IDs of updated contacts
message – array of additional information enabling error identification

Adding mass contacts to the list (Opt-in)

Sample structure of request data:

{ 
  "apiKey" : "your-api-key-123",
  "clientId" : "your-client-id-123",
  "requestTime" : 1329128188409,
  "sha" : "02bfe70541d3907cf487f26dc2665b184b1221a7",
  "emails" : [
    "batchtest2@benhauer.pl", "batchtest1@benhauer.pl"
  ]
}

We add mass contacts to the mailing list by using the below method:
http://www.salesmanago.pl/api/contact/batchoptin

Available fields in the request batchoptin method:

Field Max. length Description
emails* 255/email array of contacts email

Result of request:

{
  "success":true, 
  "message":[], 
  "contactIds":{
    "batchtest2@benhauer.pl":"b257d328-2a95-41ce-915a-94b4274e6c29",
    "batchtest1@benhauer.pl":"bf4d6c03-1ca2-4b3f-8131-c28829236b02"
  }
}

As a result of request we receive:

success – truth value informing about the result of request (successful/not successful)
contactIds – unique IDs of updated contacts
message – array of additional information enabling error identification

Adding a contact to the phone list (Opt-in phone)

Sample structure of request data:

{ 
  "apiKey" : "your-api-key-123",
  "clientId" : "your-client-id-123",
  "requestTime" : 1329128188409,
  "sha" : "02bfe70541d3907cf487f26dc2665b184b1221a7",
  "email" : "konrad-test-optout-1@konri.com"
}

We add a contact by using below method:
http://www.salesmanago.pl/api/contact/phoneoptin

Available fields in the request phoneoptin method:

Field Max. length Description
email* 255 contact’s email

Result of request:

{ 
  "contactId" : "21c252a6-6de0-436b-bae8-9d0142363266",
  "message" : [  ],
  "success" : true 
}

As a result of request we receive:

success – truth value informing about the result of request (successful/not successful)
contactId – unique ID of the updated or newly added contact message – array of additional information enabling error identification

Unsubscribing a contact from the phone list (Opt-out phone)

Sample structure of request data:

{ 
  "apiKey" : "your-api-key-123",
  "clientId" : "your-client-id-123",
  "requestTime" : 1329128188409,
  "sha" : "02bfe70541d3907cf487f26dc2665b184b1221a7",
  "email" : "john.doe@email.com"
}

We unsubscribe a contact from the list using below method:
http://www.salesmanago.pl/api/contact/phoneoptout

Available fields in the request phoneoptout method:

Field Max. length Description
email* 255 contact’s email

Result of request:

{ 
  "contactId" : "21c252a6-6de0-436b-bae8-9d0142363266",
  "message" : [  ],
  "success" : true 
}

As a result of request we receive:

success – truth value informing about the result of request (successful/not successful)
contactId – unique ID of the updated or newly added contact
message – array of additional information enabling error identification

API - External events

In SALESmanago it is possible to record external events for a contact, not necessarily connected with their online activity. For example: the purchase of a product in a stationary shop, visit to a place, etc.

Adding an external event

Sample structure of request recording a new event:

{
    "clientId":"your-client-id-123",
    "apiKey":"your-api-key-123",
    "requestTime":1356180568127,
    "sha":"3e4ec39722326150aae60f41e038d1def4450f46",
    "owner":"admin@vendor.pl",
    "email":"test@benhauer.com",
    "contactEvent":{
        "date":1356180568153,
        "description":"Purchase card \"Super Bonus\"",
        "products":"p01, p02",
        "location":"Krupnicza 3, Kraków",
        "value":1234.43,
        "contactExtEventType":"PURCHASE",
        "detail1":"C.ID: *** *** 234",
        "detail2":"Payment by credit card",
        "detail3":null,
        "externalId":"A-123123123"
    }
}

In order to add an event we use the below method:
http://www.salesmanago.pl/api/contact/addContactExtEvent

Available fields in the request addContactExtEvent method:

Field Max. length Description
owner* 255 contact’s owner (SALESmanago user account email)
email*/contactId* 255 contact’s email for which the event is added
date* timestamp event date (timestamp, i.e. time in milliseconds that passed from midnight 1 January 1970 UTC)
description 2048 event description
products 512 optional list of products separated by commas
location 255 optional event location, eg. a shop’s or place’s address
value (19 2) optional event value eg. amount spent (max 19 digits + 2 after the decimal point)
contactExtEventType* 255 event type, possible values: PURCHASE, CART, VISIT, PHONE_CALL, OTHER
detail1-20 255/detal optional event details
externalId 255 optional event ID, eg. ID from a teller system, etc.

Result of request:

{ 
  "eventId":"7284e317-3bb6-4505-afbe-55b9a101339a",
  "message" : [  ],
  "success" : true 
}

As a result of request we receive:

success – truth value informing about the result of request (successful/not successful)
eventId – ID of added event
message – array of additional information enabling error identification

Modifying external events

Sample structure of request modifying an event:

{
    "clientId":"your-client-id-123",
    "apiKey":"your-api-key-123",
    "requestTime":1356180568127,
    "sha":"3e4ec39722326150aae60f41e038d1def4450f46",
    "owner":"admin@vendor.pl",
    "contactEvent":{
        "eventId":"7284e317-3bb6-4505-afbe-55b9a101339a",
        "date":1356180568153,
        "description":"Purchase card \"Super Bonus\"",
        "products":"p01, p02",
        "location":"Krupnicza 3, Krakow",
        "value":1234.43,
        "contactExtEventType":"PURCHASE",
        "detail1":"C.ID: *** *** 234",
        "detail2":"Payment by credit card",
        "detail3":null,
        "externalId":"A-123123123"
    }
}

In order to modify an event we use the below method:
http://www.salesmanago.pl/api/contact/updateContactExtEvent

Available fields in the request updateContactExtEvent method:

Field Max. length Description
owner* 255 contact’s owner (SALESmanago user account email)
eventId* 255 event ID (returned by the add method)
date* timestamp event date (timestamp, i.e. time in milliseconds that passed from midnight 1 January 1970 UTC)
description 2048 event description
products 512 optional list of products separated with commas
location 255 optional event location, e.g. a shop’s or place’s address
value (19 2) optional event value e.g. the amount spent (max 19 digits + 2 after the decimal point)
contactExtEventType* 255 event type, allowed values: PURCHASE, CART, VISIT, PHONE_CALL, OTHER
detail1-20 255/detal optional event details,
externalId 255 optional event ID, e.g. ID from a teller system, etc.

Result of request:

{ 
  "eventId":"7284e317-3bb6-4505-afbe-55b9a101339a",
  "message" : [  ],
  "success" : true 
}

As a result of request we receive:

success – truth value informing about the result of request (successful/not successful)
eventId – ID of added event
message – array of additional information enabling error identification

Removing an event

Sample structure of request removing an event:

{
    "clientId":"your-client-id-123",
    "apiKey":"your-api-key-123",
    "requestTime":1356180568127,
    "sha":"3e4ec39722326150aae60f41e038d1def4450f46",
    "owner":"admin@vendor.pl",
    "eventId":"7284e317-3bb6-4505-afbe-55b9a101339a"
}

In order to remove an event we use the below method:
http://www.salesmanago.pl/api/contact/deleteContactExtEvent

Available fields in the request deleteContactExtEvent method:

Field Max. length Description
owner* 255 contact’s owner (SALESmanago user account email)
eventId* 255 event ID (returned by the add method)

Result of request:

{
    "success":true,
    "message":[],
    "result":"deleted"
}

As a result of request we receive:

success – truth value informing about the result of request (successful/not successful)
result – result of request
message – array of additional information enabling error identification

Integration of external events, like basket

most optimal method is transferring the whole basket content with one request – separating products with commas or semicolons. It is also possible to once send the addContactExtEvent method by recording the returned result (eventId) – and with the next adding only update the product list. (using the updateContactExtEvent method and the above mentioned eventId).

The request addContactExtEvent may be made in two ways:
  - using the email address,
  - using the contactId (value from the smclient cookie that can be taken with e.g. javascript).

These two ways cannot be used jointly - we also cannot add external events for unidentified contacts.

Additionally the script, when not monitored (no smclient and email) - adds products to the basket:

Such products must then be kept at the shop’s side (e.g. in session) - and straight after contact identification products must be transferred to salesmanago using the addContactExtEvent method.

Monitoring AJAX/JavaScript events

Except for visits, SALESmanago also makes it possible to record JavaScript events – like e.g. bookmark openings or file downloads. In order to record an external event, the SALESmanago method must be called in the JavaScript script on our website:

smEvent(eventName)

where:

eventName is the name of event e.g. “details-deposit”, “details-loan”.

such an event must be joined with certain elements that are to be monitored, e.g.:

<a href="download.pdf" onclick="smEvent('PDF-download');return true;">download</a>

API - Tags management

Import of tag list

Sample structure of request data:

{ 
  "apiKey" : "your-api-key-123",
  "clientId" : "your-client-id-123",
  "showSystemTags" : true,
  "owner" : "admin@vendor.pl",
  "requestTime" : 1329128188409,
  "sha" : "02bfe70541d3907cf487f26dc2665b184b1221a7"
}

Tags are imported using the below method:
http://www.salesmanago.pl/api/contact/tags

Available fields in the request tags method:

Field Max. length Description
owner* 255 contact’s owner (SALESmanago user account email)
showSystemTags* true/false when set at true, SALESmanago will also return system tags

Result of request:

{ 
  "tags" : [ { "tag" : "ADmanago",
              "numberOfTagged" : 12
       } ],
  "message" : [  ],
  "success" : true
}

As a result of request we receive:

tags – imported tags
  tag – tag name
  numberOfTagged – the number of tagged contacts
success – truth value informing about the result of request (successful/not successful)
message – array of additional information enabling error identification

API - email messages

Sending email

Sample structure of request data:

{
    "clientId": "o7gslwlc8o1e2ry1",
    "apiKey": "-8773203084919279780-2743038323156910252",
    "requestTime": 1391167514795,
    "sha": "184db1df6ec4893a1f50809bf8d1a4fe88cde4dc",
    "user": "admin@finplan.pl",
    "emailId": "029c504e-193a-43f2-84c7-3b7ee3c4438c",
    "html" : "<html><body>email-html-content</body></html>",
    "contacts": [
        {
        "addresseeType" : "EMAIL",
            "email": "user1@example.com",
            "contactId": null,
            "properties": [
                {
                    "name": "ext_detal_01",
                    "value": "value_01"
                },
                {
                    "name": "ext_detal_02",
                    "value": "value_02"
                }
            ],
        "tags" : null
        },
        {
        "addresseeType" : "EMAIL",
            "email": "user2@example.com",
            "contactId": null,
            "properties": [
                {
                    "name": "ext_detal_03",
                    "value": "value_03"
                },
                {
                    "name": "ext_detal_04",
                    "value": "value_04"
                }
            ],
        "tags" : null
        }
        ],
    "excludeContacts": [
        {
        "addresseeType" : "EMAIL",
            "email": "user3@example.com",
            "contactId": null,
        "tags" : null
        }
    ],
    "date": 1391167515515,
    "subject": "Sample API subject",
    "campaign": "monitor_me_in_ga",
    "immediate" : false,
    "rule" : false
}

In order to send an email through API the below method should be used:
http://www.salesmanago.pl/api/email/send

Available fields in the request send method:

Field Max. length Description
emailId* 255 message ID from the SALESmanago system
date* 255 mailing date
subject* 2048 mailing subject (if not provided – a default will be used)
campaign* 255 campaign for tracing Google UTM (if not provided – a default will be used)
html* - html email content
contacts* - array of contacts emails should be sent to
addresseeType 255 addressing emails type ( EMAIL, CONTACT_ID, TAGS)
email/contactId/tags 255 optional – e-mail address of contact, its ID or tags
properties 255 additional attributes of email messages defined by the user. It is not advised to use Polish signs and spaces in names, but it is allowed. In an e-mail message the construction $cst.nazwaParametru$ should be used in order to substitute the proper value.
excludeContacts - array of contacts emails should not be sent to
addresseeType 255 addressing emails type ( EMAIL, CONTACT_ID, TAGS)
email/contactId/tags 255 ptional – e-mail address of contact, its ID or tags
immediate true/false attributing a true value will cause immediate dispatch of mail
rule true/false attributing a true value will cause message mark as rule email

Result of request:

{
    "success": true,
    "message": ["Emails are scheduled to send."]
}

As a result of request we receive:

success – truth value informing about the result of request (successful/not successful) message – array of additional information enabling error identification

Adding email messages

Sample structure of request data:

{
  "clientId": "h4jsu6pc5txybj04",
  "apiKey": "qwetreryuii",
  "requestTime": 1481543324302,
  "sha": "abcd509ac6eb0c460455c74ccc66867955a5333d",
  "user": "admin@vendor.pl",
  "name": "Email name",
  "campaign": "Campaign name",
  "subject": "Email subject",
  "contentBoxMap": {
    "customField": "fieldValue"
  },
  "shared": true,
  "dynamic": true,
  "emailAccountId": "1d35aaaa-8dac-423f-8325-f767816fb096",
  "templateId": "e88a18f9-3dfe-4cf8-937e-960c3d217c97"
}

To add email messages, use the method:
http://www.salesmanago.pl/api/email/addEmail

Available fields in the request addEmail method:

Field Max. length Description
user* 255 user’s email
name* 255 template name
campaign 255 campaign name
subject* 2048 email message subject
contentBoxMap 255/box map containing the names and values of specific fields
shared true/false boolean value that indicates whether the template is shared
dynamic true/false boolean value that indicates whether the template is dynamic
emailAccountId* 255 email account ID
templateId* 255 email template ID

Result of request:

{
  "success": true,
  "message": [],
  "emailId": "cf55c3d5-9e1c-4f87-be2d-450bef5e3dd4"
}

As a result of request we receive:

success – truth value informing about the result of request (successful/not successful)
message – array of additional information enabling error identification emailId - created email ID

Adding or modifying email message

Sample structure of request data:

{
  "clientId": "h4jsu6pc5txybj04",
  "apiKey": "qwetreryuii",
  "requestTime": 1481543324302,
  "sha": "abcd509ac6eb0c460455c74ccc66867955a5333d",
  "user": "admin@vendor.pl",
  "name": "Email name",
  "campaign": "Campaign name",
  "subject": "Email subject",
  "contentBoxMap": {
    "customField": "fieldValue"
  },
  "shared": true,
  "dynamic": true,
  "emailAccountId": "1d35aaaa-8dac-423f-8325-f767816fb096",
  "templateId": "e88a18f9-3dfe-4cf8-937e-960c3d217c97"
}

To add or modify email messages use the method:
http://www.salesmanago.pl/api/email/upsertByName

Available fields in the request upsertByName method:

Field Max. length Description
user* 255 user’s email
name* 255 template name
campaign 255 campaign name
subject* 2048 email message subject
contentBoxMap 255/box map containing the names and values of specific fields
shared true/false boolean value that indicates whether the template is shared
dynamic true/false boolean value that indicates whether the template is dynamic
emailAccountId* 255 email account ID
templateId* 255 email template ID

Result of request:

{
  "success": true,
  "message": [],
  "emailId": "cf55c3d5-9e1c-4f87-be2d-450bef5e3dd4"
}

As a result of request we receive:

success – truth value informing about the result of request (successful/not successful)
message – array of additional information enabling error identification
templateId - created / modified email message ID

Adding email templates

Sample structure of request data:

{
  "clientId": "client-id-123",
  "apiKey": "api-key-123",
  "requestTime": 1481536595205,
  "sha": "a533abcd509ac6ebccc660c460455c748679553d",
  "user": "admin@vendor.pl",
  "name": "Email Template name",
  "emailContent": "html email content",
  "shared": true,
  "dynamic": true,
  "parametrized": true,
  "fromUrl": true,
  "titleUrl": true,
  "urlTemplate": "www.example.pl/template.html",
  "customFields": "customField"
}

To add an email template use the method:
http://www.salesmanago.pl/api/email/addTemplate

Available fields in the request addTemplate method:

Field Max. length Description
user* 255 user’s email
name* 255 template name
emailContent* - html email content
shared true/false boolean value that indicates whether the template is shared
dynamic true/false boolean value that indicates whether the template is dynamic
parametrized true/false boolean value that indicates whether the template accepts parameters before sending
fromUrl true/false boolean value that indicates whether the template is to use a template from the link html
titleUrl true/false boolean value that indicates whether the template is to use the title of the e-mail link
urlTemplate 255 template url
customFields 255 additional template fields

Result of request:

{
  "success": true,
  "message": [],
  "templateId": "f69b9e97-dd34-468c-add2-e8efc09e7bb7"
}

As a result of request we receive:

success – truth value informing about the result of request (successful/not successful)
message – array of additional information enabling error identification templateId - created email template ID

Adding or modifying email templates

Sample structure of request data:

{
  "clientId": "client-id-123",
  "apiKey": "api-key-123",
  "requestTime": 1481536595205,
  "sha": "a533abcd509ac6ebccc660c460455c748679553d",
  "user": "admin@vendor.pl",
  "name": "Email Template name",
  "emailContent": "html email content",
  "shared": true,
  "dynamic": true,
  "parametrized": true,
  "fromUrl": true,
  "titleUrl": true,
  "urlTemplate": "www.example.pl/template.html",
  "customFields": "customField"
}

To add or modify a template email use the method:
http://www.salesmanago.pl/api/email/upsertTemplate

Available fields in the request upsertTemplate method:

Field Max. length Description
user* 255 user’s email
name* 255 template name
emailContent* - html email content
shared true/false boolean value that indicates whether the template is shared
dynamic true/false boolean value that indicates whether the template is dynamic
parametrized true/false boolean value that indicates whether the template accepts parameters before sending
fromUrl true/false boolean value that indicates whether the template is to use a template from the link html
titleUrl true/false boolean value that indicates whether the template is to use the title of the e-mail link
urlTemplate 255 template url
customFields 255 additional template fields

Result of request:

{
  "success": true,
  "message": [],
  "templateId": "f69b9e97-dd34-468c-add2-e8efc09e7bb7"
}

As a result of request we receive:

success – truth value informing about the result of request (successful/not successful)
message – array of additional information enabling error identification
templateId - created email template ID

Downloading conversation statistics

Sample structure of request data:

{
  "clientId": "client-id-123",
  "apiKey": "api-key-123",
  "requestTime": 1481545641901,
  "sha": "abcd50460455c79ac6eb0c4ccc66867955a5333d",
  "conversationId": "dc4ef436-3d1b-4a85-b061-77236b1766e1"
}

To download conversation statistics use the method:
http://www.salesmanago.pl/api/email/conversationStatistics

Available fields in the request conversationStatistics method:

Field Max. length Description
conversationId* 255 conversation ID

Result of request:

{
  "success": true,
  "message": [],
  "conversationId": "dc4ef436-3d1b-4a85-b061-77236b1766e1",
  "sentMessage": 1,
  "openMessage": 2,
  "uniqueOpen": 1,
  "clickedMessage": 0,
  "uniqueClicks": 0,
  "errorMessage": 0,
  "listedMessage": 0,
  "softBounce": 0,
  "hardBounce": 0
}

As a result of request we receive:

success – truth value informing about the result of request (successful/not successful) message – array of additional information enabling error identification
conversationId - conversation ID
sentMessage - send messages within mailing openMessage - open messages
uniqueOpen - unique open
clickedMessage - clicked messages
errorMessage - error messages listedMessage - number of opt-out contacts softBounce - soft bounce hardBounce - hard bounce

Sending your subscription confirmation

Sample structure of request data:

{
    "clientId":"vgqgnhyxnk46va7s",
    "apiKey":"api_key_code",
    "requestTime":1488803352992,
    "sha":"0fd94b6bcf9d97dc79df6951575ebdeaf4617c96",
    "emai":"test@test.com",
    "owner":"test@owner.pl",
    "tag":"Tag",
    "lang":"PL",
    "apiDoubleOptInEmailTemplateId":"",
    "apiDoubleOptInEmailAccountId":"",
    "apiDoubleOptInEmailSubject":""
}

To send a confirmation email through API, the method below should be used:
http://www.salesmanago.pl/api/email/sendConfirmation

The main aim of sendConfirmation method is to send email which confirms subscription (known as doubleOptIn). The message will be send to contacts that exist and do not have status Optln. Optional criterion is to add a tag, which must have an email for confirmation purpose.

Available fields in the request sendConfirmation method:

Field Max. length Description
email* 255 contact’s email
owner* 255 contact’s owner email
tag 255 optional parameter defining tag which must have email contacts for confirmation purpose
lang 255 language of sent email
apiDoubleOptInEmailTemplateId 255 optional template ID for double-opt-in,
apiDoubleOptInEmailAccountId 255 optional email account ID for double-opt-in,
apiDoubleOptInEmailSubject 255 optional email subject for double-opt-in

Result of request:

{
    "success":true,  
    "message":["Contact exists - confirmation email sent"],  
    "contactExists":true,  
    "contactId":"4850e968-45fa-4910-bf8c-0d2cfdbaa42b"
}

As a result of request we receive:

success – truth value informing about the result of request (successful/not successful) message – array of additional information enabling error identification
contactExists – boolean value informing whether a particular contact exists in a database contactId – contact ID

API - Automation Rules

Adding automation rules

Sample structure of request data:

{   
    "async": true,
    "clientId": "YOUR_CLIENT_ID",
    "apiKey": "YOUR_API_SECRET",
    "requestTime": 1410858306889,
    "sha": "bfdbca9ebd70710ab27a74088a44c98ccb4f2247",
    "owner": "john.doe@email.com",
    "shared": true,
    "active": true,
    "deleted": false,
    "delayConditionsCheck": true,
    "delayConditionsValue": 1,
    "delayConditionsPeriod": "DAY",
    "name": "Rule insert api test05",
    "maxFireTimes": 111,
    "minFireInterval": 2,
    "checkAgain": true,
    "checkAgainAfter": 2,
    "events": [
        {
            "eventType": "CONTACT_WAS_TAGGED_WITH",
            "properties": {"tag": "sampleTag234"}
        },
        {
            "eventType": "NEW_EXT_EVENT",
            "properties": {
                "checkValue": "true",
                "newExtEventType": "CART",
                "extEventAddedCondition1_Type": ">",
                "extEventAddedCondition1_Value": "80"
            }
        }
    ],
    "conditions": [],
    "actions": [
        {
            "actionType": "ADD_NOTE",
            "properties": {
                "addNotePrivate": "true",
                "addNoteText": "note sample text 001"
            }
        }
    ]
}

Adding, updating and deleting the task of contact is possible through the single method:
http://www.salesmanago.pl/api/rule/insert

Available fields in the request updateTask method:

Field Max. length Description
owner* 255 account of rule owner
shared* 255 is the rule active
deleted* 255 has the rule been removed
delayConditionsCheck* 255 delay checking the conditions
delayConditionsValue* 255 delay checking the conditions – value
delayConditionsPeriod* 255 delay checking the conditions – period
name* 255 rule name
maxFireTimes* 255 maximum number of rule fires
minFireInterval* 255 minimum interval between rule fires (days)
checkAgain* 255 checking rules again
checkAgainAfter* 255 checking rules again – number of days
events* - events
eventType* 255 event type (CONTACT_SCORE, CONTACT_OPENED_EMAIL, CONTACT_CLICKED_EMAIL, INCOMING_EMAIL_SUBJECT, CONTACT_WAS_TAGGED_WITH, CONTACT_VISITED_URL, CONTACT_REACHED_SALES_STAGE, DETAILS_ADDED, DETAILS_MODIFIED, SMS_DELIVERED, TAG_REACHED_SCORE, SMS_REPLIED, STAGE_SCORE, CONTACT_FROM_PHRASE, CONTACT_FROM_SOURCE, NEW_OWNER, NEW_EXT_EVENT, VMS_DELIVERED, SOCIAL_EVENT, PROXY_EMAIL, OPTED_OUT, CONTACT_ADDED)
properties* 255/detal event details,
conditions* - conditions
conditionType* 255 condition type (CONTACT_SCORE, CONTACT_OPENED_EMAIL, CONTACT_CLICKED_EMAIL, INCOMING_EMAIL_SUBJECT, CONTACT_WAS_TAGGED_WITH, CONTACT_TAGGED_WITH, CONTACT_VISITED_URL, CONTACT_REACHED_SALES_STAGE, SMS_DELIVERED, TAG_REACHED_SCORE, SMS_REPLIED, STAGE_SCORE, CONTACT_FROM_PHRASE, CONTACT_FROM_SOURCE, CONTACT_HAS_DETAIL, CONTACT_HAS_OWNER, CONTACT_HAS_EXT_EVENT, VMS_DELIVERED, SOCIAL_EVENT, CONTACT_RECEIVED_NUMBER_OF_EMAILS, PROXY_EMAIL_SUBJECT, USED_EASYPACK24, CONTACT_STATE)
properties* 255 condition details
actions* 255 actions
actionType* 255 action type (SEND_EMAIL, SEND_ALERT, ADD_TAGS, DELETE_TAGS, SCORE_TAG, SCORE, ADD_TO_SALES_FUNNEL, SEND_SMS, RUN_RULE, ADD_OWNER, SEND_VMS, ADD_NOTE, ADD_TASK, CHANGE_STATE, GENERATE_COUPON, RTB_ADGROUP, DELETE_CONTACT_FROM_FUNNEL, ADD_MODIFY_DETAIL, DISPLAY_BANNER)
actionType* 255 action details

Result of request:

{ 
  "ruleId" : "rule-Id-123",
  "message" : [  ],
  "success" : true
}

As a result of request we receive:

rule – rule ID which applies to action
success – truth value informing about the result of request (successful/not successful)
message – array of additional information enabling error identification

API - Tasks

Contacts’ tasks

Sample structure of request data:

{ 
  "apiKey" : "your-api-key-123",
  "clientId" : "your-client-id-123",
  "requestTime" : 1329128188409,
  "sha" : "02bfe70541d3907cf487f26dc2665b184b1221a7",
  "finished" : false,
  "smContactTaskReq" : { 
      "contactEmail" : "john.doe@email.com",
      "id" : "task-id-123",
      "note" : "Call to client",
      "date" : 1359673200361,
      "cc" : "john.doe@email.com",
      "reminder" : "_30_MIN"
    }
}

Adding, updating and removing a contact’s task is done with the use of one method:
http://www.salesmanago.pl/api/contact/updateTask

Available fields in the request updateTask method:

Field Max. length Description
finished* true/false attributing a true value will cause deletion of task and then only an additional ID parameter is required. When adding and updating a task, a false value should be attributed
contactEmail* 255 contact email to which the task will be assigned
id* 255 task ID
note 2048 task note
date* 255 date of task execution
cc 255 list of emails where a reminder will be sent (emails should be separated with commas)
reminder* 255 reminder about the task. It defines when the reminder should be sent. Allowed values: 15_MIN – 15 minutes before, 30_MIN – 30 minutes before, 1_HOUR – an hour before, 12_HOUR – 12 hours before, 1_DAY – 1 day before, 1_WEEK – 1 week before

Result of request:

{ 
  "taskId" : "task-Id-123",
  "message" : [  ],
  "success" : true
}

As a result of request we receive:

taskId – id of task that the action concerns
success – truth value informing about the result of request (successful/not successful)
message – array of additional information enabling error identification

API - Other

Temporary authorization

Sample structure of request data:

{ 
  "userName" : "admin@vendor.pl",
  "password" : "****"
}

The SALESmanago system makes it possible to obtain a temporary token using the username and password. To do this the following method should be called:
http://www.salesmanago.pl/api/contact/authorise

Available fields in the request authorise method:

Field Max. length Description
userName* 255 user name
password* 255 password

Result of request:

{ 
  "token" : "b426c6663d844305b2539e9bc27b75dc",
  "clientId" : "your-client-id-123",
  "message" : [  ],
  "success" : true 
}

As a result of request we receive:

success – truth value informing about the result of request (successful/not successful)
token – is a temporary token that may be used for authorization in exchange for apiSecret clientId – client ID required for further operations
message – array of additional information enabling error identification