unsplash / mercury

The guide of souls to the underworld.
https://unsplash.github.io/mercury/
MIT License
4 stars 0 forks source link

Arbitary mentions #6

Open samhh opened 1 year ago

samhh commented 1 year ago

We support dynamically mapping channel names to IDs. Could we do the same for user and/or group mentions?: https://github.com/unsplash/mercury/blob/4b0b337d92fe435428e2c7bcd1504c4ede6acd28/src/slack/mention.rs#L6

samhh commented 1 year ago

This'd make the project more immediately useful to consumers beyond Unsplash. (NB our hosted instance can't be used by anyone else as it's tied to our Slack token.)

samhh commented 1 year ago

Yep, we could: https://api.slack.com/methods/usergroups.list

It'd be mostly a copy/paste of how we handle channel names, meaning we'd inherit #5.

samhh commented 1 year ago

Example response:

{
    "ok": true,
    "usergroups": [
        {
            "id": "SAWPVDSUW",
            "name": "Web Team",
            "handle": "web-team"
        }
    ]
}

id is what we currently use in to_user_group_id. handle is what we'd want to expose in cc. We could also support pinging specific users but I don't think that's necessary.

So our call sites would need to change from -d cc=web to -d cc=web-team. Or we could change the handles I guess, the suffix is redundant.

samhh commented 7 months ago

Suggested plan:

  1. Support arbitrary team mentions. Fall back to the current hardcoded ones.
  2. Support arbitrary user mentions, trying team mentions first.
  3. After a little time, separately remove the hardcoded team mentions. (v2? Deprecation?)