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.64k stars 1.13k forks source link

json: cannot unmarshal number into Go struct field Message.messages.blocks of type string for GetConversationHistory #1123

Closed kim-barker closed 1 year ago

kim-barker commented 1 year ago

What happened

GetConversationHistory returns the following error: json: cannot unmarshal number into Go struct field Message.messages.blocks of type string

Expected behavior

Steps to reproduce

Use conversation with date Slack block that includes timestamp

{
    "type": "date",
    "timestamp": 1666933200,
    "format": "{date} at {time}",
    "fallback": "not available",
    "style": {
        "bold": true
    }
},

reproducible code

api := slack.New("YOUR_TOKEN")
resp, err := api.GetConversationHistory(&slack.GetConversationHistoryParameters{
    ChannelID: "ChannelID",
    Inclusive: true,
    Limit:     1,
    Oldest:    "timestamp_of_message_above",
})

manifest.yaml

Versions

Niraj-Fonseka commented 1 year ago

➕ getting the same error

kanata2 commented 1 year ago

It will be fixed in v0.12.