We are using mattermost
as an internally hosted alternative to slack
.
How can I write to a channel in mattermost, for example by a script, using curl
?
I need to know:
curl
commandAn example of my script that works with slack
:
SLACK_URL='https://hooks.slack.com/services/my-long-integration-key'
message='Project XYZ was released successfully.'
curl -X POST -H "Content-Type: application/json" \
--data "{ \"channel\": \"#releases\", \"username\": \"$me\", \"text\": \"$MESSAGE\" }" \
$SLACK_URL &> /dev/null
Indeed there is a Mattermost API (equivalent to slack-api
) but I am struggling to a good example of what I want to do.
Thanks
Here's the format, using curl
and a json payload:
curl -i -X POST -d 'payload={"text": "Hello, world!", "username":"xxx", "channel":"yyy"}' \
https://mattermost.intern.mycompany.com/hooks/abcdefg1234567