Skip to content

Instantly share code, notes, and snippets.

@akhilvatts
Created August 17, 2019 07:53
Show Gist options
  • Save akhilvatts/55a728a4d2a2f155d9194ffb01c4aecc to your computer and use it in GitHub Desktop.
Save akhilvatts/55a728a4d2a2f155d9194ffb01c4aecc to your computer and use it in GitHub Desktop.
Script to send Message to Slack and Mattermost
$payload = @{
"channel" = "#channel"
"icon_emoji" = ":fire:"
"text" = "Hello there! I guess there's something wrong. Would you please mind checking the API system."
"username" = "Mr. API System"
}
Invoke-RestMethod `
-Body (ConvertTo-Json -Compress -InputObject $payload) `
-Method Post `
-ContentType 'application/json' `
-Uri "https://hooks.collabservice.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