Open legoboyvdlp opened 4 years ago
Does anyone have any ideas on this -- this is somewhat delaying my project until I can solve this :)
Unfortunately, I'm not well-versed with the newer Blocks APIs.
Afaik, we don't do any validation in the library and the messages just get serialized as-is and sent to Slack. It might be worthwhile to check other libraries or the official API for any hints on what's causing this.
It also might be worthwhile to view the raw responses with Fiddler4 or use the library directly and step through to see the raw response from the API to see if it contains any more descriptive error messages.
Hi, thank you in any case. I will try and inspect the serialized JSON to see what it shows :)
Ok, I got this, using a new script:
Block block = new Block(); Text text = new Text(); text.type = TextTypes.PlainText; block.type = BlockTypes.Section; text.text = "Test"; block.text = text; block.title = text; block.block_id = "test"; blocks[i] = block;
channel=#milcom-bot-test&text=:bubblealert: Test&blocks=[{"type":"section","block_id":"test","text":{"type":"plain_text","text":"Test"},"title":{"type":"plain_text","text":"Test"}},{"type":"section","block_id":"test","text":{"type":"plain_text","text":"Test"},"title":{"type":"plain_text","text":"Test"}},{"type":"section","block_id":"test","text":{"type":"plain_text","text":"Test"},"title":{"type":"plain_text","text":"Test"}},{"type":"section","block_id":"test","text":{"type":"plain_text","text":"Test"},"title":{"type":"plain_text","text":"Test"}}]
This is hard to read, but when imported to the slack Block Builder, I see that:
"title" is invalid for a block of type section: (Invalid additional property "title" error) Also, block ID must be unique.
I think there is a bug with the title element on your side, and a bug in the block ID on my side :)
So I will continue debugging, now moving on to try and add fields.
Hi,
I am having trouble sending a block message to slack. I wonder if someone could advise me what I am doing wrong? I can send ordinary messages just fine, but its these blocks that are giving problems. I was unable to find any example or documentation for this, but this, I understood should have worked...
My sendMessageAsync function is as such:
In each case I get _invalidblocks as an error.