Amazon Developer

as

Settings
Sign out
Notifications
Alexa
Amazon Appstore
Ring
AWS
Documentation
Support
Contact Us
My Cases
Get Started
Design and Develop
Publish
Reference
Support

IContentPersonalizationServer

Interface for Content Personalization Server

Methods

setContentEntitlementsHandler()

setContentEntitlementsHandler(contentEntitlementsHandler: IContentEntitlementsHandler): void

Parameters

contentEntitlementsHandler

IContentEntitlementsHandler


setContentEntitlementsHandlerForComponent()

setContentEntitlementsHandlerForComponent(contentEntitlementsHandler: IContentEntitlementsHandler, component: IComponentInstance): void

Sets the handler for specific component that will provide content entitlement data in response to commands.

Parameters

contentEntitlementsHandler

IContentEntitlementsHandler

The handler for commands relating to content entitlement.

component

IComponentInstance

The component instance for which the handler is being set.

Examples

import {
  ContentPersonalizationServer,
  CustomerListType,
  IContentEntitlementsHandler,
  IContentEntitlementsProvider,
  ICustomerListEntriesHandler,
  ...
} from "@amazon-devices/kepler-content-personalization";

...

// Handlers
const contentEntitlementsHandler: IContentEntitlementsHandler = {
  getAllContentEntitlements: (
    contentEntitlementsProvider: IContentEntitlementsProvider,
  ) => {
    contentEntitlementsProvider.addContentEntitlementChunk(<ADD ENTITLEMENTS>);
    contentEntitlementsProvider.commit();
  },
};

...

// Headless service
onStart(componentInstance: IComponentInstance): Promise<void> {
  ContentPersonalizationServer.setContentEntitlementsHandlerForComponent(
    contentEntitlementsHandler,
    componentInstance,
  );

  // Set other handlers here, also for `SubscriptionEntitlementServer`
  ...

  return Promise.resolve();
}


setCustomerListEntriesHandler()

setCustomerListEntriesHandler(customerListEntriesHandler: ICustomerListEntriesHandler): void

Parameters

customerListEntriesHandler

ICustomerListEntriesHandler


setCustomerListEntriesHandlerForComponent()

setCustomerListEntriesHandlerForComponent(customerListEntriesHandler: ICustomerListEntriesHandler, component: IComponentInstance): void

Sets the handler for specific component that will provide customer list entry data in response to commands.

Parameters

customerListEntriesHandler

ICustomerListEntriesHandler

The handler for commands relating to customer lists.

component

IComponentInstance

The component instance for which the handler is being set.

Examples

import {
  ContentPersonalizationServer,
  CustomerListType,
  IContentEntitlementsHandler,
  IContentEntitlementsProvider,
  ICustomerListEntriesHandler,
  ...
} from "@amazon-devices/kepler-content-personalization";

...

// Handlers
const customerListEntriesHandler: ICustomerListEntriesHandler = {
  getAllCustomerListEntries: (
    listType: CustomerListType,
    customerListEntriesProvider: ICustomerListEntriesProvider,
  ) => {
    customerListEntriesProvider.addCustomerListChunk(listType, <ADD LIST ENTRIES>);
    customerListEntriesProvider.commit();
  },
};
...

// Headless service
onStart(componentInstance: IComponentInstance): Promise<void> {
  ContentPersonalizationServer.setCustomerListEntriesHandlerForComponent(
    customerListEntriesHandler,
    componentInstance,
  );

  // Set other handlers here, also for `SubscriptionEntitlementServer`
  ...

  return Promise.resolve();
}


setPlaybackEventsHandler()

setPlaybackEventsHandler(playbackEventsHandler: IPlaybackEventsHandler): void

Parameters

playbackEventsHandler

IPlaybackEventsHandler


setPlaybackEventsHandlerForComponent()

setPlaybackEventsHandlerForComponent(playbackEventsHandler: IPlaybackEventsHandler, component: IComponentInstance): void

Sets the handler for specific component that will provide playback event data in response to commands.

Parameters

playbackEventsHandler

IPlaybackEventsHandler

The handler for commands relating to playback events.

component

IComponentInstance

The component instance for which the handler is being set.

Examples

