Skip to content

Instantly share code, notes, and snippets.

@rystaf
Last active December 7, 2021 08:58
Show Gist options
  • Save rystaf/98d49765e3d391a6f073a50e0bcaa6c0 to your computer and use it in GitHub Desktop.
Save rystaf/98d49765e3d391a6f073a50e0bcaa6c0 to your computer and use it in GitHub Desktop.
Gotify notifications for Windows 10 using BurntToast https://github.com/Windos/BurntToast
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
}
@12nick12
Copy link

12nick12 commented Oct 5, 2021

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