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.66k stars 1.14k forks source link

Unable to render buttons using slack.Attachment #1270

Closed talaniz closed 7 months ago

talaniz commented 7 months ago

What happened

I'm following this example but the buttons do not render only the text.

image

Expected behavior

Two buttons should appear in the message corresponding to the buttons I've configured.

Steps to reproduce

Add the handler code below in a websocket example, register a slash command, run the bot and trigger the slash command.

reproducible code

func handleIsArticleGood() (interface{}, error) {
    attachment := slack.Attachment{
        Text:       "Would you like to see the most recent scores?",
        CallbackID: "ask_us",
        Color:      "#666666",
        Actions: []slack.AttachmentAction{
            slack.AttachmentAction{
                Name:  "action",
                Text:  "No thanks!",
                Type:  slack.ActionType("button"),
                Value: "no",
            },
            slack.AttachmentAction{
                Name:  "action",
                Text:  "Yes, please!",
                Type:  slack.ActionType("button"),
                Value: "yes",
            },
        },
    }
    return attachment, nil

manifest.yaml

Versions

talaniz commented 7 months ago

I'm not 100% confident this is a bug on the Slack library so I've posted in Stack Overflow as well.

talaniz commented 7 months ago

I was able to figure out how to render the buttons, but am unable to receive the payload. I've opened a separate issue to inquire about this. Closing out.