slack icon indicating copy to clipboard operation
slack copied to clipboard

Can you add button confirm

Open zz opened this issue 4 years ago • 2 comments

https://github.com/slack-go/slack/blob/792f7ed7aeae758f493239a9c50bb5d18eefc46e/block_element.go#L171

zz avatar Nov 21 '21 05:11 zz

Please give more details.

kanata2 avatar Nov 21 '21 18:11 kanata2

Confirmation buttons are supported, unless you're asking about something different? This example code works in our apps home page and pops open a confirmation Modal once a user hits the "Submit" button.

approveReqButton := slack.ButtonBlockElement{
	Type:     slack.METButton,
	Text:    &slack.TextBlockObject{
		Type: slack.PlainTextType,
		Text: "Submit",
	},
	ActionID: actionIDUserSubmitted,
	Value:    formattedValue,
	Style:    slack.StylePrimary,
	Confirm:  slack.NewConfirmationBlockObject(
		&slack.TextBlockObject{
			Type: slack.PlainTextType,
			Text: "Confirm Submit",
		},
		&slack.TextBlockObject{
			Type: slack.PlainTextType,
			Text: "Are you sure you want to submit?",
		},
		&slack.TextBlockObject{
			Type: slack.PlainTextType,
			Text: "Yes",
		},
		&slack.TextBlockObject{
			Type: slack.PlainTextType,
			Text: "No, take me back",
		}),
}

HunterL avatar Dec 09 '21 15:12 HunterL