Search code examples
curlslackslack-api

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

The above will show the "text" and "pretext" but not the title.


Solution

  • It won't show a title, because there is no title property for normal messages. If you want to have a title, you will need to add an attachment to your message. Attachments can have a title among many other fancy properties.

    See here for how attachments work.