Sending a Slack Message (without a library)
·
275 words
·
2 minutes read
Programs often need to notify us of events and using services like Slack, Hipchat (or even email) make this convenient for us. This code snippet is a way of sending a message to Slack via an Incoming Webhook - you can set these up in the Slack Apps area. All you need is to set the incoming webhook url and change the text to be anything you want.
It does include a timeout (of 10 seconds) if something happens to Slack response times for any reason. It also checks that the response doesn’t return an error.
|
|