Skip to content

feat(slack): add DM channel listing support#55

Open
code-yeongyu wants to merge 2 commits intodevxoul:mainfrom
code-yeongyu:feat/slack-dm-support
Open

feat(slack): add DM channel listing support#55
code-yeongyu wants to merge 2 commits intodevxoul:mainfrom
code-yeongyu:feat/slack-dm-support

Conversation

@code-yeongyu
Copy link

@code-yeongyu code-yeongyu commented Mar 13, 2026

Problem

agent-slack channel list --type dm returns an empty array because:

  1. listChannels() only requests types: 'public_channel,private_channel'im and mpim are not included
  2. The --type dm branch in channel.ts hardcodes channels = []

Solution

  • Added listDMs() method to SlackClient that calls conversations.list with types: 'im,mpim'
  • Updated channel list --type dm to call listDMs() and return actual DM channels with id, user, and is_mpim fields

Notes

  • conversations.history already works for DM channels (cookie is passed via WebClient headers), so message list <DM_ID> needs no changes
  • All existing tests pass (bun test)

Changes

  • src/platforms/slack/client.ts: Added listDMs() method
  • src/platforms/slack/commands/channel.ts: Implemented --type dm listing

Summary by cubic

Adds DM and multi-person DM channel listing to the Slack integration. agent-slack channel list --type dm now returns real channels with id, user, and is_mpim, and respects --include-archived.

  • New Features

    • Added listDMs() in SlackClient using conversations.list with types: 'im,mpim' and pagination.
    • Updated channel list --type dm to call listDMs() and print results.
  • Bug Fixes

    • Fixed DM listing: include 'im,mpim' and remove empty result; skip public/private fetch for --type dm; respect --include-archived via Slack exclude_archived.

Written for commit 1fbd12b. Summary will update on new commits.

- Add listDMs() method to SlackClient that calls conversations.list
  with types='im,mpim' to retrieve direct message channels
- Implement actual DM listing in 'channel list --type dm' command
  (previously returned empty array)
- DM output includes channel id, user id, and is_mpim flag
- Cookie is already passed via WebClient headers, so
  conversations.history works for DM channels without changes
@vercel
Copy link

vercel bot commented Mar 13, 2026

@code-yeongyu is attempting to deploy a commit to the devxoul Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 2 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/platforms/slack/commands/channel.ts">

<violation number="1" location="src/platforms/slack/commands/channel.ts:31">
P2: `--include-archived` is ignored when `--type dm` is used; DM listing always includes archived IM/MPIM conversations, making the flag inconsistent with public/private channel listing.</violation>

<violation number="2" location="src/platforms/slack/commands/channel.ts:31">
P2: `channel list --type dm` still performs `listChannels()` before the DM branch, so DM listing depends on the public/private channel list call succeeding and always incurs an unnecessary API request.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

channels = channels.filter((c) => c.is_private)
} else if (options.type === 'dm') {
channels = []
const dms = await client.listDMs()
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: --include-archived is ignored when --type dm is used; DM listing always includes archived IM/MPIM conversations, making the flag inconsistent with public/private channel listing.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/platforms/slack/commands/channel.ts, line 31:

<comment>`--include-archived` is ignored when `--type dm` is used; DM listing always includes archived IM/MPIM conversations, making the flag inconsistent with public/private channel listing.</comment>

<file context>
@@ -28,7 +28,14 @@ async function listAction(options: { type?: string; includeArchived?: boolean; p
       channels = channels.filter((c) => c.is_private)
     } else if (options.type === 'dm') {
-      channels = []
+      const dms = await client.listDMs()
+      const dmOutput = dms.map((dm) => ({
+        id: dm.id,
</file context>

@@ -28,7 +28,14 @@ async function listAction(options: { type?: string; includeArchived?: boolean; p
} else if (options.type === 'private') {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: channel list --type dm still performs listChannels() before the DM branch, so DM listing depends on the public/private channel list call succeeding and always incurs an unnecessary API request.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/platforms/slack/commands/channel.ts, line 31:

<comment>`channel list --type dm` still performs `listChannels()` before the DM branch, so DM listing depends on the public/private channel list call succeeding and always incurs an unnecessary API request.</comment>

<file context>
@@ -28,7 +28,14 @@ async function listAction(options: { type?: string; includeArchived?: boolean; p
       channels = channels.filter((c) => c.is_private)
     } else if (options.type === 'dm') {
-      channels = []
+      const dms = await client.listDMs()
+      const dmOutput = dms.map((dm) => ({
+        id: dm.id,
</file context>

… --include-archived for DMs

- Move DM branch before listChannels() call to avoid unnecessary
  public/private channel API request when --type dm is used
- Pass excludeArchived option to listDMs() so --include-archived
  flag is respected for DM listing (uses Slack's exclude_archived param)

Fixes issues identified by cubic-dev-ai review.
@code-yeongyu
Copy link
Author

Thanks for the review! Both issues fixed in 1fbd12b:

  1. --include-archived now respected for DMslistDMs() accepts excludeArchived option and passes it to Slack's exclude_archived API parameter
  2. No unnecessary API call — DM branch moved before listChannels() so conversations.list for public/private channels is never called when --type dm is specified

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant