Created
November 28, 2023 23:12
-
-
Save deadlydog/3cb41ce2994eaa16c10ddfac19b08290 to your computer and use it in GitHub Desktop.
PowerShell snippet for testing a Slack 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
# 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