Skip to content

Feature request: Add user and channel lookup commands #50

@zomglings

Description

@zomglings

Problem

When using clacks send -u <username>, user resolution can fail due to:

  1. Rate limiting on the users.list API endpoint
  2. No way to look up or search for users/channels without sending a message

Currently, if you don't know the exact username, display name, or user ID, there's no way to find it through clacks itself.

Proposed Solution

Add two new subcommands:

clacks users

# List users (with optional search/filter)
clacks users list
clacks users list --filter "zi"
clacks users search <query>

# Lookup specific user
clacks users lookup <identifier>  # by ID, username, or email

clacks channels

# List channels
clacks channels list
clacks channels list --filter "general"

# Lookup specific channel
clacks channels lookup <identifier>  # by ID or name

Relevant Slack API Endpoints

The following endpoints would be useful:

  • GET https://slack.com/api/users.list - List all users in workspace
  • GET https://slack.com/api/conversations.list - List all channels
  • Headers: Authorization: Bearer <token>

Example API call pattern (details obfuscated):

curl -s "https://slack.com/api/users.list?limit=500" \
  -H "Authorization: Bearer xoxp-XXXX-XXXX-XXXX-XXXX" \
  | jq -r '.members[] | select(.deleted == false) | "\(.id) \(.name) \(.real_name)"'

Additional Context

The resolve_user_id function in messaging/operations.py already calls users.list() internally, but:

  1. It's not exposed as a CLI command
  2. It doesn't support pagination (noted as TODO in the code)
  3. Results aren't cached, leading to repeated API calls and rate limiting

Caching the user/channel list in the sqlite database (as mentioned in the TODO comments) would also help avoid rate limiting issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions