Method Reference

Synerise SDK Lifecycle


Initialization


Initializes Synerise SDK.

Declared In

lib/main/Synerise.js

Builder Parameters

Parameter Type Mandatory Default Description
withBaseUrl string no - Synerise API custom environment base URL
withClientApiKey string yes - Synerise Client API Key
withDebugModeEnabled boolean no - Specifies if console logs are enabled/disabled
withCrashHandlingEnabled boolean no - Specifies if crash handling is enabled/disabled
withSettings object no - Settings that have to be set before Synerise is initialized

Return Value

There is no return value.

Example

Synerise.Initializer()
	.withBaseUrl("YOUR_API_BASE_URL")
	.withClientApiKey('YOUR_CLIENT_API_KEY')
	.withDebugModeEnabled(true)
	.withCrashHandlingEnabled(true)
	.withSettings({
		sdk: {
			enabled: true
	})
	.init();

Client Authentication


Register Client account


Register a new Client with email, password, and optional data.

This method requires the ClientAccountRegisterContext object with a Client's email, password, and optional data. Omitted fields are not modified.

Depending on backend configuration, the account may require activation. For details, see user registration.

Do NOT allow to sign in again (or sign up) when a user is already signed in. Sign the user out first.

Do not create multiple instances nor call this method multiple times before execution. This method is a global operation and does not require authorization.

Declared In

lib/main/modules/ClientModule.js

lib/classes/models/Client/ClientAccountRegisterContext.js

Method

Synerise.Client.registerAccount(context, onSuccess, onError)

Parameters

Parameter Type Mandatory Default Description
context ClientAccountRegisterContext yes - Object with the Client's email, password, and other optional data
onSuccess function no - Callback function to be executed when the operation finishes successfully
onError function no - Callback function to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

let email = "EMAIL";
let password = "PASSWORD";

let context = new ClientAccountRegisterContext(email, password); context.phone = '123456789'; context.customId = '000111';

context.firstName = 'John'; context.lastName = 'Rise'; context.sex = ClientSex.Male;

context.company = 'Synerise'; context.address = 'Marszałkowska'; context.city = 'Warszawa'; context.province = 'Mazowieckie'; context.zipCode = '00-000'; context.countryCode = 'PL';

context.agreements = new ClientAgreements({ email: true, sms: false, push: true, bluetooth: false, rfid: true, wifi: false });

context.attributes = { ATTRIBUTE_1: 'ATTRIBUTE_1' } context.tags = ['TAG_1', 'TAG_2']

Synerise.Client.registerAccount(context, function() { // success }, function(error) { // failure });

Confirm Client account


Confirm a Client account with the confirmation token.

The Method returns the HTTP 400 status code if the account is already confirmed or 404 if the account does not exist. This method is a global operation and does not require authorization.

Declared In

lib/main/modules/ClientModule.js

Method

Synerise.Client.confirmAccount(token, onSuccess, onError)

Parameters

Parameter Type Mandatory Default Description
token string yes - Client's token provided by email
onSuccess function no - Callback function to be executed when the operation finishes successfully
onError function no - Callback function to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

Synerise.Client.confirmAccount("TOKEN", function() {
	// success
}, function(error) {
	// failure
});

Activate Client account


Activate a Client with email. This method requires the Client's email. This method is a global operation and does not require authorization.

Declared In

lib/main/modules/ClientModule.js

Method

Synerise.Client.activateAccount(email, onSuccess, onError)

Parameters

Parameter Type Mandatory Default Description
email string yes - Client's email
onSuccess function no - Callback function to be executed when the operation finishes successfully
onError function no - Callback function to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

Synerise.Client.activateAccount("EMAIL", function() {
	// success
}, function(error) {
	// failure
});

Sign in a Client


Sign in a client in order to obtain the JWT token, which can be used in subsequent requests.

The token is valid for 1 hour (unless configured otherwise in Synerise) and the SDK will refresh the token before each call if it is expiring soon (but still valid).

The method requires valid and non-null email and password. Device ID is optional.

Do NOT allow to sign in again (or sign up) when a user is already signed in. Sign the user out first.

Do not create multiple instances nor call this method multiple times before execution. This method is a global operation and does not require authorization.

Declared In

lib/main/modules/ClientModule.js

Method

Synerise.Client.signIn(email, password, onSuccess, onError)

Parameters

Parameter Type Mandatory Default Description
email string yes - Client's email
password string yes - Client's password
onSuccess function no - Callback function to be executed when the operation finishes successfully
onError function no - Callback function to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

let email = "EMAIL";
let password = "PASSWORD";

Synerise.Client.signIn(email, password, function() { // success }, function(error) { // failure });

Check if a Client is signed in


Check if a Client is signed in (their token is authorized).

Declared In

lib/main/modules/ClientModule.js

Method

Synerise.Client.isSignedIn()

Return Value

true if the user is signed in, otherwise return false.

Example

let isSignedIn = Synerise.Client.isSignedIn();

Sign out a Client


Signing a Client out clears the Client's JWT token.

Declared In

lib/main/modules/ClientModule.js

Method

Synerise.Client.signOut()

Return Value

There is no return value.

Example

Synerise.Client.signOut();

Authenticate by OAuth


Use this method to authenticate by OAuth.

Returns the HTTP 401 status code if the provided access token and/or API Key is invalid.

Declared In

lib/main/modules/ClientModule.js

lib/classes/models/Client/ClientOAuthAuthenticationContext.js

Method

Synerise.Client.authenticateByOAuth(accessToken, clientOAuthContext, onSuccess, onError)

Parameters

Parameter Type Mandatory Default Description
accessToken string yes - Token retrieved from OAuth authorization
clientOAuthContext ClientOAuthAuthenticationContext yes - Object that stores authId, agreements, and attributes
onSuccess function no - Callback function to be executed when the operation finishes successfully
onError function no - Callback function to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

Synerise.Client.authenticateByOAuth(token, context, function() {
   // success
}, function(error) {
   // failure
})

Authenticate by Facebook


Use this method to authenticate by Facebook.

Returns the HTTP 401 status code if the provided Facebook token and/or API Key is invalid.

Declared In

lib/main/modules/ClientModule.js

lib/classes/models/Client/ClientFacebookAuthenticationContext.js

Method

Synerise.Client.authenticateByFacebook(facebookToken, clientFacebookAuthenticationContext, onSuccess, onError)

Parameters

Parameter Type Mandatory Default Description
facebookToken string yes - Token retrieved from Facebook SDK
clientFacebookAuthenticationContext ClientFacebookAuthenticationContext yes - Object that stores authId, agreements, and attributes
onSuccess function no - Callback function to be executed when the operation finishes successfully
onError function no - Callback function to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

Synerise.Client.authenticateByFacebook(token, clientFacebookAuthenticationContext, function() {
    // success
}, function(error) {
    // failure
})

Authenticate by Facebook if registered


Use this method to authenticate by Facebook.

Returns the HTTP 401 status code if there is no account associated with the provided Facebook token.

Declared In

lib/main/modules/ClientModule.js

Method

Synerise.Client.authenticateByFacebookIfRegistered(facebookToken, authID, onSuccess, onError)

Parameters

Parameter Type Mandatory Default Description
facebookToken string yes - Token retrieved from Facebook SDK
authID string no - Optional authId to decrease the number of UUID refreshes
onSuccess function no - Callback function to be executed when the operation finishes successfully
onError function no - Callback function to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

Synerise.Client.authenticateByFacebookIfRegistered(facebookToken, authID, function() {
    // success
}, function(error) {
    // failure
})

Change client API key


Use this method to change API key dynamically.

Declared In

lib/main/Synerise.js

Method

Synerise.changeClientApiKey(apiKey)

Parameters

Parameter Type Mandatory Default Description
apiKey string yes - New apiKey

Return Value

There is no return value.

Example

Synerise.changeClientApiKey(apiKey);

Client Account Management


Get Client account information


Use this method to get a Client's account information.

Declared In

lib/main/modules/ClientModule.js

lib/classes/models/Client/ClientAccountInformation.js

Method

Synerise.Client.getAccount(onSuccess, onError)

Parameters

Parameter Type Mandatory Default Description
onSuccess function no - Callback function to be executed when the operation finishes successfully
onError function no - Callback function to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

Synerise.Client.getAccount(function(clientAccountInformation) {
	//success
}, function(error) {
	//failure
});

Update Client account information


Use this method to update a Client's account information.

This method requires the ClientAccountUpdateContext object with the Client's account information. Omitted fields are not modified.

Declared In

lib/main/modules/ClientModule.js

lib/classes/models/Client/ClientAccountUpdateContext.js

Method

Synerise.Client.updateAccount(context, onSuccess, onError)

Parameters

Parameter Type Mandatory Default Description
context ClientAccountUpdateContext yes - Object with the Client's update data
onSuccess function no - Callback function to be executed when the operation finishes successfully
onError function no - Callback function to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

let context = new ClientAccountUpdateContext();
context.phone = '123456789';
context.customId = '000111';

context.firstName = 'John'; context.lastName = 'Rise'; context.displayName = 'John Rise'; context.sex = ClientSex.Male; context.birthDate = '1989-08-03';

context.company = 'Synerise'; context.address = 'Marszałkowska'; context.city = 'Warszawa'; context.province = 'Mazowieckie'; context.zipCode = '00-000'; context.countryCode = '+48';

context.agreements = new ClientAgreements({ email: true, sms: true, push: true, bluetooth: true, rfid: true, wifi: true });

context.attributes = { ATTRIBUTE_1: 'ATTRIBUTE_1' } context.tags = ['TAG_1', 'TAG_2']

Synerise.Client.updateAccount(context, function() { // success }, function(error) { // failure })

Change Client's account password


Use this method to change a Client's password.

Returns the HTTP 403 status code if the provided old password is invalid.

Declared In

lib/main/modules/ClientModule.js

Method

Synerise.Client.changePassword(newPassword, oldPassword, onSuccess, onError)

Parameters

Parameter Type Mandatory Default Description
newPassword string yes - Client's new password
oldPassword string yes - Client's old password
onSuccess function no - Callback function to be executed when the operation finishes successfully
onError function no - Callback function to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

let newPassword = "NEW_PASSWORD";
let oldPassword = "OLD_PASSWORD";

Synerise.Client.changePassword(newPassword, oldPassword, function() { // success }, function(error) { // failure });

Request password reset for Client account


Request a Client's password reset with email. The Client will receive a token at the provided email address. That token is then used for Synerise.Client.confirmResetPassword.

This method requires the Client's email. This method is a global operation and does not require authorization.

Declared In

lib/main/modules/ClientModule.js

Method

Client.requestPasswordReset(email, onSuccess, onError)

Parameters

Parameter Type Mandatory Default Description
email string yes - Client's email
onSuccess function no - Callback function to be executed when the operation finishes successfully
onError function no - Callback function to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

Synerise.Client.requestPasswordReset("EMAIL", function() {
  // success
}, function(error) {
  // failure
});

Confirm password reset for Client account


Confirm a Client's password reset with the new password and token provided by Synerise.Client.requestPasswordReset.

This method requires the Client's new password and the confirmation token received by e-mail.

This method is a global operation and does not require authorization.

Declared In

lib/main/modules/ClientModule.js

Method

Synerise.Client.confirmPasswordReset(password, token, onSuccess, onError)

Parameters

Parameter Type Mandatory Default Description
password string yes - Client's new password
token string yes - Client's token provided by email
onSuccess function no - Callback function to be executed when the operation finishes successfully
onError function no - Callback function to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

Synerise.Client.confirmPasswordReset("PASSWORD", "TOKEN", function() {
  // success
}, function(error) {
  // failure
});

Request email change for Client account


Use this method to request a Client's email change.

Returns the HTTP 403 status code if the provided UUID does not exist or the password is invalid.

Declared In

lib/main/modules/ClientModule.js

Method

Synerise.Client.requestEmailChange(email, password, onSuccess, onError)

Parameters

Parameter Type Mandatory Default Description
email string yes - Client's new email
password string yes - Client's password
onSuccess function no - Callback function to be executed when the operation finishes successfully
onError function no - Callback function to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

Synerise.Client.requestEmailChange("EMAIL", "PASSWORD", function() {
  // success
}, function(error) {
  // failure
});

Confirm email change for Client account


Use this method to confirm an email change.

Returns the HTTP 403 status code if the provided token is invalid.

Declared In

lib/main/modules/ClientModule.js

Method

Synerise.Client.confirmEmailChange(token, newsletterAgreement, onSuccess, onError)

Parameters

Parameter Type Mandatory Default Description
token string yes - Client's token provided by email
newsletterAgreement boolean yes - Agreement for newsletters to the provided email
onSuccess function no - Callback function to be executed when the operation finishes successfully
onError function no - Callback function to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

Synerise.Client.confirmEmailChange("TOKEN", true, function() {
  // success
}, function(error) {
  // failure
});

Request phone update on Client account


Use this method to request a phone number update. This action requires additional validation by PIN code.

Returns the HTTP 403 status code if the provided UUID does not exist or the password is invalid.

Declared In

lib/main/modules/ClientModule.js

Method

Synerise.Client.requestPhoneUpdate(phone, onSuccess, onError)

Parameters

Parameter Type Mandatory Default Description
phone string yes - Client's new phone number
onSuccess function no - Callback function to be executed when the operation finishes successfully
onError function no - Callback function to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

Synerise.Client.requestPhoneUpdate("PHONE", function() {
  // success
}, function(error) {
  // failure
});

Confirm phone update on Client account


Use this method to confirm a phone number update. This action requires the new phone number and confirmation code as parameters.

Returns the HTTP 403 status code if the provided UUID does not exist or the password is invalid.

Declared In

lib/main/modules/ClientModule.js

Method

Synerise.Client.confirmPhoneUpdate(phone, confirmationCode, smsAgreement, onSuccess, onError)

Parameters

Parameter Type Mandatory Default Description
phone string yes - New phone number
confirmationCode string yes - Client's confirmation code received by phone
smsAgreement boolean yes - Agreement for SMS marketing to the provided number
onSuccess function no - Callback function to be executed when the operation finishes successfully
onError function no - Callback function to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

Synerise.Client.confirmPhoneUpdate("PHONE", "CONFIRMATION_CODE", true, function() {
  // success
}, function(error) {
  // failure
});

Delete Client account


Use this method to delete a Client's account.

HTTP 403 status code is returned if the provided password is invalid.

Declared In

lib/main/modules/ClientModule.js

Method

Synerise.Client.deleteAccount(password, onSuccess, onError)

Parameters

Parameter Type Mandatory Default Description
password string yes - Client's password
onSuccess function no - Callback function to be executed when the operation finishes successfully
onError function no - Callback function to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

let password = "PASSWORD";

Synerise.Client.deleteAccount(password, function(token) { // success }, function(error) { // failure });

Recognize anonymous user


Method to recognize anonymous users and save personal information in their CRM entries.

Declared In

lib/main/modules/ClientModule.js

Method

Synerise.Client.recognizeAnonymous(email, customIdentify, parameters)

Parameters

Parameter Type Mandatory Default Description
email string no - Client's email
customIdentify string no - Client's custom identifier
parameters object no - Client's custom parameters

Return Value

There is no return value.

Example

Synerise.Client.recognizeAnonymous("EMAIL", "CUSTOM_IDENTIFY", {
	"PARAM_1": "PARAM_1"
});

Client Session


Retrieve Client token


Retrieves the Client's current, active token.

An error is returned when the Client is not logged in or the token has expired and cannot be refreshed.

Declared In

lib/main/modules/ClientModule.js

lib/classes/Token/Token.js

Method

Synerise.Client.retrieveToken(onSuccess, onError)

Parameters

Parameter Type Mandatory Default Description
onSuccess function no - Callback function to be executed when the operation finishes successfully
onError function no - Callback function to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

Synerise.Client.retrieveToken(function(token) {
  // success
}, function(error) {
  // failure
});

Get current Client UUID


Retrieve the Client's current UUID.

Declared In

lib/main/modules/ClientModule.js

Method

Synerise.Client.getUUID()

Return Value

Method returns the Client's UUID as string.

Example

let uuid = Synerise.Client.getUUID();

Regenerate Client UUID


Regenerate the UUID and clear the authentication token, login session, custom email, and custom identifier.

This operation works only if the Client is anonymous.

Declared In

lib/main/modules/ClientModule.js

Method

Synerise.Client.regenerateUUID()

Return Value

true if the Current Client is anonymous and the operation succeed, false otherwise.

Example

Synerise.Client.regenerateUUID();

Push Notifications


Register for Push Notifications


Use this method to pass the Firebase Token to Synerise for notifications.

Declared In

lib/main/modules/NotificationsModule.js

Method

Synerise.Notifications.registerForNotifications(registrationToken, mobileAgreement, onSuccess, onError)

Parameters

Parameter Type Mandatory Default Description
registrationToken string yes - Firebase Token
mobileAgreement boolean yes - Agreement (consent) for mobile push campaigns
onSuccess function no - Callback function to be executed when the operation finishes successfully
onError function no - Callback function to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

// If you integrate Firebase Messaging in the native part of app
Synerise.Notifications.setListener({
	onRegistrationToken: function(registrationToken) {
		Synerise.Notifications.registerForNotifications(registrationToken, true, function(){
			//success
		}, function() {
			//failure
		});
	},
	onNotification: function(payload) {
		//...
	}
	//...
	//other listener's methods
});
// Or if you want to use Firebase Messaging in react native
Synerise.Notifications.registerForNotifications("YOUR_FIREBASE_TOKEN", true, function(){
	//success
}, function() {
	//failure
});

Check if Push Notification is from Synerise


Verifies that a notification was sent by Synerise.

Declared In

lib/main/modules/NotificationsModule.js

Method

Synerise.Notifications.isSyneriseNotification(payload)

Parameters

Parameter Type Mandatory Default Description
payload object no - Notification's key-value data object

Return Value

There is no return value.

Example

Synerise.Notifications.setListener({
	onNotification: function(payload) {
		if (Synerise.Notifications.isSyneriseNotification(payload)) {
			Synerise.Notifications.handleNotification(payload);
		}
	}
	//...
	//other listener's methods
});

Check if Push Notification is a Simple Push Campaign


Verifies that a notification was sent by Synerise and that it's a Simple Push.

Declared In

lib/main/modules/NotificationsModule.js

Method

Synerise.Notifications.isSyneriseSimplePush(payload)

Parameters

Parameter Type Mandatory Default Description
payload object no - Notification's key-value data object

Return Value

There is no return value.

Example

Synerise.Notifications.setListener({
	onNotification: function(payload) {
		if (Synerise.Notifications.isSyneriseSimplePush(payload)) {
			Synerise.Notifications.handleNotification(payload);
		}
	}
	//...
	//other listener's methods
});

Check if Push Notification is a Banner Campaign


Verifies that a notification was sent by Synerise and that it's a Banner.

Declared In

lib/main/modules/NotificationsModule.js

Method

Synerise.Notifications.isSyneriseBanner(payload)

Parameters

Parameter Type Mandatory Default Description
payload object no - Notification's key-value data object

Return Value

There is no return value.

Example

Synerise.Notifications.setListener({
	onNotification: function(payload) {
		if (Synerise.Notifications.isSyneriseBanner(payload)) {
			Synerise.Notifications.handleNotification(payload);
		}
	}
	//...
	//other listener's methods
});

Check if Push Notification is a Silent Command


Verifies that a notification was sent by Synerise and that it's a Silent Command.

Declared In

lib/main/modules/NotificationsModule.js

Method

Synerise.Notifications.isSilentCommand(payload)

Parameters

Parameter Type Mandatory Default Description
payload object no - Notification's key-value data object

Return Value

There is no return value.

Example

Synerise.Notifications.setListener({
	onNotification: function(payload) {
		if (Synerise.Notifications.isSilentCommand(payload)) {
			Synerise.Notifications.handleNotification(payload);
		}
	}
	//...
	//other listener's methods
});

Check if Push Notification is a Silent SDK Command


Verifies that a notification was sent by Synerise and that it's a Silent SDK Command.

Declared In

lib/main/modules/NotificationsModule.js

Method

Synerise.Notifications.isSilentSDKCommand(payload)

Parameters

Parameter Type Mandatory Default Description
payload object no - Notification's key-value data object

Return Value

There is no return value.

Example

Synerise.Notifications.setListener({
	onNotification: function(payload) {
		if (Synerise.Notifications.isSilentSDKCommand(payload)) {
			Synerise.Notifications.handleNotification(payload);
		}
	}
	//...
	//other listener's methods
});

Handle Synerise Push Notification


Handles the notification payload and starts activity.

Declared In

lib/main/modules/NotificationsModule.js

Method

Synerise.Notifications.handleNotification(payload)

Parameters

Parameter Type Mandatory Default Description
payload object no - Notification's key-value data object

Return Value

There is no return value.

Example

Synerise.Notifications.setListener({
	onNotification: function(payload) {
		Synerise.Notifications.handleNotification(payload);
	}
	//...
	//other listener's methods
});

Tracking


Set Custom Identifier for events


You can pass a custom identifier to match your users in our CRM. The custom identifier is sent in the parameters of every event.

Declared In

lib/main/modules/TrackerModule.js

Method

Synerise.Tracker.setCustomIdentifier(identifier)

Parameters

Parameter Type Mandatory Default Description
identifier string yes - Client's custom identifier

Return Value

There is no return value.

Example

Synerise.Tracker.setCustomIdentifier("CUSTOM_IDENTIFIER");

Set Custom Email for events


You can pass a custom email to match your users in our CRM. The custom email is sent in the parameters of every event.

Declared In

lib/main/modules/TrackerModule.js

Method

Synerise.Tracker.setCustomEmail(customEmail)

Parameters

Parameter Type Mandatory Default Description
email string yes - Client's custom email

Return Value

There is no return value.

Example

Synerise.Tracker.setCustomEmail("CUSTOM_EMAIL");

Send event


Use this method to send an event.

The tracker caches and enqueues all your events locally, so they all will be sent eventually.

Declared In

lib/main/modules/TrackerModule.js

lib/classes/events/Event.js
lib/classes/events/CustomEvent.js

Method

Synerise.Tracker.send(event)

Parameters

Parameter Type Mandatory Default Description
event Event yes - Event object

Return Value

There is no return value.

Example

let parameters = {
  "name": "John",
  "surname": "Rise",
  "company": "Synerise",
  "age": 25,
  "lastOrder": 380.50
};

let event = new CustomEvent("My label that will be visible on Activity Stream", "my.action", parameters); Synerise.Tracker.send(event);

Flush events from Tracker


Forces sending the events from the queue to the server. This method is a global operation and does not require authorization.

Declared In

lib/main/modules/TrackerModule.js

Method

Synerise.Tracker.flushEvents(onSuccess)

Parameters

Parameter Type Mandatory Default Description
onSuccess function no - Callback function to be executed when the operation finishes successfully

Return Value

There is no return value.

Example

Synerise.Tracker.flushEvents(function() {
	// success
});

Content


Get document


Method generating document assigned to a slug

Declared In

lib/main/modules/ContentModule.js

Method

Synerise.Content.getDocument(slug, onSuccess, onError)

Parameters

Parameter Type Mandatory Default Description
slug string yes - Name of the slug
onSuccess function no - Callback function to be executed when the operation finishes successfully
onError function no - Callback function to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

Synerise.Content.getDocument('slugName', function(document) {
	//success
}, function(error) {
	//failure
})

Get documents


Method generating all documents assigned to a schema

Declared In

lib/main/modules/ContentModule.js

Method

Synerise.Content.getDocuments(documentsApiQuery, onSuccess, onError)

Parameters

Parameter Type Mandatory Default Description
documentsApiQuery DocumentsApiQuery yes - object for configuration of the query parameters
onSuccess function no - Callback function to be executed when the operation finishes successfully
onError function no - Callback function to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

let documentsApiQuery = new DocumentsApiQuery(DocumentsApiQueryType.SCHEMA, 'type', '1.0.0')
Synerise.Content.getDocuments(documentsApiQuery, function(documents) {
     //success
}, function(error) {
     //failure
 })

Get recommendations


Method returning list of recommendations assigned to a slug

Declared In

lib/main/modules/ContentModule.js

Method

Synerise.Content.getRecommendations(recommendationOptions, onSuccess, onError)

Parameters

Parameter Type Mandatory Default Description
recommendationOptions RecommendationOptions yes - object for configuration of the query parameters
onSuccess function no - Callback function to be executed when the operation finishes successfully
onError function no - Callback function to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

let recommendationOptions = new RecommendationOptions()
recommendationOptions.productID = 'productID'
recommendationOptions.slug = 'slugName'
Synerise.Content.getRecommendations(recommendationOptions, function(recommendationResponse) {
      //success
},function(error) {
      //failure
});

Promotions


Get all promotions of a Client


Use this method to get all available promotions that are defined for this Client.

Declared In

lib/main/modules/PromotionsModule.js

Method

Synerise.Promotions.getAllPromotions(onSuccess, onError)

Parameters

Parameter Type Mandatory Default Description
onSuccess function no - Callback function to be executed when the operation finishes successfully
onError function no - Callback function to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

Synerise.Promotions.getAllPromotions(function(promotionResponse) {
	//success
}, function(error) {
	//failure
});

Get promotions with query parameters


Use this method to get promotions that match the parameters defined in an API query.

Declared In

lib/main/modules/PromotionsModule.js

lib/classes/api_queries/PromotionsApiQuery.js

Method

Synerise.Promotions.getPromotions(apiQuery, onSuccess, onError)

Parameters

Parameter Type Mandatory Default Description
apiQuery PromotionsApiQuery yes - Object that stores all query parameters
onSuccess function no - Callback function to be executed when the operation finishes successfully
onError function no - Callback function to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

let apiQuery = new PromotionsApiQuery();
apiQuery.statuses = [
	PromotionStatus.Active
];
apiQuery.types = [
	PromotionType.General
]
apiQuery.sorting = [
	{ property: PromotionSortingKey.CreatedAt, order: ApiQuerySortingOrder.Ascending }
];

apiQuery.limit = 120; apiQuery.page = 2; apiQuery.includeMeta = true;

Synerise.Promotions.getPromotions(apiQuery, function(promotionResponse) { //success }, function(error) { //failure });

Get promotion by UUID


Use this method to get the promotion with the specified UUID.

Declared In

lib/main/modules/PromotionsModule.js

Method

Synerise.Promotions.getPromotionByUUID(uuid, onSuccess, onError)

Parameters

Parameter Type Mandatory Default Description
uuid String yes - UUID of the promotion
onSuccess function no - Callback function to be executed when the operation finishes successfully
onError function no - Callback function to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

Synerise.Promotions.getPromotionByUUID("UUID", function(promotion) {
	//success
}, function(error) {
	//failure
});

Get promotion by code


Use this method to get the promotion with the specified code.

Declared In

lib/main/modules/PromotionsModule.js

Method

Synerise.Promotions.getPromotionByCode(code, onSuccess, onError)

Parameters

Parameter Type Mandatory Default Description
code String true - Code of the promotion
onSuccess function no - Callback function to be executed when the operation finishes successfully
onError function no - Callback function to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

Synerise.Promotions.getPromotionByCode("CODE", function(promotion) {
	//success
}, function(error) {
	//failure
});

Activate promotion by UUID


Use this method to activate the promotion with the specified UUID.

Declared In

lib/main/modules/PromotionsModule.js

Method

Synerise.Promotions.activatePromotionByUUID(uuid, onSuccess, onError)

Parameters

Parameter Type Mandatory Default Description
uuid String yes - UUID of the promotion
onSuccess function no - Callback function to be executed when the operation finishes successfully
onError function no - Callback function to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

Synerise.Promotions.activatePromotionByUUID("UUID", function() {
	//success
}, function(error) {
	//failure
});

Activate promotion by code


Use this method to activate the promotion with the specified code.

Declared In

lib/main/modules/PromotionsModule.js

Method

Synerise.Promotions.activatePromotionByCode(code, onSuccess, onError)

Parameters

Parameter Type Mandatory Default Description
code String yes - Code of the promotion
onSuccess function no - Callback function to be executed when the operation finishes successfully
onError function no - Callback function to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

Synerise.Promotions.activatePromotionByCode("CODE", function() {
	//success
}, function(error) {
	//failure
});

Deactivate promotion by UUID


Use this method to de-activate the promotion with the specified UUID.

Declared In

lib/main/modules/PromotionsModule.js

Method

Synerise.Promotions.deactivatePromotionByUUID(uuid, onSuccess, onError)

Parameters

Parameter Type Mandatory Default Description
uuid String yes - UUID of the promotion
onSuccess function no - Callback function to be executed when the operation finishes successfully
onError function no - Callback function to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

Synerise.Promotions.deactivatePromotionByUUID("UUID", function() {
	//success
}, function(error) {
	//failure
});

Deactivate promotion by code


Use this method to de-activate the promotion with the specified code.

Declared In

lib/main/modules/PromotionsModule.js

Method

Synerise.Promotions.deactivatePromotionByCode(code, onSuccess, onError)

Parameters

Parameter Type Mandatory Default Description
code String yes - Code of the promotion
onSuccess function no - Callback function to be executed when the operation finishes successfully
onError function no - Callback function to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

Synerise.Promotions.deactivatePromotionByCode("CODE", function() {
	//success
}, function(error) {
	//failure
});

Vouchers


Get or assign voucher


Use this method to get a voucher code only once or assign to the client a voucher from a pool identified by UUID.

Declared In

lib/main/modules/PromotionsModule.js

Method

Synerise.Promotions.getOrAssignVoucher(poolUuid, onSuccess, onError)

Parameters

Parameter Type Mandatory Default Description
poolUuid string yes - Pool's universally unique identifier
onSuccess function no - Callback function to be executed when the operation finishes successfully
onError function no - Callback function to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

Synerise.Promotions.getOrAssignVoucher(poolUuid, function(voucherResponse) {
      // success
  }, function(error) {
      // failure
  })

Assign voucher code


Use this method to assign a voucher from a pool identified by UUID to the client.

Every request returns a different code until the pool is empty.
HTTP 416 status code is returned when the pool is empty.

Declared In

lib/main/modules/PromotionsModule.js

Method

Synerise.Promotions.assignVoucherCode(poolUuid, onSuccess, onError)

Parameters

Parameter Type Mandatory Default Description
poolUuid string yes - Pool's universally unique identifier
onSuccess function no - Callback function to be executed when the operation finishes successfully
onError function no - Callback function to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

Synerise.Promotions.assignVoucherCode(poolUuid, function(voucherResponse) {
      // success
  }, function(error) {
      // failure
  })

Get assigned voucher codes


Use this method to get a client's voucher codes.

Declared In

lib/main/modules/PromotionsModule.js

Method

Synerise.Promotions.getAssignedVoucherCodes(onSuccess, onError)

Parameters

Parameter Type Mandatory Default Description
onSuccess function no - Callback function to be executed when the operation finishes successfully
onError function no - Callback function to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

Synerise.Promotions.getAssignedVoucherCodes(function(voucherCodesResponse) {
	// success
  }, function(error) {
    // failure
  })
😕

We are sorry to hear that

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

😉

Awesome!

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.