Skip to content

Fix DM event tracking and make channelType required#2

Open
Aaron Wang (tabletenniser) wants to merge 1 commit intomasterfrom
aaron_fix_channel_type
Open

Fix DM event tracking and make channelType required#2
Aaron Wang (tabletenniser) wants to merge 1 commit intomasterfrom
aaron_fix_channel_type

Conversation

@tabletenniser
Copy link
Copy Markdown
Contributor

@tabletenniser Aaron Wang (tabletenniser) commented Apr 6, 2026

Summary

  • getChannelName was changed to use channelType for DM detection but most call sites were not updated to pass it, causing slack_channel_name to be undefined instead of "direct-message" for DMs
  • Make channelType a required parameter (SlackChannelType union: im | mpim | channel | group) across all channel-related methods and tracking types
  • Thread channelType through sendMessage, getChannelContext, HttpEventHandler, and vote button payloads
  • Add lookupChannelType to ChannelConfigManager for app_mention events that lack channel_type in their payload (uses conversations.info API)
  • Add channel-config.test.ts with tests for DM detection, channel type lookup, and API error handling
  • Add tests in slack-handler.test.ts for vote payload channel_type preservation

Test plan

  • TypeScript compilation passes
  • All 145 tests pass (21 new tests added)
  • We now have slack_channel_name == 'direct-message'` for DM messages

🤖 Generated with Claude Code

The getChannelName method was changed to use channelType for DM
detection but most call sites were not updated to pass it. When
channelType was undefined, DMs were no longer detected and
slack_channel_name was undefined instead of 'direct-message'.

Changes:
- Make channelType a required parameter on getChannelName,
  getContextSource, isConditionalReplyChannel,
  isNonEphemeralConditionalChannel, and isFullContentLoggingAllowed
- Add slackChannelType (typed as SlackChannelType union) to
  MessageProcessedEvent and FeedbackEvent tracking types
- Thread channelType through sendMessage, getChannelContext, and
  HttpEventHandler callback
- Include channel_type in vote button payloads (createSafeButtonValue
  and sendChunkedWithVoting) so action handlers have it
- Add lookupChannelType to ChannelConfigManager for app_mention events
  that lack channel_type in their payload (uses conversations.info)
- Add channel-config.test.ts with tests for getChannelName DM detection,
  API lookup, lookupChannelType, and isDirectMessage
- Add slack-handler.test.ts tests for vote payload channel_type
  preservation and prepareEventForHandling channelType passing

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant