Poshover - A PowerShell Module for Pushover
Table of Contents
About The Project
If you want to send push notifications to one or more mobile or desktop devices from PowerShell, that's exactly what this module is about. The module makes use of the Pushover.net notification service which is free for up to 10k notifications per month!
The goal of the module is to support as much of the Pushover API as possible. To start with, the messages endpoint is be supported using the Send-Pushover function, and the most common features including message priority, retry interval, expiration, and attachment capabilities are available.
Later, support will be added for additional features like checking receipt status, listing and specifying notification sounds, and other API areas like subscriptions, groups, licensing, etc.
Before you use Poshover and the Pushover API, you need a Pushover account and an application token.
You need a Pushover account, a user or group key to which messages will be sent, and an application token to which
- Go sign up (for free) on Pushover.net and confirm your email address.
- Copy your user key and save it for later.
- Scroll down to Your Applications and click Create an Application/API Token.
- Give it a name (this will be the title of your push notifications when you don't supply your own title)
- Pick an icon. It's optional, but you really want your own icon :)
- Read the ToS and check the box, then click Create Application
- Save your API Token/Key for later. You're ready to install and click Back to apps or click on the Pushover logo in the title bar
Launch an elevated PowerShell session and run the following:
Install-Module -Name Poshover -AllowPrerelease
If that failed, you may need to update your PowerShellGet package provider. Try this:
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 Install-PackageProvider -Name NuGet -Force Install-Module -Name PowerShellGet -Force Install-Module -Name Poshover -AllowPrerelease
Got your application token and user keys handy? Good!
$token = Read-Host -Prompt 'Application API Token' -AsSecureString $user = Read-Host -Prompt 'User Key' -AsSecureString Send-Pushover -Token $token -User $user -Message 'Have a nice day!'
Don't want to enter your token and user keys every time? You don't have to!
# This will securely save your token and user keys to %appdata%/Poshover/config.xml $token = Read-Host -Prompt 'Application API Token' -AsSecureString $user = Read-Host -Prompt 'User Key' -AsSecureString Set-PushoverConfig -Token $token -User $user Send-Pushover -Message 'You are fantastic!'
The structure of the PowerShell module is such that the .\src\ directory contains the module manifest, .psm1 file, and all other functions/classes/tests necessary. The "build" process takes the content of the .\src\ directory, copies it to .\output\Poshover\version, and updates the module manifest to ensure all classes and functions are exported properly.
To build, simply run
Invoke-psake build from the root of the project. And to test, run
I like to also setup VSCode to launch .\debug.ps1 when I press F5. This will clear the .\output\ directory and call the psake build task, then force-import the updated module from the .\output\ directory. I find this makes the developer "inner-loop" really quick.
Also, I recommend using the Microsoft.Powershell.SecretManagement module for storing your api keys. That way you never enter them in clear text.
See the open issues for a list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature)
- Commit your Changes (
git commit -m 'Add some AmazingFeature')
- Push to the Branch (
git push origin feature/AmazingFeature)
- Open a Pull Request
Distributed under the MIT License. See
LICENSE for more information.
Josh Hendricks - @joshooaj
Project Link: https://github.com/jhendricks123/Poshover