1
我正在尋找一個使用HttpClient發佈到Slack頻道的PowerShell代碼的簡單示例。如何發佈郵件到Powershell的Slack
我正在尋找一個使用HttpClient發佈到Slack頻道的PowerShell代碼的簡單示例。如何發佈郵件到Powershell的Slack
Add-Type -AssemblyName System.Net.Http
$http = New-Object -TypeName System.Net.Http.Httpclient
$message = "Hello world."
$httpMessage = "{""text"": """ + $message + """}";
$content = New-Object -TypeName System.Net.Http.StringContent($httpMessage)
$httpResult = $http.PostAsync("https://hooks.slack.com/services/your_channel_url_here", $content).Result