Skip to content

SDK API Reference / RealtimeSDK

Class: RealtimeSDK

RT 2.0 SDK

Methods

getConfig()

getConfig(parentSegmentId): Promise<RTConfig>

Get RT 2.0 configuration for a parent segment

Parameters

parentSegmentId

string

Parent segment ID

Returns

Promise<RTConfig>

RT configuration

Throws

When RT is not enabled or get operation fails

Example

typescript
const config = await realtime.getConfig('1069944');
console.log(config);

getCurrentConfigVersion()

getCurrentConfigVersion(parentSegmentId): Promise<RealtimeConfigurationVersion>

Get current realtime configuration version for a parent segment

Parameters

parentSegmentId

string

Parent segment ID

Returns

Promise<RealtimeConfigurationVersion>

Current realtime configuration version status

Throws

When the get operation fails

Example

typescript
const version = await realtime.getCurrentConfigVersion('1069944');
console.log(version.status);

getStatus()

getStatus(parentSegmentId): Promise<RTStatus>

Get RT 2.0 status for a parent segment

Parameters

parentSegmentId

string

Parent segment ID

Returns

Promise<RTStatus>

RT status information

Throws

When the get operation fails

Example

typescript
const status = await realtime.getStatus('1069944');
console.log(status.realtime_enabled);

isEnabled()

isEnabled(parentSegmentId): Promise<boolean>

Check if RT 2.0 is enabled for a parent segment

Parameters

parentSegmentId

string

Parent segment ID

Returns

Promise<boolean>

True if RT is enabled, false otherwise


list()

list(): Promise<RTListItem[]>

List parent segments with their RT 2.0 status

Returns

Promise<RTListItem[]>

Array of parent segments with RT status

Throws

When the list operation fails

Example

typescript
const segments = await realtime.list();
console.log(segments.filter(s => s.realtime_enabled));

listJourneys()

listJourneys(parentSegmentId): Promise<RealtimeJourneyListItem[]>

List realtime journeys for a parent segment

Parameters

parentSegmentId

string

Parent segment ID

Returns

Promise<RealtimeJourneyListItem[]>

Array of realtime journeys

Throws

When the list operation fails

Example

typescript
const journeys = await realtime.listJourneys('1069944');
console.log(journeys);

pauseJourney()

pauseJourney(realtimeJourneyId): Promise<RealtimeJourneyListItem>

Pause activations in a realtime journey

Parameters

realtimeJourneyId

string

Realtime journey ID

Returns

Promise<RealtimeJourneyListItem>

Updated realtime journey

Throws

When the pause operation fails

Example

typescript
const journey = await realtime.pauseJourney('12345');
console.log(journey.paused); // true

resumeJourney()

resumeJourney(realtimeJourneyId): Promise<RealtimeJourneyListItem>

Resume activations in a realtime journey

Parameters

realtimeJourneyId

string

Realtime journey ID

Returns

Promise<RealtimeJourneyListItem>

Updated realtime journey

Throws

When the resume operation fails

Example

typescript
const journey = await realtime.resumeJourney('12345');
console.log(journey.paused); // false

updateConfig()

updateConfig(parentSegmentId, config): Promise<RTConfig>

Update RT 2.0 configuration for a parent segment

Parameters

parentSegmentId

string

Parent segment ID

config

RTConfig

RT configuration

Returns

Promise<RTConfig>

Updated configuration

Throws

When the update operation fails

Example

typescript
const updated = await realtime.updateConfig('1069944', config);