Reference / Slack routing

Create a routing rule

create_routing_ruleocmgr routing rule createPOST /v1/routing-rulesADMIN

Send matching community activity into a Slack channel, or as a direct message to one person on your team (destination_user_id, or destination_user_email, instead of destination_channel_id). A **segment rule** — event_types segment.entered / segment.left and filter.segment, no source — posts the member card when somebody enters or leaves that segment. This is the one tool in Datum that makes the software *write* somewhere a customer can see, so it needs the admin scope and it checks before it agrees: the destination must be a Slack Web API connection whose token holds chat:write — plus im:write when the rule names a person — and a rule that cannot post is refused with the scope and the reinstall step named rather than created and left silently broken. Create it with enabled false to save a draft before its token is ready. Disabled drafts still require an existing Slack Web API connection. Two defaults are worth knowing: no event types means every type the source reports, and not_team is on, so the workspace’s own staff are left out unless you say otherwise.

Parameters

namestringREQUIRED

What to call it. Names are how people address a rule.

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

The source whose activity to watch: github, slack, discourse, csv, generic (Push API: webhooks and pushes), and the other source kinds. Omit for a segment rule, a member watch, or a rule with organisation_tags across all sources.

event_typesstring[]

Event types to match, e.g. ["issue_opened"]. Omit for every type the source reports — which is what somebody who has not thought about types yet means. ["segment.entered", "segment.left"] (either or both) makes a segment rule, with filter.segment naming the segment.

filterobject

The narrowing clauses. Every clause set must hold (they are ANDed) and each list matches if any of its values does (an OR). An unrecognised key is refused rather than stored, so a typo fails at this call instead of silently matching nothing.

needs_replyobject

Unanswered community thread roots older than after_hours (1–168), excluding handled threads. Evaluated every five minutes; null thread references never match.

after_hoursinteger1–168REQUIRED
organisation_tagsstring[]

Any of these tags on the actor’s derived organisations, by case-insensitive name or id. Source may be omitted to watch all sources.

tone"positive" | "neutral" | "negative" | "mixed"[]up to 4

Any of these event tone labels. Unjudged events, and labels under 0.5 confidence (unclear), never match.

activity_tagsstring[]

Any of these activity thread tags, by name or id; not actor tags.

channel_idsstring[]

Slack channels this rule cares about, by id (C…) or by name (support, or #support). Ids are what the channel picker stores, because a renamed channel keeps its id.

category_idsstring[]

Discourse categories, by numeric id or by name.

repo_namesstring[]

GitHub repositories, as owner/name.

tagsstring[]

Only people carrying one of these tags. Case-insensitive. Tags are the community’s own labels, so this is how "tell me when a champion does anything" is expressed.

not_teamboolean

Leave the workspace’s own staff out. **On unless you turn it off** — a channel that also relays your colleagues talking to each other is one people mute, and a muted channel is a routing rule that has stopped working.

first_time_contributorboolean

Only somebody’s first activity on this source. The "a new person just showed up" rule. Asked of the person, not the account, so a second account we have just matched to somebody who has been here a year is not announced as new.

memberstring (uuid)

Only this member, following merges. Source may be omitted to watch all sources. Cannot combine with a segment trigger.

segmentstring

The segment a **segment rule** watches, by id or name (stored as the id): with event_types segment.entered and/or segment.left, the rule posts the member card — never message text — when somebody enters or leaves it. Only with those event types, and they only with it; a segment rule takes not_team and tags and no source clause.

destination_connection_idstring (uuid)REQUIRED

The Slack Web API connection (kind slack) that will post. A slack-export import is a ZIP file and cannot; list_connections shows which is which.

destination_channel_idstring

The channel to post in, as Slack’s C… id. list_discovered_targets on the Slack connection lists the public channels with their ids. Give this or destination_user_id, not both.

destination_channel_namestring

The channel’s name, for the screen. Nothing routes on it.

destination_user_idstring

A person to direct-message instead of a channel, as Slack’s U…/W… id — list_discovered_targets lists them beside the channels. The connection needs the im:write scope, and a rule that would need it is refused at this call rather than at its first delivery.

destination_user_emailstring

A person to direct-message, by their address instead of their Slack id: resolved against the graph to a member of **your team** with a Slack account on this connection. An address that is not the team’s resolves to nobody and is refused — a rule never DMs the community.

destination_user_namestring

That person’s handle, for the screen. Nothing routes on it.

templatestring

Replace the message’s headline. The rest of the card is unchanged.

enabledboolean

Defaults to true. A rule created disabled skips the Slack scope check, which is how you save one before the app exists.

CLI flags

--source <kind>

The source to watch: self, github, slack, discourse, vanilla, bevy, gainsight-cc, gradual, bettermode, circle, flarum, verint, dev, stackoverflow, meetup, luma, discord, generic, csv, enrichment. generic means Push API (webhooks and pushes)

--segment <segment>

Watch a segment instead of a source: post the member card when somebody enters or leaves it (event types segment.entered,segment.left by default)

--member <id>

Only this member, across sources unless --source narrows it

--connection <id>REQUIRED

The Slack connection that will post

--channel <id>

The channel to post in (Slack’s C… id)

--channel-name <name>

The channel’s name, for the screen

--user <id>

Direct-message this person instead (Slack’s U… id)

--user-email <email>

The same, resolved through this connection’s member list

--user-name <name>

That person’s handle, for the screen

--event-types <list>

Comma-separated; omit for every type the source reports

--filter <json>

Narrowing clauses, e.g. '{"repo_names":["acme/widgets"]}'

--template <text>

Replace the message’s headline

--disabled

Save it switched off (skips the Slack scope check)

Also in Slack routing