Skip to content

Instantly share code, notes, and snippets.

@itsXactlY
Forked from magnetikonline/example.ps1
Created February 13, 2021 01:09
Show Gist options
  • Save itsXactlY/2f329b485d825f02435ae2e1f174e958 to your computer and use it in GitHub Desktop.
Save itsXactlY/2f329b485d825f02435ae2e1f174e958 to your computer and use it in GitHub Desktop.
PowerShell push message to Slack incoming webhook.
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