RPushbullet is an R client for the wonderfulPushbullet messaging / notificationsystem.
Pushbullet is an awesome (andfree) little service that acts as a message broker. You sign up, and geta key to use the API. You then install the “app” on your smartphone orChrome browser (and obtain a device id for of these). You can also queryyour account with thepbDevices() function to retrievethese ids.
Presto. Now you can send messages between them by invokingpbPost().
With a resource file (see below) properly setup, you can just dosomething like the following
R> msg# just an example, can be driven by real simulation results[1]"DONE after 10000 simulations taking 42.43 minutes reducing RMSE by 7.89 percent"R>R> RPushbullet::pbPost("note",title="Simulation complete",body=msg)and a message like the image following below should pop up (ifmessaging directed to the browser):

Another excellent use case was suggested years ago byKarl Broman inthisblog post. We can improve on his version a little as one no longerneeds to load the package:
options(error =function() { RPushbullet::pbPost("note","Error",geterrmessage())if(!interactive())stop(geterrmessage())})There was one noteworthy follow-up for which I lost the source: itsuggested to make the message somewhat saltier by relying on the helpfulrfoaaspackage.
The package is reasonably mature and functional.
Up until release 0.2.0, an externalcurl binary wasused. We have since switched to using thecurl package.
Given that thePushbulletAPI has other nice features, future extensions are certainlypossible and encouraged. Interested contributors should file issuetickets first to discuss before going off on pull requests.
A file~/.rpushbullet.json can be used to pass the APIkey and device identifiers to the package. The content is read uponpackage startup, and stored in a package-local environment. The formatof this file is as follows:
{ "key": "...placey your api key here...", "devices": [ ".....device 1 id......", ".....device 2 id......", ".....device 3 id......" ], "names": [ "...name1...", "...name2...", "...name3..." ], "defaultdevice": "...nameOfYourDefault..."}Thenames anddefaultdevice fields areoptional. See the main package help page for more details.
You can also create the file programmatically via
cat(jsonlite::toJSON(list(key="..key here..",devices=c("..aa..","..bb.."))))and write that content to the file~/.rpushbullet.json.
Starting with release 0.3.0, a new helper functionpbSetup() is also available to create the file.
You can also retrieve the ids of your devices with thepbGetDevices() function by calling, say,str(fromJSON(pbGetDevices())). Note that you need to loadone of the packagesRJSONIO orrjson orjsonlite to access thefromJSON()function.
Pushbullet has recently addedchannels to their API.These are notification feeds that user can subscribe to, and whichallows the developer to create (per-topic) channels for variousapplications / topics that her users can subscribe to.
Creating a channel is easy: one simply needs to login and visit theMy Channel page.From there, one can easily create a new channel by clicking the “addchannel” button. There will be a prompt to enter a ‘tag’, a channelname, as well as a description. Thechannel_tag is what isneeded to push posts to the channel. Currently, only the owner of achannel has permissions to post to that channel, so one will need tocreate the channel using the same login one has specified in~/.rpushbullet.json in order to use RPushbullet to post toa channel.
Channels are public: Anyone who knows the channel ‘tag’ cansubscribe and will therefore receive all messages pushed to thatchannel. Some users create hard-to-guess channel tags to achieve semiprivacy. This works because it is, currently as of February 2015,neither possible to list the channels owned by a specific user norpossible to browse or search for other users’ channels. One method togenerate a hard-to-guess tag isdigest::digest(rnorm(1)).
Channels can be used by passing achannel argument tothepbPost function. The Pushbullet API identifies achannel via the suppliedchannel_tag value of thisargument. See thePushes APIdocumentation for more information.
Dirk Eddelbuettel with contributions by Bill Evans, Mike Birdgeneau,Henrik Bengtsson, Seth Wenchel, Colin Gillespie and Chan-Yub Park.
GPL (>= 2)
Initially created: Wed Jun 3 18:06:25 CDT 2014
Last modified: Sun May 26 10:25:41 CDT 2024