I have a PowerShell HTTP trigger wired up to a Slack command. If the PS trigger responds in < 3 seconds all is good. I've got this working
If it takes longer, Slack requires two things, respond immediately and then respond out of band on the response_url
.
This works. If I put a sleep 10
after the set-content
, neither return and Slack says it timed out.
Is there way to accomplish this in PowerShell?
@"
{
"response_type": "ephemeral",
"text": "Checking $(get-date) ..."
}
"@ | set-content $res -Encoding Ascii
The out of band works.
$b = @"
{
"response_type": "in_channel",
"text": "It's 80 degrees right now.",
"attachments": [
{
"text":"Partly cloudy today and tomorrow"
}
]
}
"@
Invoke-RestMethod $responseUrl -Method post -Body $b -ContentType "application/json"
The right pattern of doing that in Azure Functions is to have your HTTP trigger function just push a message in a queue, then return immediately. Then have another Azure Function that's listening on that queue and then run your logic there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With