slack-go/slack

Unable to render buttons using slack.Attachment

Closed this issue · 2 comments

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

  • Go: 1.21.0
  • slack-go/slack: v0.12.5

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

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.