CustomerProfiles / Client / put_segment_subscription

put_segment_subscription

CustomerProfiles.Client.put_segment_subscription(**kwargs)

Creates or updates a segment subscription for membership events. When a subscription is created, an initial snapshot is taken and the system begins monitoring for membership changes.

You can optionally set a schedule configuration interval to control how often membership snapshots are run. The interval can be from 1 to 24 hours. If not set, the interval defaults to 24 hours. Scheduled snapshots run on a best-effort basis. If a scheduled snapshot takes longer than the configured interval, the next scheduled run does not start until the in-progress snapshot completes, so a run might be delayed or skipped and is not guaranteed to occur at exactly the requested time.

For Classic segments, membership events are generated from these scheduled snapshots and also in near real-time as profile attribute changes occur. For SQL segments, membership events are generated only from the scheduled snapshots.

See also: AWS API Documentation

Request Syntax

response = client.put_segment_subscription(
    DomainName='string',
    SegmentDefinitionName='string',
    ScheduleConfiguration={
        'Interval': 123,
        'Unit': 'HOURLY'
    }
)
Parameters:
  • DomainName (string) –

    [REQUIRED]

    The unique name of the domain.

  • SegmentDefinitionName (string) –

    [REQUIRED]

    The unique name of the segment definition.

  • ScheduleConfiguration (dict) –

    The optional schedule configuration that controls how often membership snapshots are run. If not provided, the subscription defaults to a 24-hour interval.

    • Interval (integer) – [REQUIRED]

      The interval between scheduled executions.

    • Unit (string) –

      The unit for the interval. The following are valid values:

      • HOURLY: The interval is measured in hours.

Return type:

dict

Returns:

Response Syntax

{
    'Status': 'STARTING'|'RUNNING'|'STOPPED'|'FAILED',
    'ScheduleConfiguration': {
        'Interval': 123,
        'Unit': 'HOURLY'
    },
    'StartedAt': datetime(2015, 1, 1)
}

Response Structure

  • (dict) –

    • Status (string) –

      The current lifecycle status of the subscription. The following are valid values:

      • STARTING: Initial snapshot is in progress.

      • RUNNING: Notifications are active and running.

      • STOPPED: Notifications have been stopped.

      • FAILED: Notifications failed (for example, the Amazon Kinesis data stream became inaccessible).

    • ScheduleConfiguration (dict) –

      The schedule configuration for the subscription, if configured.

      • Interval (integer) –

        The interval between scheduled executions.

      • Unit (string) –

        The unit for the interval. The following are valid values:

        • HOURLY: The interval is measured in hours.

    • StartedAt (datetime) –

      The timestamp of when the subscription was started.

Exceptions

  • CustomerProfiles.Client.exceptions.ResourceNotFoundException

  • CustomerProfiles.Client.exceptions.InternalServerException

  • CustomerProfiles.Client.exceptions.BadRequestException

  • CustomerProfiles.Client.exceptions.ThrottlingException

  • CustomerProfiles.Client.exceptions.AccessDeniedException