import {
  ContentPersonalizationServer,
  CustomerListType,
  IContentEntitlementsHandler,
  IContentEntitlementsProvider,
  ICustomerListEntriesHandler,
  ...
} from "@amazon-devices/kepler-content-personalization";

...

// Handlers
const playbackEventsHandler: IPlaybackEventsHandler = {
  getPlaybackEventsSince: (
    sinceTimestamp: Date,
    playbackEventsProvider: IPlaybackEventsProvider,
  ) => {
    playbackEventsProvider.addPlaybackEventChunk(<ADD PLAYBACK EVENTS>);
    playbackEventsProvider.commit();
  },
};
...

// Headless service
onStart(componentInstance: IComponentInstance): Promise<void> {
  ContentPersonalizationServer.setPlaybackEventsHandlerForComponent(
    playbackEventsHandler,
    componentInstance,
  );

  // Set other handlers here, also for `SubscriptionEntitlementServer`
  ...

  return Promise.resolve();
}


reportNewContentInteraction()

reportNewContentInteraction(contentInteraction: IContentInteraction): void

Reports a customer has interacted with content (Liked, disliked, watched trailer, etc..)

Parameters

contentInteraction

IContentInteraction

The content interaction that has occurred.

Examples

const contentInteraction : IContentInteraction = new ContentInteractionBuilder()
  .contentId(
    new ContentIdBuilder()
      .id('content_CDF_ID')
      .idNamespace(ContentIdNamespaces.NAMESPACE_CDF_ID)
      .build(),
  )
  .interactionTimestamp(new Date())
  .contentInteractionType(ContentInteractionType.INGRESS)
  .profileId(
    new ProfileIdBuilder()
      .id('myProfileId1')
      .idNamespace(ProfileIdNamespaces.NAMESPACE_APP_INTERNAL)
      .build(),
  )
  .build();

// Send the event
ContentPersonalizationServer.reportNewContentInteraction(
  contentInteraction,
);


reportNewPlaybackEvent()

reportNewPlaybackEvent(playbackEvent: IPlaybackEvent): void

Reports updates about the customers playback behavior while they are actively in playback.

Parameters

playbackEvent

IPlaybackEvent

The playback event that just occurred on the device.

Examples

const playbackEvent: IPlaybackEvent = new PlaybackEventBuilder()
  .playbackPositionMs(0)
  .playbackState(PlaybackState.PLAYING)
  .durationMs(2000)
  .eventTimestamp(new Date())
  .profileId(
    new ProfileIdBuilder()
      .id('myProfileId')
      .idNamespace(ProfileIdNamespaces.NAMESPACE_APP_INTERNAL)
      .build(),
  )

...

  // For VOD content
  .contentId(
    new ContentIdBuilder()
      .id('content_CDF_ID')
      .idNamespace(ContentIdNamespaces.NAMESPACE_CDF_ID)
      .build(),
  )

...

  // For linear content (preferred)
  .liveStationId(
    new ContentIdBuilder()
      .id('station_GVD')
      .idNamespace(ContentIdNamespaces.NAMESPACE_GVD)
      .build(),
  )

...

  // For linear content (alternative, using channelDescriptor)
  .channelDescriptor(
    new ChannelDescriptorBuilder()
      .majorNumber(0)
      .minorNumber(1)
      .identifier('channelID')
      .build(),
  )

...

  .buildActiveEvent();

// Send the event
ContentPersonalizationServer.reportNewPlaybackEvent(playbackEvent);


reportRefreshedPlaybackEvents()

reportRefreshedPlaybackEvents(): void

Indicates that there are new updates about a customers playback behavior that occurred off-device that can be fetched.

Before using this API, needs to be called.


reportNewCustomerListEntry()

reportNewCustomerListEntry(listType: CustomerListType, entry: ICustomerListEntry): void

Reports that the customer has inserted a new entry into a customer managed list. Only for entries inserted on-device due to customer action. Should be reported at time of insertion.

Parameters

listType

CustomerListType

The type of customer list the entry was inserted into.

entry

ICustomerListEntry

The entry added the customer list.

Examples

