Last active
November 11, 2016 16:45
-
-
Save markwragg/f7e45994b45fa3b295e4e5ae8b1b4243 to your computer and use it in GitHub Desktop.
Powershell Azure function for sending messages to Slack
This file contains 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
$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