I'm sending messages into Slack via a web hook. Message notifications using a single "text" JSON element produce the correct notification text with the Slack app for OS X and iOS. The message text is also correct in the channel. However, when using the new "blocks" method, the notification text becomes "This content can't be displayed". The message does correctly show up in the channel. It's just the notification that is not working.
According to https://api.slack.com/messaging/composing/layouts the text in the first block is used for the notification:
When you're using blocks in your message payload, the text field becomes a fallback message displayed in notifications.
Without using the blocks style, this works:
curl -s -k -X POST https://hooks.slack.com/services/${webhook} -H 'Content-type: application/json' --data @- << EOF
{
"text": "${message}"
}
EOF
If you generate a simple blocks style equivalent using the block builder app at https://api.slack.com/tools/block-kit-builder by clearing out any existing code and then adding a Section block you will have something like this:
[
{
"type": "section",
"text": {
"type": "plain_text",
"text": "This is a plain text section block.",
"emoji": true
}
}
]
Now at the bottom of the page, enter your channel and click "Send to Slack". The result is that the text arrives in the channel correctly, however the notification that pops up contains the text "This content can't be displayed".
At first I thought that my own block style code was incorrect, however, this code that is generated by the block kit builder app does not work either which leads me to believe there is a problem/bug with Slack itself.
Or is there something that I have overlooked?
Thank you