I'm trying to run a rule in Outlook that runs a VBScript which calls a Slack.com webservice and updates one of my Slack Channels with a specific message. Current state -- i just want it to post a static message. Future state i'm going to try to use RegEx to parse out certain data from the email and post it to my slack channel.
From frankensteining a few scripts i found online, this is what i have (but doesn't quite work) Hoping someone can help...
Function ProcessSend()
Set oXMLHTTP = CreateObject("MSXML2.XMLHTTP.4.0")
Set oXMLDoc = CreateObject("MSXML2.DOMDocument")
strEnvelope = "payload={""channel"": ""#edt-error"", ""text"": ""This is posted to #edt-error.""}"
Call oXMLHTTP.Open("POST", "https://custom-slack-url-for-service-goes-here.com" & posFirm, False)
Call oXMLHTTP.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
Call oXMLHTTP.Send(strEnvelope)
Dim szResponse: szResponse = oXMLHTTP.responseText
Call oXMLDoc.LoadXML(szResponse)
If (oXMLDoc.parseError.ErrorCode <> 0) Then
'call msgbox("ERROR")
response = oXMLHTTP.responseText&" "&oXMLDoc.parseError.reason
'call msgbox(oXMLDoc.parseError.reason)
Else
response = oXMLDoc.getElementsByTagName("string")(0).ChildNodes(0).Text
End If
End Sub