diff --git a/content/posts/dead-simple-notifications-with-pushover.md b/content/posts/dead-simple-notifications-with-pushover.md index a3d8e9b..8c814a8 100644 --- a/content/posts/dead-simple-notifications-with-pushover.md +++ b/content/posts/dead-simple-notifications-with-pushover.md @@ -1,6 +1,6 @@ +++ date = '2026-05-29T16:25:23-05:00' -draft = true +draft = false title = 'Dead Simple Notifications With Pushover and shell' +++ @@ -18,16 +18,23 @@ client for desktop users. There is also a growing list of [plugins](https://pushover.net/apps) for popular applications. Pushover provides a simple [HTTP API](https://pushover.net/api). Used in combination with the mobile application, users can build simple but effective notification -systems. The Pushover mobile app is free to use for 30 days after which users -will have to pay a small one-time [fee](https://pushover.net/pricing) of $5 -per platform to continue using the service. +systems. + +### Cost and Limitations + +The API allows up to 10,000 messages per month at no additional cost. Once +that limit is reached, blocks of additional capacity can be +[purchased](https://pushover.net/settings/upgrade). The mobile application +itself has a 30-day free trial, after which there is a one-time +[fee](https://pushover.net/pricing) of $5 per platform. ## Getting Set Up To get started the user will need a Pushover account. Head to -[pushover.net](https://pushover.net) and register. Once the user has an -account, install the app on the phone and log in. This provides a user key, -which identifies where notifications will be delivered. +[pushover.net](https://pushover.net) and register. The user key is displayed +in the dashboard after registration and identifies where notifications will +be delivered. Install the mobile application and log in to start receiving +notifications on the phone. Next the user needs to create an application. In the Pushover dashboard, click "Create an Application/API Token". Give it a name like "server-scripts" @@ -37,7 +44,7 @@ application. The user will need both the user key and the API token to send notifications. Keep them somewhere safe. -## Sending Your First Notification +## Sending the First Notification The simplest way to send a Pushover notification is with `curl`. This is a good way to verify the credentials are working before integrating @@ -55,15 +62,15 @@ Replace `YOUR_API_TOKEN` and `YOUR_USER_KEY` with the values from the Pushover dashboard. If everything is configured correctly, a notification will appear on the phone within seconds. -Pushover's API supports a number of additional parameters including message +Pushover's API supports a number of additional parameters, including message title, priority, and sound. See the [Pushover example code page](https://support.pushover.net/i44-example-code-and-pushover-libraries) for examples in other languages. ## Custom Notification Script -Rather than typing out the full `curl` command every time, it can be wrapped -in a simple shell script. This gives a reusable command that can be called +Rather than including the full `curl` command in every script, it can be wrapped +in a shell script of its own. This gives a reusable command that can be called from any other script on the system. ```bash @@ -80,15 +87,18 @@ PUSHOVER_USER="YOUR_USER_KEY" https://api.pushover.net/1/messages.json ``` -Save this as `notify.sh`, make it executable, and place it somewhere in the -path: +Save this as `notify.sh` and make it executable: ``` chmod +x notify.sh -mv notify.sh ~/.local/bin/ ``` -The user can now send a notification from anywhere on the system: +Place it in a directory that is in the path of the user that will be running +the notification scripts. On Linux `~/.local/bin` is a common choice. On +macOS `/usr/local/bin` is typical. Run `echo $PATH` to see what directories +are currently in the user's path. + +With the script in place, sending a notification looks like this: ``` notify.sh "Testing notifications" "My first notification!"