Official R client for Pincho push notifications.
# Install from GitHub
remotes::install_github("Pincho-App/pincho-r")library(pincho)
# Auto-load token from PINCHO_TOKEN env var
client <- pincho()
client$send(title = "Deploy Complete", message = "Version 1.2.3 deployed")
# Or provide token explicitly
client <- pincho(token = "YOUR_TOKEN")
client$send(title = "Alert", message = "Server CPU at 95%")# Full parameters
client$send(
title = "Deploy Complete",
message = "Version 1.2.3 deployed",
type = "deployment",
tags = c("production", "backend"),
image_url = "https://example.com/success.png",
action_url = "https://example.com/deploy/123"
)
# AI-powered notifications (NotifAI)
response <- client$notifai(text = "deployment finished, v2.1.3 is live")
response$notification # AI-generated title, message, tags
# Encrypted notifications (title, message, URLs encrypted; type, tags unencrypted)
client$send(
title = "Security Alert",
message = "Sensitive data",
type = "security",
encryption_password = "your_password"
)# Environment variables (recommended, e.g. in .Renviron)
# PINCHO_TOKEN - API token (required if not passed to constructor)
# PINCHO_TIMEOUT - Request timeout in seconds (default: 30)
# PINCHO_MAX_RETRIES - Retry attempts (default: 3)
# Or explicit configuration
client <- pincho(
token = "abc12345",
timeout = 60,
max_retries = 5
)tryCatch(
client$send(title = "Title", message = "Message"),
pincho_auth_error = function(e) message("Invalid token"),
pincho_validation_error = function(e) message("Invalid parameters"),
pincho_rate_limit_error = function(e) message("Rate limited"),
pincho_server_error = function(e) message("Server error"),
pincho_error = function(e) message("General Pincho error")
)Automatic retry with exponential backoff for network errors, 5xx, and 429 (rate limit).
The library automatically handles rate limits with Retry-After header support:
client$send(title = "Alert", message = "Message")
# Check rate limit status after any request
if (!is.null(client$last_rate_limit)) {
cat(sprintf(
"Remaining: %d/%d\n",
client$last_rate_limit$remaining,
client$last_rate_limit$limit
))
}See Advanced Documentation for detailed rate limit monitoring patterns.
- Get Token: App -> Settings -> Help -> copy token
- Documentation: https://pincho.app/help
- Repository: https://github.com/Pincho-App/pincho-r
MIT