Last active
December 7, 2021 08:58
-
-
Save rystaf/98d49765e3d391a6f073a50e0bcaa6c0 to your computer and use it in GitHub Desktop.
Gotify notifications for Windows 10 using BurntToast https://github.com/Windos/BurntToast
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
param ($domain="p.domain.com", $token="AAAAAAAA") | |
wscat -c "wss://$domain/stream?token=$token" | %{ convertfrom-json $_ } | where-object {$_.message.length -gt 0} | | |
%{ | |
$appid = $_.appid | |
$icon = iwr https://$domain/application?token=$token | | |
%{ (convertfrom-json $_.content) } | where-object {$_.id -eq $appid} | select -expandproperty image | |
new-burnttoastnotification -applogo https://$domain/$icon -Text $_.title, $_.message | |
} |
I'm having an issue getting wscat working on Windows. It only works in the node terminal (I'm a bit of a node noob). Is there a way to connect to the websocket using pure powershell instead of the node app?
Edit: Ah, I needed to reboot. Duh it's windows you always have to reboot. Still would like to see if there's a way for pure powershell?
Not sure if you figured it out, but to use it without node you can use websocat which can be downloaded HERE instead of wscat.
Here's is my working example. I also added -UseBasicParsing
param ($domain="p.domain.com", $token="AAAAAAAA")
C:\Users\user\Downloads\websocat_win64.exe "wss://$domain/stream?token=$token" | %{ convertfrom-json $_ } | where-object {$_.message.length -gt 0} |
%{
$appid = $_.appid
$icon = iwr https://$domain/application?token=$token -UseBasicParsing|
%{ (convertfrom-json $_.content) } | where-object {$_.id -eq $appid} | select -expandproperty image
new-burnttoastnotification -applogo https://$domain/$icon -Text $_.title, $_.message
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can add this script as a scheduled task that runs at logon (check "Run whether user is logged in or not to hide window") and the action starts
powershell.exe
with the following arguments-file C:\path\to\gotify.ps1 -domain p.domain.com -token AAAAAAAAA