cURL-ing Slack 发布借口和正文但不发布标题

cURL-ing Slack posts pretext and text but not title

curl -X POST -H 'Content-type: application/json' --data '{"title": "hello world", "pretext": "hello world", "text": "Hellow world", "channel": "#channel", "link_names": 1, "username": "GitLab"}' https://hooks.slack.com/services/TO/K/EN

以上将显示 "text" 和 "pretext" 但不显示标题。

它不会显示标题,因为普通消息没有标题属性。如果你想有一个标题,你需要在你的消息中添加一个附件。附件可以在许多其他花哨的属性中有一个标题。

有关附件的工作原理,请参阅 here