Define customer segments
Create customer segments and the rules that tag feedback with them, with a preview of each rule before Deck saves it.
This page is an agent-readable workflow for Deck. Humans can follow along. Coding agents should treat the steps as the source of truth.
Define customer segments — agent workflow
- Use it when: the user asks "set up segments for Enterprise and SMB", "split our feedback by plan", "tag all Zendesk feedback as support" or "show feedback from our key accounts only".
- Outcome: the segments that the user approved exist. Each one has rules that tag the right insights, and the user saw a preview of each rule before Deck saved it.
- Needs: Deck MCP. Segments must be on for the workspace, and only an organization admin can turn them on. Every member with MCP access can create segments and rules. A CRM field rule needs a connected CRM, and only organization admins connect integrations, in Settings → Integrations.
1. Probe Deck MCP
Call get_user_context. This must be a real tool call.
- 401 Unauthorized: tell the user to connect Deck MCP in this client (Settings → Connections). Stop.
- No Deck tools: fetch and follow https://docs.getdeck.io/docs/agents/getting-started/prompts/ai-pm.md. Stop this workflow until the tools work.
2. Read the current state
Make these calls at the same time:
explore_segmentswith no parameters: the segments with their insight counts and rule counts.explore_workspacewithviewset tosettings: your role and whether segments are on.get_overview: readorganization.target_audiencefor the customer groups.explore_integrations: the connected sources that rules can match. For Slack channels, call it again withintegration_typeset toSLACKandviewset toslack_channels.
When segments are off and you are an organization admin, offer to turn them on with set_segments_enabled and enabled set to true. Get a yes first. A member gets AUTH_ERROR: tell the user to ask an organization admin, who can also turn segments on in Settings → Segments. Stop until segments are on.
3. Propose the segments and rules
Ask the user which customer groups matter, for example plan tier, company size, region or a list of key accounts. Use the user's words. Do not create a segment that already exists in step 2.
For each segment, plan:
- A name of 1 to 100 characters. Segment names are unique in the organization.
- An optional color as
#RRGGBBand a description of up to 2000 characters. - One or more rules. An insight joins the segment when any rule matches.
Each rule has a rule_type, an operator and a value:
rule_type | Matches | Example value |
|---|---|---|
source_type | The feedback source: USER_INTERVIEW, SURVEY, CS_TICKET, SLACK, CSV or NOTION | SURVEY |
integration_type | The integration: ZENDESK, INTERCOM, SLACK, GONG, POSTHOG, HUBSPOT, SALESFORCE or NOTION | INTERCOM |
slack_channel | One Slack channel, by name | #vip-customers |
crm_field | A CRM field. Also set source_type to the CRM record type (for example hubspot_company) and field_name | Enterprise |
segment | Membership of another segment | A segment ID from explore_segments |
Operators are equals, not_equals, contains, starts_with, ends_with and in. Only in takes a list of values.
Show the plan as a table: segment, description, rules. Ask: "Create these segments?" Wait for a yes.
4. Preview each rule
Call explore_segments with preview_rule set to the rule fields. It saves nothing. For a segment that exists, also set segment_id inside preview_rule, so its current members are not counted.
- Read
preview.insight_ids(up to 25),sample_sizeandhas_more. - Call
explore_insightswithinsight_idfor 2 or 3 sample insights. Check that they belong to the segment. - When the sample is wrong or empty, change the rule and preview again.
INVALID_SEGMENT_RULEgives Deck's reason.
5. Create the segments and rules
create_segmentwithnameand optionalcoloranddescription. Keep the segment ID from the result.create_segment_rulewithsegment_id,rule_type,operatorandvalue, plussource_typeandfield_namefor acrm_fieldrule. Whenretroactive_job.queuedistrue, Deck tags the existing insights in the background.
Use manual assignment only for what rules cannot match:
set_feedback_source_segmentswithfeedback_idand up to 20segment_idsreplaces the manual segments of every insight from one source. An empty list clears them. Get thefeedback_idfromlist_sources.confirm_insight_segmentwithinsight_idandsegment_idturns an AI assignment into a manual one.explore_insightswithinsight_idshows the AI assignments.
To change a segment or a rule later, use update_segment or update_segment_rule.
6. Check the result
- Call
explore_segmentswith each newsegment_id. Check its rules and which rules are active. - Tagging runs in the background. Call
explore_segmentsagain later, and quote Deck's insight counts. - Show the top themes of a segment with
explore_themesandsegment_ids. To compare two segments, fetch and follow https://docs.getdeck.io/docs/agents/workflows/segment-comparison.md.
See Customer Segments for how segments work in the Deck web app.
Rules
- Prefer rules to manual assignment. Rules also tag new feedback.
- Preview every rule before you save it.
- Quote Deck's numbers. Do not compute your own.
- Show the plan and get a yes before you call write tools.
archive_segmentanddelete_segment_ruleare sensitive writes. MCP cannot undo them. Get an explicit yes for each call, every time.- Only organization admins can call
set_segments_enabled. - After each write, check for a top-level
errorkey. Whenidempotency.replayedistrue, Deck did not run the write again. See Write responses and retries. - If the user has more than one Deck organization, call
select_organizationfirst and passorg_idon every call.
Done when
- Each approved segment exists with the approved rules, and the user saw a preview of each rule.
explore_segmentsshows the rules as active.- The user knows that Deck tags existing insights in the background, and how to check the counts later.