joshooaj / poshover Goto Github PK
View Code? Open in Web Editor NEWA PowerShell module for sending notifications / messages using the Pushover API
License: MIT License
A PowerShell module for sending notifications / messages using the Pushover API
License: MIT License
Pushover supports a number of different notification sounds. They have an API for retrieving them, and there's an optional messages parameter to specify the desired sound. This could be used to differentiate between different types of notifications or priorities.
I want to take an emergency message receipt and check the state of that message using the receipt. Has it been acknowledged? When and by who?
I might want to have a Wait-PushoverAcknowledgement -Receipt $receipt
which blocks until the receipt is acknowledged or it expires.
It might be nice to be able to set a default user/group id so that if you also have a default application token, you could simply use Send-Pushover -Message 'funny business'
and the token/user parameters would be applied implicitly.
And if you could set a friendly name for different user/group IDs, you could do Send-Pushover -User Oncall
and the actual ID for the user/group would be resolved in the background by reading it in from an encrypted configuration file.
Verbose output includes the HTTP request message body and the token & user values are both leaked in Verbose output. Since the current design is using securestring to protect these values both in the terminal and on disk, it doesn't make sense to let these values leak in verbose output.
One might consider the message body to be unneeded in verbose output, so we could remove the Write-Verbose all together. However, for troubleshooting purposes it can be very valuable to see HTTP request body since it can be challenging to see it in a network trace against an HTTPS endpoint. So my preference is to replace the values with the * symbol before the call to Write-Verbose.
Function name is just a working name. The idea is that if you have a default application API token set, you could call Send-Pushover without a token.
The token should be encrypted and saved to disk, probably under the appdata folder. Use ConvertFrom-SecureString or use the .net dpapi classes directly using CurrentUser scope.
If no default is set, an error is thrown when using Send-Pushover without a token.
I recently heard about PlatyPS for doing help documentation in markdown syntax. Haven't used it yet but this seems like a great project to try it out on. This would help declutter the functions as well which I appreciate.
Is your feature request related to a problem? Please describe.
When an image is in a file on the filesystem, you currently have to read that file into a byte array before providing it in the Attachment parameter of Send-Pushover.
Describe the solution you'd like
I want to be able to either pass a byte array or a file path. If a file is on disk, it would save a step before sending the notification.
Right now the functions sending HTTP requests each have their own HTTP response handling where we check for an exception on the Invoke-RestMethod and pull out the API response if it's buried in the exception, and then we process the response to see if it was successful, and if not, we generate an error.
All that response handling makes these functions longer than necessary and is duplicate code. I'd like to see the responses be handled uniformly by a private function before we go down the happy path of extracting whatever information was needed from the response in that particular function.
The user may want to verify the user ID they are sending a message to is valid and Pushover provides an API for this.
Add a function like Test-PushoverUser which takes the user ID and optionally a device name, and tests whether that user is valid.
The user may want a simple boolean result, or they may want to see a detailed response including an error message if available, and whether the user ID is for a group.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.