Skip to content

Conversation

@niebloomj
Copy link

Summary

Adds fallback implementation for conversations_unreads tool that works with xoxp and xoxb tokens.

Problem

The current implementation of conversations_unreads uses the ClientCounts API, which only works with browser session tokens (xoxc/xoxd). When used with OAuth tokens (xoxp/xoxb), it returns empty results.

Solution

This PR adds an automatic fallback that:

  1. Attempts to use ClientCounts first (fast path for xoxc/xoxd)
  2. Detects when ClientCounts returns empty results
  3. Falls back to iterating through channels using conversations.info to check unread_count on each channel

Implementation Details

  • New method: getUnreadsUsingConversationsInfo implements the per-channel approach
  • Auto-detection: Checks if ClientCounts returns zero channels and switches to fallback
  • API addition: Added GetConversationInfoContext to SlackAPI interface
  • Logging: Info message logged when using fallback method
  • Compatibility: Maintains same output format and filtering options as original

Limitations

  • The mentions_only filter is not supported with xoxp tokens (no access to mention counts via conversations.info)
  • A warning is logged if mentions_only is requested with xoxp tokens
  • lastRead and latest timestamps are not available via conversations.info (returned as empty strings)

Testing

  • Code compiles successfully
  • Based on working Python implementation using the same approach

Stacked PR

This PR is stacked on top of korotovsky#171 and targets the feat-unreads-rebase branch.

🤖 Generated with Claude Code

Adds fallback implementation for conversations_unreads tool that works
with xoxp and xoxb tokens by iterating through channels and using
conversations.info to check unread_count.

The ClientCounts API (used in the original implementation) only works
with browser session tokens (xoxc/xoxd) and returns empty results for
OAuth tokens (xoxp/xoxb). This change detects when ClientCounts returns
empty results and automatically falls back to the per-channel approach.

Implementation details:
- Added GetConversationInfoContext to SlackAPI interface
- New helper method getUnreadsUsingConversationsInfo implements xoxp approach
- Automatically detects empty ClientCounts response and switches to fallback
- Logs info message when using fallback method
- Maintains same output format and filtering options as original
- Note: mentions_only filter not supported with xoxp (logged as warning)

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
@niebloomj
Copy link
Author

Closing to recreate against main repository

@niebloomj niebloomj closed this Feb 11, 2026
@niebloomj niebloomj deleted the feat-xoxp-unread-support branch February 11, 2026 01:58
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