slack-go / slack

Slack API in Go, originally by @nlopes; Maintainers needed, contact @parsley42
https://pkg.go.dev/github.com/slack-go/slack
BSD 2-Clause "Simplified" License
4.63k stars 1.12k forks source link

Replies array is empty in slack.Messagee #1166

Open aleksa11010 opened 1 year ago

aleksa11010 commented 1 year ago

What happened

When you are trying to get the messages and checking for the replies we see that the Replies count actually shows the number of replies but the Replies array has no messages inside

image

Created PR to fix this : https://github.com/slack-go/slack/pull/1167

Expected behavior

I expect to be able to access all the replies without having to run additional API call to get the replies based on the first threads timestamp. Also, default Slack API returns a field reply_users which will have an array of all users that replied to that thread, is it possible to have it included here as well?

Steps to reproduce

Running any GetConversationHistory function on any channels that has threads with replies should result with messages that have ReplyCount set properly but no actual Reply messages.

reproducible code

func getMessages(channel string, timestamp string) ([]slack.Message, error) {
    // Get the messages from the channel
    history, err := GetSlackClient().GetConversationHistory(&slack.GetConversationHistoryParameters{
        ChannelID:          channel,
        Oldest:             timestamp,
        Inclusive:          true,
        IncludeAllMetadata: true,
    })
    if err != nil {
        log.Printf("Error getting channel history : %s", err)
        return nil, err
    }

    return history.Messages, nil
}
msg, err := getMessages(os.Getenv("CHANNEL"), ts)
    if err != nil {
        log.Println(err)
    }

Versions