- Notifications
You must be signed in to change notification settings - Fork18
R interface to the awesome Pushbullet service
eddelbuettel/rpushbullet
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
RPushbullet is an R client for the wonderfulPushbullet messaging / notification system.
Pushbullet is an awesome (and free) littleservice that acts as a message broker. You sign up, and get a key to use theAPI. You then install the "app" on your smartphone or Chrome browser (andobtain a device id for of these). You can also query your account with thepbDevices() function to retrieve these ids.
Presto. Now you can send messages between them by invokingpbPost().
With a resource file (see below) properly setup, you can just do something 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 (if messaging directed to the browser):
Another excellent use case was suggested years ago byKarl Broman inthis blog post. We canimprove on his version a little as one no longer needs 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: it suggested to make the messagesomewhat saltier by relying on the helpfulrfoaas package.
Package documentation, help pages, a vignette, and more is availablehere.
The package is reasonably mature and functional.
Up until release 0.2.0, an externalcurl binary was used. We have since switched to usingthecurl package.
Given that thePushbullet API has other nice features, futureextensions are certainly possible 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 API key and deviceidentifiers to the package. The content is read upon package startup, andstored in a package-local environment. The format of 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 are optional. See the main packagehelp 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 alsoavailable to create the file.
You can also retrieve the ids of your devices with thepbGetDevices()function by calling, say,str(fromJSON(pbGetDevices())). Note that youneed to load one of the packagesRJSONIO orrjson orjsonlite to accessthefromJSON() function.
Pushbullet has recently addedchannelsto their API. These are notification feeds that user can subscribe to, andwhich allows 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, onecan easily create a new channel by clicking the "add channel" button. Therewill be a prompt to enter a 'tag', a channel name, as well as adescription. Thechannel_tag is what is needed to push posts to thechannel. Currently, only the owner of a channel has permissions to post tothat channel, so one will need to create the channel using the same login onehas specified in~/.rpushbullet.json in order to use RPushbullet to post toa channel.
Channels are public: Anyone who knows the channel 'tag' can subscribe andwill therefore receive all messages pushed to that channel. Some users createhard-to-guess channel tags to achieve semi privacy. This works because it is,currently as of February 2015, neither possible to list the channels owned bya specific user nor possible to browse or search for other users' channels.One method to generate a hard-to-guess tag isdigest::digest(rnorm(1)).
Channels can be used by passing achannel argument to thepbPostfunction. The Pushbullet API identifies a channel via thesuppliedchannel_tag value of this argument. See thePushes API documentation for moreinformation.
Dirk Eddelbuettel with contributions by Bill Evans, Mike Birdgeneau, HenrikBengtsson, Seth Wenchel, Colin Gillespie and Chan-Yub Park.
GPL (>= 2)
About
R interface to the awesome Pushbullet service
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors10
Uh oh!
There was an error while loading.Please reload this page.
