Reference / Segments

Create a segment

create_segmentocmgr segments createPOST /v1/segmentsWRITE

Save an audience. Pass filter (the same tree as preview_segment and search_members), or legacy definition.filter, to make it a live filter — "everyone tagged champion who was active since June" stays true as the community changes — or omit it for a segment whose members are only the ones somebody adds. Captures the calling actor as owner. An existing name returns created:false with the existing segment and keeps its original owner; none of the supplied filter, definition, description or statuses is applied. Use update_segment to change it.

Parameters

filterobject

The same filter tree as preview_segment and search_members. Use either filter or definition, not both.

namestringREQUIRED

The segment’s name. An existing name returns that segment.

descriptionstring

What it is for.

definitionobject

The saved filter. Omit for a segment whose membership is only what somebody adds to it.

filterobject

The filter language (ADR 0025): a tree over the fields list_segment_fields returns. This is the one to use; the five keys below are what a segment could be saved with before the language existed and are still accepted.

querystring

Free text over name, handle, company and email.

source"self" | "github" | "slack" | "discourse" | "vanilla" | "bevy" | "gainsight-cc" | "gradual" | "bettermode" | "circle" | "flarum" | "verint" | "dev" | "stackoverflow" | "meetup" | "luma" | "discord" | "generic" | "csv" | "enrichment"

Only members with an identity on this source.

companystring

Only members whose golden record names this company.

seen_sincestring (date-time)

Only members seen at or after this instant.

tagsstring[]

Only members carrying at least one of these tags.

statusesobject[]up to 8

The segment’s status vocabulary: at most eight, in the order a menu offers them. Replaced whole. Once a segment has one, set_segment_member_status refuses a status outside it; a segment with none (the default) takes free text as it always has.

filterobject

Set automatically when this member filter matches, first matching status wins. A person-held status is preserved. Cannot reference this segment directly or indirectly.

keystringup to 32 charsREQUIRED

What a write names: lower case letters, digits, - and _, e.g. contacted.

labelstringup to 40 charsREQUIRED

What a person reads, e.g. "Contacted".

tone"accent" | "healthy" | "danger" | "muted"REQUIRED

The colour, from the theme’s four: accent (new, act on it), healthy (done, going well), danger (blocked, lost), muted (parked).

CLI flags

--description <text>

What the segment is for

--filter <json>

Filter: a filter tree; see ocmgr segments fields

--query <text>

Filter: free text over name, handle, company and email

--company <name>

Filter: members whose golden record names this company

--seen-since <date>

Filter: members seen at or after this date

--filter-tag <tag...>

Filter: members carrying at least one of these tags

--statuses <json>

A status vocabulary: a list of {key, label, tone, filter?} (filter assigns this status automatically), at most eight; tones accent, healthy, danger, muted

Also in Segments