I\'m trying to send a message using Slack\'s chat.postMessage API call. I have no problems encoding my test messages within HTTP GET, but I\'m trying to achieve the same res
I did this in powershell and it works like a charm.
$url="https://slack.com/api/chat.postMessage"
$messageContent= # your message here
$token = # your token here
$channel = # channel name
$opt_username= # optional user name
$body = @{token=$token;channel=$channel;username=$opt_username;text=$messageContent;pretty=1}
try
{
Invoke-WebRequest -Uri $url -Method POST -Body $body
}
catch
{
Write-Host "StatusCode:" $_.Exception.Response.StatusCode.value__
Write-Host "StatusDescription:" $_.Exception.Response.StatusDescription
}