Created
July 12, 2020 23:32
-
-
Save Kevin7020/640b34853e0c12a8229e3ff079341eb7 to your computer and use it in GitHub Desktop.
POST request using powershell and a dynamic JSON body to a discord webhook
This file contains hidden or 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
| # Base post example taken from here https://www.jokecamp.com/blog/invoke-restmethod-powershell-examples/ | |
| function Send-DiscordNotif($text, $webhook) { | |
| $json = @{ | |
| content=$text | |
| } | |
| $body = $json | ConvertTo-Json | |
| $response = Invoke-RestMethod -Method Post -Uri $webhook -Body $body -ContentType 'application/json' | |
| $response | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment