This guide will help you get started with pushoverr. In just a few minutes, you’ll be able to send rich notifications to your mobile devices, desktop, and even watches.
First, you’ll need an account with Pushover. Once you have that, log in and register an application. You should now have two codes—a user key and an API token/key. These are what identify you and your app(s) to Pushover. You’ll pass these along to pushoverr whenever you send a message. You’ll also need the Pushover app for iOS, Android, or your desktop.
If you haven’t already installed pushoverr, start an R session and run:
install.packages("pushoverr")
Now, let’s load the package:
library(pushoverr)
By default, pushoverr will prompt you for your key and app token when needed and save them for all subsequent commands. You can directly tell pushoverr your key and token using set_pushover_user
and set_pushover_app
. For example:
set_pushover_user(user = "uQiRzpo4DXghDmr9QzzfQu27cmVRsG")
set_pushover_app(token = "azGDORePK8gMaC0QOYAMyEEuzJnyUi")
You’ll need to use your own user key and app token.
pushoverr will forget these as soon as you end your session, so you’ll have to re-run these commands each time you restart R.
Alternatively, you can store your keys in your .Renviron
. If you have usethis, run usethis::edit_r_environ()
.
= "uQiRzpo4DXghDmr9QzzfQu27cmVRsG"
PUSHOVER_USER = "azGDORePK8gMaC0QOYAMyEEuzJnyUi" PUSHOVER_APP
With this approach, your keys will be set whenever you use R. pushoverr will use these keys by default, but they can easily be overridden by supplying different values as arguments.
Now that your credentials are configured, you’re ready to send your first message.
pushover(message = "Mr. Watson--come here--I want to see you.")
Within just a few seconds, your phone/tablet/watch/whatever should be abuzz with this historic message.
Using other arguments to pushover
, you can configure other aspects of your message, including sounds, links, and message priorities.
The message
and title
arguments are evaluated with glue()
, so you can add more context:
pushover(message = "Don't forget... {praise::praise()}")
Images such as plots can also be sent as attachments.
pushover(
message = "Look at those gentoos!",
attachment = "penguins.png"
)
The full-size image can be seen in the app.
Messages can be given different priorities ranging from silent to emergency. Quiet messages arrive without playing a sound, high priority messages arrive with a reddish background, and emergency messages arrive and repeat until they’ve been acknowledged. pushoverr
provides easy methods for sending these:
pushover_quiet(message = "The kittens are sleeping")
Or more urgently:
<- pushover_emergency(message = "The kittens are awake, and they are ANGRY!") msg
Emergency messages return a receipt token that can be checked with is.acknowledged()
to see whether or not it has been seen.
is.acknowledged(receipt = msg$receipt)
Pushover can now show data on constantly-updated screens like your smartwatch or lock screen (where supported). Using update_glance
, you can push short text messages, numbers, and percentages to your watch right from within R.
update_glance(count = 88)
Additional pieces of information can be shown depending on your chosen watch face and complications.
<- 74.0
speed <- 1.21
current_power_gw
update_glance(
count = speed,
percent = speed / 88.0,
text = "Great Scott!",
title = "{current_power_gw} Gigawatts",
subtext = "gonna see some serious sh*t"
)
Note that these updates should be done infrequently—no more than once every 20 minutes or so—or WatchOS will stop processing updates to promote battery life. If you encounter problems, WatchOS resets this limit overnight.