feat(slack): add DM channel listing support#55
feat(slack): add DM channel listing support#55code-yeongyu wants to merge 2 commits intodevxoul:mainfrom
Conversation
- 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
|
@code-yeongyu is attempting to deploy a commit to the devxoul Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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') { | |||
There was a problem hiding this comment.
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.
|
Thanks for the review! Both issues fixed in 1fbd12b:
|
Problem
agent-slack channel list --type dmreturns an empty array because:listChannels()only requeststypes: 'public_channel,private_channel'—imandmpimare not included--type dmbranch inchannel.tshardcodeschannels = []Solution
listDMs()method toSlackClientthat callsconversations.listwithtypes: 'im,mpim'channel list --type dmto calllistDMs()and return actual DM channels withid,user, andis_mpimfieldsNotes
conversations.historyalready works for DM channels (cookie is passed viaWebClientheaders), somessage list <DM_ID>needs no changesbun test)Changes
src/platforms/slack/client.ts: AddedlistDMs()methodsrc/platforms/slack/commands/channel.ts: Implemented--type dmlistingSummary by cubic
Adds DM and multi-person DM channel listing to the Slack integration.
agent-slack channel list --type dmnow returns real channels withid,user, andis_mpim, and respects--include-archived.New Features
listDMs()inSlackClientusingconversations.listwithtypes: 'im,mpim'and pagination.channel list --type dmto calllistDMs()and print results.Bug Fixes
'im,mpim'and remove empty result; skip public/private fetch for--type dm; respect--include-archivedvia Slackexclude_archived.Written for commit 1fbd12b. Summary will update on new commits.