Last active
February 13, 2021 01:09
-
-
Save magnetikonline/11007e42d86f490b84f8 to your computer and use it in GitHub Desktop.
PowerShell push message to Slack incoming webhook.
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
Set-StrictMode -Version Latest | |
$payload = @{ | |
"channel" = "#my-channel" | |
"icon_emoji" = ":bomb:" | |
"text" = "This is my message. Hello there!" | |
"username" = "Mr. Robot" | |
} | |
Invoke-WebRequest ` | |
-Body (ConvertTo-Json -Compress -InputObject $payload) ` | |
-Method Post ` | |
-Uri "https://hooks.slack.com/services/HOOK_API_SLUG" | Out-Null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks @pixelbath, nicely noted 👍