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:
Now, let’s load the package:
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()
.
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.
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:
Images such as plots can also be sent as attachments.
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:
Or more urgently:
Emergency messages return a receipt token that can be checked with
is.acknowledged()
to see whether or not it has been
seen.
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.
Additional pieces of information can be shown depending on your chosen watch face and complications.
speed <- 74.0
current_power_gw <- 1.21
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.