caff <- function(type) {
airtable_url <- "https://api.airtable.com/v0/app0OL9RLDepolg5k/caffeine_events"
request <- httr::POST(
url = airtable_url,
httr::add_headers(Authorization = paste("Bearer",
keyring::key_get("airtable-api"))),
httr::content_type_json(),
body = list("fields" = list("caffeine_string" = type)),
encode = "json"
)
status <- httr::http_status(request)[["reason"]]
notify_send <- "C:\\Users\\dlbride\\notify-send.exe"
substr(type, 1, 1) <- toupper(substr(type, 1, 1))
ns_args <- c(paste(type, "Status:"), status)
ps <- sys::exec_background(notify_send, ns_args, std_out = FALSE, std_err = FALSE)
on.exit(Sys.sleep(1), add = TRUE)
invisible(ps)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.