メインコンテンツへスキップ

list-alert-slack-channels

dci list-alert-slack-channels [flags]

Lists Slack destinations eligible for Alert notifications for the authenticated customer and caller. Returns canonical identifiers for recipientsSlackChannels and integration status. User credentials include visible private channels; service accounts return public/shared channels only. Results are returned in workspace order: the shared channel (if any), then public channels, then private channels. They are not sorted by name or identifier. A page can hold fewer than maxResults items, even none, when nameContains filters out most channels in the part of the workspace scanned for that request; keep following pageToken until it is absent to receive every channel. Keep nameContains unchanged when following pageToken.

The response is an object: items holds the channels (each with id, name, type of public or private, and workspace or shared), and workspaceStatus reports the integration (ok, inactive, missing_private_scope, or none when no usable workspace was found, in which case a shared channel may still be available). maxResults ranges from 1 to 500 and defaults to 50. User credentials also see the private channels they can view; service accounts get public and shared channels only. When paging with --page-token, keep --name-contains unchanged. A 503 means Slack discovery is temporarily unavailable; retry later.

Examples​

# The Slack channels you can send alert notifications to, with the workspace connection status.
dci list-alert-slack-channels
# Find a channel by part of its name (case-insensitive).
dci list-alert-slack-channels --name-contains finops
# Every page as JSON, to copy a channel's `id` and `workspace` into an alert's `recipientsSlackChannels`.
dci list-alert-slack-channels --all --output json
# Page through a long list manually, 100 channels at a time.
dci list-alert-slack-channels --max-results 100 --page-token <page-token>

Flags​

FlagTypeDefaultExampleDescription
--name-containsstringCase-insensitive substring of the channel display name.
--max-resultsinteger50
--page-tokenstringPage token, returned by a previous call, to request the next page of results

Every command also accepts the CLI-wide flags for output shaping — see Output formats and Table output options.

Output​

Eligible channels and connection status.

By default dci renders the result as a table. Use --output json to get the full structure described below — see Output formats.

FieldTypeDescription
itemsarray of object
items[].namestringDisplay name, resolved server-side.
items[].typestringChannel visibility, resolved server-side. One of: "public", "private".
items[].idstring
items[].workspacestringConnected workspace name returned by discovery. Required for a non-shared channel.
items[].sharedbooleanDefault: false.
items[].customerIdstring
rowCountintegerTotal eligible channels after filtering. Present only when the whole list was returned by a single request without a pageToken; omitted otherwise, because the total is not known until every channel has been listed.
pageTokenstringOpaque continuation token. Omitted on the final page. Present means more channels remain, even when items is empty.
workspaceStatusstringIntegration status. Reconnect for inactive; grant private-channel scopes for missing_private_scope. None means no usable workspace was found; a shared channel may still be available. One of: "none", "ok", "inactive", "missing_private_scope".
isWorkspaceConnectedboolean
hasSharedChannelboolean
channelsCompletebooleanWhether the channels returned by this request are complete. False when the list may be missing channels: a transient Slack failure, a missing private-channel scope, or a service-account caller (private channels are never listed for service accounts). It does not signal more pages; use pageToken for that. Callers that validate channel availability should not treat a partial list as authoritative.
Raw JSON schema
{
"type": "object",
"required": [
"items",
"workspaceStatus",
"isWorkspaceConnected",
"hasSharedChannel",
"channelsComplete"
],
"properties": {
"items": {
"type": "array",
"items": {
"description": "Eligible Slack destination returned by listAlertSlackChannels and echoed on alert responses. Name and type are canonical display metadata resolved server-side; values supplied on a request are ignored. Existing unavailable destinations may be retained or removed.",
"allOf": [
{
"type": "object",
"required": [
"id"
],
"description": "Slack destination selected for an alert. Exactly one of the two shapes is valid: a shared channel (`shared: true`, `workspace` omitted), or a workspace channel (`shared: false` or omitted, `workspace` required). Any other combination is rejected with `validation_failed`. Identity is id plus workspace/shared context. customerId defaults to the authenticated customer; an explicit mismatch is rejected. Service accounts can add public/shared destinations; new private destinations require a user credential with channel visibility.",
"properties": {
"id": {
"type": "string",
"minLength": 1
},
"workspace": {
"type": "string",
"description": "Connected workspace name returned by discovery. Required for a non-shared channel."
},
"shared": {
"type": "boolean",
"default": false
},
"customerId": {
"type": "string",
"minLength": 1
}
}
},
{
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Display name, resolved server-side."
},
"type": {
"type": "string",
"description": "Channel visibility, resolved server-side.",
"enum": [
"public",
"private"
]
}
}
}
]
}
},
"rowCount": {
"type": "integer",
"description": "Total eligible channels after filtering. Present only when the whole list was returned by a single request without a pageToken; omitted otherwise, because the total is not known until every channel has been listed."
},
"pageToken": {
"type": "string",
"description": "Opaque continuation token. Omitted on the final page. Present means more channels remain, even when items is empty."
},
"workspaceStatus": {
"type": "string",
"enum": [
"none",
"ok",
"inactive",
"missing_private_scope"
],
"description": "Integration status. Reconnect for inactive; grant private-channel scopes for missing_private_scope. None means no usable workspace was found; a shared channel may still be available."
},
"isWorkspaceConnected": {
"type": "boolean"
},
"hasSharedChannel": {
"type": "boolean"
},
"channelsComplete": {
"type": "boolean",
"description": "Whether the channels returned by this request are complete. False when the list may be missing channels: a transient Slack failure, a missing private-channel scope, or a service-account caller (private channels are never listed for service accounts). It does not signal more pages; use pageToken for that. Callers that validate channel availability should not treat a partial list as authoritative."
}
}
}

Errors​

On failure, dci prints a single error message — with a hint when one is available — and exits with a typed code your scripts can branch on. See Errors and exit codes for the full contract.

HTTP status to exit code mapping
HTTP statusExit codeError codeMeaning
40030VALIDATION_ERRORThe arguments or request body were rejected. Review the command's flags and payload.
40110AUTHENTICATION_FAILEDNot signed in, or the API token is invalid. Run dci login or check DCI_API_KEY.
40311PERMISSION_DENIEDThe DoiT user or the active customer context does not have access.
50340API_SERVER_ERRORThe API failed to process the request. Retryable; contact DoiT support if it persists.

Aliases: listalertslackchannels