const customerListEntry: ICustomerListEntry = new CustomerListEntryBuilder()
  .addedTimestamp(new Date())
  .contentId(
    new ContentIdBuilder()
      .id('content_CDF_ID')
      .idNamespace(ContentIdNamespaces.NAMESPACE_CDF_ID)
      .build(),
  )
  .profileId(
    new ProfileIdBuilder()
      .id('myProfileId1')
      .idNamespace(ProfileIdNamespaces.NAMESPACE_APP_INTERNAL)
      .build(),
  )
  .build();

// Send the event
ContentPersonalizationServer.reportNewCustomerListEntry(
  CustomerListType.WATCHLIST,
  customerListEntry,
);


reportRemovedCustomerListEntry()

reportRemovedCustomerListEntry(listType: CustomerListType, entry: ICustomerListEntry): void

Reports that the customer has removed an entry from a customer managed list. Only for entries removed from on-device due to customer action. Should be reported at time of removal.

Parameters

listType

CustomerListType

The type of customer list the entry was removed from.

entry

ICustomerListEntry

The entry removed from the customer list.

Examples

const customerListEntry: ICustomerListEntry = new CustomerListEntryBuilder()
  .addedTimestamp(new Date("2025-03-17T03:24:00"))
  .contentId(
    new ContentIdBuilder()
      .id('content_CDF_ID')
      .idNamespace(ContentIdNamespaces.NAMESPACE_CDF_ID)
      .build(),
  )
  .profileId(
    new ProfileIdBuilder()
      .id('myProfileId1')
      .idNamespace(ProfileIdNamespaces.NAMESPACE_APP_INTERNAL)
      .build(),
  )
  .build();

// Send the event
ContentPersonalizationServer.reportRemovedCustomerListEntry(
  CustomerListType.WATCHLIST,
  customerListEntry,
);


reportRefreshedCustomerList()

reportRefreshedCustomerList(listType: CustomerListType): void

Indicates that there have been changes to a customer managed list due to off-device actions and a new refreshed version of the customer managed list should be fetched.

Before using this API, needs to be called.

Parameters

listType

CustomerListType

The type of customer list that has changed.


reportNewContentEntitlement()

reportNewContentEntitlement(entitlement: IContentEntitlement): void

Reports that the customer has a new individual content entitlement inserted into their existing content entitlement list. Only for entitlement not already contained in subscriptions. Only for entitlement inserted due to on-device customer action. Should be reported at time of insertion.

Parameters

entitlement

IContentEntitlement

The new enitlement.

Examples

const entitlements: IContentEntitlement = new ContentEntitlementBuilder()
  .acquisitionTimestamp(new Date())
  .contentId(
    new ContentIdBuilder()
    .id('content_CDF_ID')
    .idNamespace(ContentIdNamespaces.NAMESPACE_CDF_ID)
    .build(),
  )
  .entitlementType(EntitlementType.RENTAL)
  .expirationTimestamp(new Date("2025-12-17T03:24:00"))
  .build();
// Send the event
ContentPersonalizationServer.reportNewContentEntitlement(entitlements);


reportRemovedContentEntitlement()

reportRemovedContentEntitlement(entitlement: IContentEntitlement): void

Reports that the customer no longer has a individual content entitlement in their existing content entitlement list. Only for entitlement not contained in subscriptions. Only for entitlement that is no longer valid or expires due to due to on-device action. Should be reported at time of removal.

Parameters

entitlement

IContentEntitlement

The removed enitlement.

Examples

const entitlements: IContentEntitlement = new ContentEntitlementBuilder()
  .acquisitionTimestamp(new Date("2025-03-17T03:24:00"))
  .contentId(
    new ContentIdBuilder()
    .id('content_CDF_ID')
    .idNamespace(ContentIdNamespaces.NAMESPACE_CDF_ID)
    .build(),
  )
  .entitlementType(EntitlementType.RENTAL)
  .expirationTimestamp(new Date("2025-12-17T03:24:00"))
  .build();
// Send the event
ContentPersonalizationServer.reportRemovedContentEntitlement(entitlements);


reportRefreshedContentEntitlements()

reportRefreshedContentEntitlements(): void

Indicates that there have been changes to the individual content entitlement due to off-device actions and a new refreshed list of content entitlement should be fetched.

Before using this API, needs to be called.


Last updated: Aug 02, 2026