我正在通过一个网络钩子把信息发送到Slake.使用单个"text"JSON元素的消息通知使用OSX和iOS上的Slake应用程序生成正确的通知文本.消息文本在频道中也是正确的.但是,当使用新的"BLOCKS"方法时,通知文本变成"此内容无法显示".消息确实正确显示在通道中.只是通知不起作用.
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.
如果不使用"块"样式,则可以执行以下操作:
curl -s -k -X POST https://hooks.slack.com/services/${webhook} -H 'Content-type: application/json' --data @- << EOF
{
"text": "${message}"
}
EOF
如果您使用挡路生成器应用程序,通过清除任何现有代码,然后添加一个节挡路来生成一个简单的块样式类似功能,您将得到如下所示:
[
{
"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".
起初我认为我自己的挡路样式代码是不正确的,然而,这个由挡路工具包生成器应用程序生成的代码也不起作用,这让我相信SLACK本身存在问题/bug.
还是我忽略了什么?
谢谢