我正试着把文章上传到Slack频道,但它并没有像预期的那样工作。我在Slack中得到的唯一消息是Array,因为文本的值是Array。因为我了解他们的医生,所以不应该这么做。如果我将文本移动到数组的第一级,就会显示实际的文本,因此我猜测我的请求运行良好。我遗漏了什么?这是在PHP中用GuzzleHttpClient完成的。
我的信息:
[
'type' => 'section',
'text' => [
'type' => 'mrkdwn',
'text' => 'This is supposed to be my text'
]
]; 我对API的请求:
$request = $client->post($url, [
RequestOptions::JSON => $messages
]);发布于 2019-02-18 12:26:18
发布于 2019-06-05 13:53:36
正如@ncla所提到的,如果您使用的是“块UI”元素,使用传入的web钩子API,则不能像使用chat.postMessage那样发送块。
这在块文档中并不明显,但是在消息有效负载页中它指定您可以发送一个blocks属性。这将允许您使用块结构。
发布于 2019-02-16 15:28:05
您的结构不正确,请参阅文档:https://api.slack.com/messaging/composing/layouts#stack-of-blocks
它应该是消息块数组,您需要再嵌套一次。
[
[
'type' => 'section',
'text' => [
'type' => 'mrkdwn',
'text' => 'This is supposed to be my text'
]
]
];https://stackoverflow.com/questions/54711508
复制相似问题