Documentation Index
Fetch the complete documentation index at: https://launchdarkly-preview.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Overview
This topic explains how to use the synced segments integration framework capability.About synced segments
In LaunchDarkly, segments are lists of contexts that are used to manage flag targeting behavior in bulk. As a partner, you can use the synced segments integration framework capability to create and synchronize resources contained in external services, such as Amplitude cohorts or Segment Audiences, with LaunchDarkly segments. To learn more about segments, read Segments. ThesyncedSegment capability consists of a request parser. The properties of the parser describe the information about the segment to create or update.
Many of the parser properties are required, for example, the properties that specify the name and ID of the cohort you are updating.
Then, you have three options for how to send cohort information:
- Use a boolean property to indicate whether a member should be added or removed
- Use separate named arrays, one for members being added and one for members being removed
- Use a single
actionproperty to indicate whether the set of members should be added or removed
memberArrayPath, addMemberArrayPath, removeMemberArrayPath, and memberArrayParser properties describe which option you are using and where the integration framework can expect to find the cohort information.
Request parser properties
The following properties specify therequestParser:
| Property
| Description |
|---|
environmentIdPath
| (required) The [JSON pointer](https://datatracker.ietf.org/doc/html/rfc
- representation of a location in the HTTP request body that contains a valid LaunchDarkly client-side ID. |
|
contextKindPath
- representation of a location in the HTTP request body that contains the segment’s context kind. If not specified, the context kind will default to
user. To learn more about context kinds and where you can find a list of context kinds LaunchDarkly has observed, read Context kinds . | |cohortIdPath
- representation of a location in the HTTP request body that contains the external resource’s ID. This field has a recommended limit of 128 characters. |
|
cohortNamePath
- representation of a location in the HTTP request body that contains the external resource’s name. |
|
cohortUrlPath
- representation of a location in the HTTP request body that contains the external resource’s URL. |
|
jsonResponseBody
arrayInclusion
| (optional) If the request contains a single property that defines the type of message being sent, for example,add_members or remove_members, the arrayInclusion property is required. It has the following properties of its own: * path (required): The [JSON pointer](https://datatracker.ietf.org/doc/html/rfc
- representation of a location in the HTTP request body that contains the action to be performed. *
matcher(required): A regex pattern LaunchDarkly uses to determine if it should consider the parsedpathaction value as an added member. If the value does not match the regex provided, the member will be removed. | |memberArrayPath
- representation of a location in the HTTP request body that contains the list of members to be added or removed.
Use this if you are using the boolean property or singleactionproperty to send cohort information. | |addMemberArrayPath
- representation of a location in the HTTP request body that contains the list of members to be added or removed.
Use this if you are using separate named arrays to send cohort information. Required ifremoveMemberArrayPathis specified. | |removeMemberArrayPath
- representation of a location in the HTTP request body that contains the list of members to be added or removed.
Use this if you are using separate named arrays to send cohort information. Required ifaddMemberArrayPathis specified. | |memberArrayParser
memberArrayPath or addMemberArrayPath and removeMemberArrayPath . |
The following properties specify the embedded memberArrayParser:
| Property
| Description |
|---|
memberIdPath
| (required) The [JSON pointer](https://datatracker.ietf.org/doc/html/rfc
- representation of a location in the HTTP request body that contains the member’s ID, relative to the
memberArrayPath. | |booleanMembershipPath
- representation of a location in the HTTP request body that contains a boolean property to indicate whether a member is to be added or removed. Required if
memberArrayPathis specified. | |cohortIdPath
- representation of a location in the HTTP request body that contains the external resource’s ID. This value will override the cohort name for a single member. |
|
cohortNamePath
- representation of a location in the HTTP request body that contains the external resource’s name. This value will override the cohort ID for a single member. |
Examples
The following sections contain examples of different types of request bodies and the manifest definitions of synced segment capabilities that would successfully parse them.Boolean property
In the request body, use a boolean property to indicate whether a member is added or removed:Separate named arrays
In the request body, use separate named arrays containing lists of members to add and remove. In the manifest, thememberArrayParser describes how to parse the addMemberArrayPath and removeMemberArrayPath arrays:
Single property
In the request body, use a singleaction property for the entire batch to indicate whether the batch should be added or removed:
Response codes and custom responses
By default, LaunchDarkly returns one of the following response codes:204, success400, parsing problem403, unauthorized409, conflict429, rate limited, read Rate limiting for details on theX-Ratelimit-Resetheader500, internal error
jsonResponseBody in the syncedSegments object in your integration manifest. The jsonResponseBody supports Handlebars templating directly in the manifest.
Here is an example manifest excerpt that specifies a jsonResponseBody: