When running timely R jobs, you are now able to send yourself a notification for when the job is completed. Via a mobile application downloaded on your phone, R can send values and messages to your mobile device. There are other possible uses for this application. This is just a simple example of how to send yourself a notification using IF and R. This introduction is based on the full tutorial by Brian Connelly. Visit Connecting R to everything with IFTTT for more information on how to configure the ‘Maker’ channel.
First, create an IFTTT.com account and follow this tutorial for setting up the ‘Maker’ channel on the web.
After installation and account creation, create a new recipe using the ‘Maker’ channel.
Note: Your secret key can be saved as an R environment variable in the ~/.Renviron (~/_Renviron for Windows) file.
httr package to send URL requests. First create a basic url for the maker channel on IFTTT.com.library(httr)
my_event <- 'r_status'
my_key <- 'mytopsecretkey'
maker_url <- paste("https://maker.ifttt.com/trigger", my_event, "with/key", my_key, sep = "/")
The POST function from the httr package allows you to send bits of information via the web from R.
httr::POST(maker_url)
httr::POST(maker_url, body=list(value1 = "bonjour", value2="le monde", value3 = 7))
data(mtcars)
httr::POST(maker_url, body=list(value1="MPG and WT means",
value2 = mean(mtcars$mpg),
value3 = mean(mtcars$wt)))