slack icon indicating copy to clipboard operation
slack copied to clipboard

Not possible to set initial value of RichTextInputBlockElement due to wrong type

Open matcornic opened this issue 10 months ago • 1 comments

Hello maintainers,

First, thanks a lot for this lib, it's very useful for us. I encountered a bug: I can't set an initial value for the RichTextInputBlockElement due the type being a string and not a Rich text object

What happened

I tried to use this code, which is compiling on :

	elem := slack.NewRichTextInputBlockElement(nil, "test")
	elem.InitialValue = "test"
	elemInput := slack.NewInputBlock("", slack.NewTextBlockObject("plain_text", "Test:", false, false), nil, elemInput)

But got an invalid_block error on Slack while checking the generated json on the Block kit builder

https://app.slack.com/block-kit-builder/T02F6HSJU2H#%7B%22blocks%22:%5B%7B%22type%22:%22header%22,%22text%22:%7B%22type%22:%22plain_text%22,%22text%22:%22Test%22%7D%7D,%7B%22type%22:%22input%22,%22label%22:%7B%22type%22:%22plain_text%22,%22text%22:%22RulTestes:%22%7D,%22element%22:%7B%22type%22:%22rich_text_input%22,%22action_id%22:%22test%22,%22initial_value%22:%22test%22%7D%7D%5D%7D

image

Seeing the documentation, it expects a Rich text object https://api.slack.com/reference/block-kit/block-elements#rich_text_input

Versions

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

matcornic avatar Apr 11 '24 12:04 matcornic