send slack message from command line
2016-03-15 ::
( 1 minutes reading )
Install Incomming webhook to your channel https://api.slack.com/incoming-webhooks#sending_messages
you will then get some url https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
create /usr/local/bin/notifyme
#!/bin/sh
curl -X POST --data-urlencode "payload={\"channel\": \"#alert\", \"username\": \"mybot\", \"text\": \"$*\", \"icon_emoji\": \"📛\"}" https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX
and send message via your command line
$ chmod +x /usr/local/bin/notifyme
$ notifyme hello world!
# or after some command
$ sleep 5; notifyme process is finished
comments powered by Disqus