slack icon indicating copy to clipboard operation
slack copied to clipboard

Adjust `GetReactions` to return also an item to align with Slack API

Open olegbespalov opened this issue 3 months ago • 4 comments

What?

Currently the method GetReactions of the library returns only the reaction details, extracting them here:

https://github.com/slack-go/slack/blob/e6bc4a09315b19c30c71165094d74c5eddfd36cd/reactions.go#L49-L59

It's fine, but Slack API's method also returns the details of the item itself, e.g., message:

{
  "ok": true,
  "type": "message",
  "message": {
    "type": "message",
    "text": "Hi there!",
    "user": "W123456",
    "ts": "1648602352.215969",
    "team": "T123456",
    "reactions": [
      {
        "name": "grinning",
        "users": [
          "W222222"
        ],
        "count": 1
      },
      {
        "name": "question",
        "users": [
          "W333333"
        ],
        "count": 1
      }
    ],
    "permalink": "https://xxx.slack.com/archives/C123456/p1648602352215969"
  },
  "channel": "C123ABC456"
}

So basically, part of the API response is being ignored.

It will be good if the library's response will be closer to Slack's and also start returning the item itself (message, file, file comment).

There was an issue, https://github.com/slack-go/slack/issues/117 where workarounds have been suggested, like using conversations.history, but the issue is that this workaround requires additional scopes, like channels:history.

Why?

Provide a library object that is closer to Slack

(Optional) Slack's documentation

https://docs.slack.dev/reference/methods/reactions.get/

olegbespalov avatar Sep 09 '25 12:09 olegbespalov

Hi there! I'll also be happy to contribute and implement this change (here is a draft https://github.com/olegbespalov/slack/pull/1), but my only concern is that it could be a breaking change to an existing library API, so I've opened this issue to kick-start discussion.

olegbespalov avatar Sep 09 '25 12:09 olegbespalov

Hi @olegbespalov, thank you for suggesting this. For now, I'm keeping as is but will keep this open and consider for when I do another breaking change release.

nlopes avatar Sep 14 '25 16:09 nlopes

@nlopes, thanks for the reply!

Do you want me to re-route the PR https://github.com/olegbespalov/slack/pull/1 to the slack-go/slack and maybe polish it or apply any feedback meanwhile to be ready to merge it whenever v0.18 will be planned?

olegbespalov avatar Sep 15 '25 08:09 olegbespalov

Yeah, please re-route the PR - I'll take a look on the first chance I get.

nlopes avatar Sep 15 '25 11:09 nlopes