Anyway, you sign up and get an api token for the devices you want to send FROM and a user key which is tied to your account. I set to scripting a function to send messages the same way I was sending with SMS and here is what I came up with. They have more options like groups and custom chimes and whatever, but for this purpose - administrative automated notifications - I don't need any of that stuff.
There are only 2 variables: pMsg (message - required) and pUrl (URL - optional). The url is handy for me because I log a lot of stuff to database and have various php scripts to display the contents. I use YoURLs to provide short links suitable for SMS. The url is separate. You could include it in the message, which is what I was doing before, but since they offered it separately....
Anyway, here's the script. It's working. I will add some event logging later.
Code: Select all
Option Explicit
Private Const PushoverApiKey = "lkjasdflkjasdflkjsdflkjljksdfl"
Private Const PushoverUserKey = "lkasjdflkjasdflkjsdflkjsdflkjs"
Function SendPushover(pMsg, pUrl)
Dim Request, Url, postData
Set Request = CreateObject("MSXML2.ServerXMLHTTP.6.0")
Url = "https://api.pushover.net/1/messages.json"
Request.Open "POST", Url, False
Request.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
postData = "token=" & PushoverApiKey & "&user=" & PushoverUserKey & "&message=" & pMSG & "&url=" & pUrl
Request.send postData
End Function
Dim pMsg, pUrl
pMsg = "This is the message to send"
pUrl = "https://short.link.tld/Random" ' can be left blank or left out altogether
Call SendPushover(pMsg, pUrl)