Skip to content

Instantly share code, notes, and snippets.

@markwragg
Last active November 11, 2016 16:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markwragg/f7e45994b45fa3b295e4e5ae8b1b4243 to your computer and use it in GitHub Desktop.
Save markwragg/f7e45994b45fa3b295e4e5ae8b1b4243 to your computer and use it in GitHub Desktop.
Powershell Azure function for sending messages to Slack
$requestBody = Get-Content $req -raw
$requestBody = $requestBody.Replace('&',"`n")
$requestBody = ConvertFrom-StringData -StringData $requestBody
$Response = (Import-CSV "D:\home\site\wwwroot\Glossary\Glossary.csv") | Where-Object {$_.Term -like "$($requestBody.text)*"}
if(!$Response){Out-File -Encoding Ascii -FilePath $res -inputObject "Sorry, there is no match in the Glossary for *$($requestBody.text)*."}
$Response | ForEach-Object{
Out-File -Encoding Ascii -FilePath $res -inputObject "*$($_.Term):* $($_.Description)" -Append
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment