Skip to content

SDK API Reference / PersonalizationSDK

Class: PersonalizationSDK

Personalization SDK

Methods

create()

create(parentSegmentId, service): Promise<PersonalizationService>

Create a new personalization service

Parameters

parentSegmentId

string

Parent segment ID

service

PersonalizationService

Service configuration

Returns

Promise<PersonalizationService>

Created service

Throws

When the create operation fails

Example

typescript
const service = await personalization.create('1069944', {
  name: 'My Service',
  trigger_event: 'page_view',
  sections: [...]
});

delete()

delete(parentSegmentId, serviceId): Promise<void>

Delete a personalization service

Parameters

parentSegmentId

string

Parent segment ID

serviceId

string

Service ID

Returns

Promise<void>

Throws

When the delete operation fails

Example

typescript
await personalization.delete('1069944', 'service123');

get()

get(parentSegmentId, serviceId): Promise<PersonalizationService>

Get a specific personalization service

Parameters

parentSegmentId

string

Parent segment ID

serviceId

string

Service ID

Returns

Promise<PersonalizationService>

Personalization service

Throws

When the get operation fails

Example

typescript
const service = await personalization.get('1069944', 'service123');
console.log(service);

list()

list(parentSegmentId): Promise<PersonalizationService[]>

List personalization services for a parent segment

Parameters

parentSegmentId

string

Parent segment ID

Returns

Promise<PersonalizationService[]>

Array of personalization services

Throws

When the list operation fails

Example

typescript
const services = await personalization.list('1069944');
console.log(services);

update()

update(parentSegmentId, serviceId, service): Promise<PersonalizationService>

Update an existing personalization service

Parameters

parentSegmentId

string

Parent segment ID

serviceId

string

Service ID

service

PersonalizationService

Updated service configuration

Returns

Promise<PersonalizationService>

Updated service

Throws

When the update operation fails

Example

typescript
const updated = await personalization.update('1069944', 'service123', {
  name: 'Updated Service',
  ...
});