Last active
November 22, 2017 21:07
-
-
Save ErikHen/c61c9ec228c8e099af0dbfb96bd75dbf to your computer and use it in GitHub Desktop.
PowerShell function that sends a message to Slack
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function NotifySlack($webhookurl, $channel, $message) | |
{ | |
$payload = @{ | |
"channel" = $channel | |
"icon_emoji" = ":robot_face:" | |
"text" = $message | |
"username" = "Mr. Robot" | |
} | |
Invoke-WebRequest -UseBasicParsing -Body (ConvertTo-Json -Compress -InputObject $payload) -Method Post -Uri $webhookurl | Out-Null | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment