Skip to content

Pincho-App/pincho-r

Pincho R Library

Official R client for Pincho push notifications.

Installation

# Install from GitHub
remotes::install_github("Pincho-App/pincho-r")

Quick Start

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%")

Features

# 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"
)

Configuration

# 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
)

Error Handling

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).

Smart Rate Limiting

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.

Links

License

MIT

About

Official R client library for the Pincho push notification API

Resources

License

Unknown, MIT licenses found

Licenses found

Unknown
LICENSE
MIT
LICENSE.md

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors