Portal Community

channel/close

Closes a Direct Message (DM) or Multi-Party IM (MPIM) conversation, removing it from the bot's active channel list. This operation is only valid for DM (D...) and MPIM (G... group DM) conversations — it does not apply to public or private channels (use channel/archive for those). Requires im:write scope.

When to Use

Configuration

Connection

FieldTypeRequiredDescription
botTokenstringRequiredBot Token starting with xoxb-. Requires im:write scope for DMs and mpim:write for group DMs.

Operation Fields

FieldTypeRequiredDescription
channelIdstringRequiredThe DM or MPIM channel ID to close. DM IDs start with D; group DMs (MPIM) start with G. Must NOT be a public (C) or standard private channel — use channel/archive for those.
DMs and MPIMs only: channel/close works exclusively on DM conversations (IDs starting with D) and multi-party IMs (IDs starting with G when opened as a group DM). To close standard public or private channels, use channel/archive. Passing a standard channel ID to this node will result in an error.
Closing is reversible: Unlike archiving a channel, closing a DM only hides it from the sidebar. The conversation can be reopened at any time using channel/open and all history is preserved.

Sample Configuration

{
  "operation": "channel/close",
  "connection": {
    "botToken": "{{credentials.slackBotToken}}"
  },
  "fields": {
    "channelId": "{{$json.dmChannelId}}"
  }
}

Validation Errors

Error CodeCauseResolution
channel_not_foundThe channel ID is invalid, is not a DM/MPIM, or is not accessible to this bot.Verify that the channel ID starts with D (DM) or G (group DM). Standard channels (C) cannot be closed with this operation.
missing_scopeBot token lacks im:write or mpim:write scope.Re-authorize the Slack app with the required scopes.

Output

Success Port

FieldTypeDescription
channelIdstringThe DM/MPIM channel that was closed.
statusstringsuccess or error.
errorCodestringSlack error code when status is error.
payloadobjectFull raw Slack API response.

Error Port

On failure with Continue on Error enabled, routes to the error port with status: "error" and populated errorCode.

Sample Output

{
  "channelId": "D08DM3XYZ99",
  "status": "success",
  "errorCode": "",
  "payload": {
    "ok": true,
    "already_closed": false
  }
}

Expression Reference

ExpressionResult
{{$node["channel-close"].json.channelId}}The closed DM channel ID — use in audit log or ticket resolution records.
{{$node["channel-close"].json.payload.already_closed}}True if the DM was already closed — treat as a safe no-op in idempotent workflows.
{{$node["channel-close"].json.status === "success"}}Boolean gate — confirm close before marking ticket as resolved in external system.

Node Policies & GuardRails

Policy AreaRecommendation
Scope requirementsRequires im:write for DMs and mpim:write for group DMs. Does not work for standard public or private channels — use channel/archive for those.
Rate limitingTier 2 (20+ req/min). Safe for individual or moderate-batch close operations.
No hard-coded IDsAlways source channelId from the output of a preceding channel/open node or from a stored DM channel ID. Never hard-code DM channel IDs.
DMs vs channelsOnly pass DM (D...) or MPIM (G... group DM) IDs to this node. Do not pass standard channel IDs — use channel/archive for public/private channels.
Reversible operationClosing a DM is non-destructive. History is preserved. Reopen at any time with channel/open. This is the correct cleanup step for short-lived DM workflows.
Final message before closeAs a best practice, send a closing message ("Support ticket #123 resolved — closing this conversation") before closing the DM so the user has a clear record.

Examples

Example 1 — Support Ticket Resolution DM Close

When a support ticket is resolved, sends a final confirmation DM and then closes the conversation.

// Trigger: ticket status → resolved
// $json.dmChannelId, $json.ticketId, $json.resolutionSummary

// Node 1: message/send — resolution notification
{
  "channelId": "{{$json.dmChannelId}}",
  "text": "Your support ticket #{{$json.ticketId}} has been resolved. {{$json.resolutionSummary}} — We're closing this conversation now. Reply anytime to open a new ticket."
}

// Node 2: channel/close
{ "channelId": "{{$json.dmChannelId}}" }

// Node 3: update ticket record in CRM with closed DM status

Example 2 — Temporary Incident Group DM Cleanup

After an incident is resolved, closes the coordination group DM created at the start of the incident.

// Trigger: incident resolved
// $json.incidentMpimChannelId (MPIM opened at incident start)

// Node 1: message/send
{ "text": "Incident resolved. Closing this coordination DM. See #incident-archive for the post-mortem." }

// Node 2: channel/close
{ "channelId": "{{$json.incidentMpimChannelId}}" }

Example 3 — Automated DM Lifecycle: Open, Message, Close

Full DM workflow pattern: open a DM, deliver a message, then close the conversation after a confirmation period.

// Node 1: channel/open — get or create DM with user
{ "userIds": "{{$json.userId}}" }

// Node 2: message/send
{
  "channelId": "{{$node['channel-open'].json.channelId}}",
  "text": "{{$json.messageText}}"
}

// Wait node: 24 hours (allow user to respond)

// Node 3: channel/close — clean up after delivery window
{ "channelId": "{{$node['channel-open'].json.channelId}}" }