Skip to content

Instantly share code, notes, and snippets.

@deadlydog
Created November 28, 2023 23:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deadlydog/3cb41ce2994eaa16c10ddfac19b08290 to your computer and use it in GitHub Desktop.
Save deadlydog/3cb41ce2994eaa16c10ddfac19b08290 to your computer and use it in GitHub Desktop.
PowerShell snippet for testing a Slack webhook
# This code shows how to easily test a Slack webhook from PowerShell. The URL here is a dummy URL.
$slackUri = "https://hooks.slack.com/services/T025sdfsdfsdf/B67sdfsdfsdf/khAfsdfsfsfsdfsdfsdf"
$body = ConvertTo-Json @{
pretext = "Testing Slack integration"
text = "This is just a test to ensure the Slack webhook works and sends messages to the correct Slack channel."
color = "#142954"
}
Invoke-RestMethod -Uri $slackUri -Method Post -Body $body -ContentType 'application/json'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment