'forward a message with slack API getting invalid_blocks error
I'm trying to simply get a message from one channel and forward it to another.
all I do is listen to messages on the channel, get the blocks, i.e.:
[{"type":"rich_text","block_id":"AHdW3","elements":[{"type":"rich_text_section","elements":[{"type":"text","text":"z"}]}]}]
and send them to another channel
client.chat.postMessage({
blocks: blocks,
channel: context.targetChannel,
});
I'm getting an invalid_blocks error, even tho this must be valid blocks since they are generated by slack themselves.
any ideas here?
I also tried to remove the block_id but got the same result.
I'm using bolt framework btw, but that shouldn't matter.
Solution 1:[1]
Turns out the blocks from 1st client slack apps are rich_text, which isn't supported in the api.
so the way to go is grab the text from the message and post that as is.
See here for context
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | goldylucks |
