Get the FREE Ultimate OpenClaw Setup Guide →

pgns

npx machina-cli add skill pgns-io/claude-skills/pgns --openclaw
Files (1)
SKILL.md
5.3 KB

pgns — Webhook Relay SDK & CLI

You are helping a developer work with pgns, a webhook relay platform. pgns captures incoming webhooks ("pigeons"), routes them to destinations (URLs, Slack, Discord, email), and provides real-time streaming, replay, and delivery tracking.

Core Concepts

ConceptDescription
RoostA webhook endpoint that receives incoming HTTP requests. Each roost has a unique inbound URL (/r/{roost_id}) and an optional signing secret.
PigeonA captured webhook request — stores method, headers, body, query params, and delivery status.
DestinationA target for delivering pigeons. Types: url, slack, discord, email. Supports filter expressions, templates, and configurable retry (max attempts, delay, backoff multiplier).
Delivery AttemptA record of delivering a pigeon to a destination — tracks status, HTTP response, errors, and retry schedule.
API KeyServer-side authentication token (prefix pk_live_...). Use for backend integrations.
TemplateA transformation template applied to pigeon bodies before delivery. Supports preview with real pigeon data.

Authentication

pgns supports two auth modes:

  1. API Key (server-side) — Pass pk_live_... as a Bearer token. Best for backend services, CI/CD, scripts.
  2. JWT (browser/user sessions) — Access token with automatic refresh on 401. Best for frontend apps.

All SDKs accept both modes and handle token refresh transparently.

Quick Start by Language

JavaScript/TypeScript

import { PigeonsClient } from '@pgns/sdk';

const client = new PigeonsClient({
  baseUrl: 'https://api.pgns.io',
  apiKey: 'pk_live_...',
});

// List roosts
const roosts = await client.listRoosts();

// Create a destination
const dest = await client.createDestination(roost.id, {
  destination_type: 'url',
  config: { url: 'https://example.com/webhook' },
});

// Stream events in real-time
import { createEventSource } from '@pgns/sdk';

await createEventSource('https://api.pgns.io', {
  token: 'pk_live_...',
  roostId: roost.id,
  onEvent: (data) => console.log('Pigeon:', JSON.parse(data)),
  onError: (err) => console.error(err),
  signal: AbortSignal.timeout(60000),
});

For complete JS/TS API reference, see references/sdk-js.md.

Python

from pgns.sdk import PigeonsClient, event_stream

client = PigeonsClient("https://api.pgns.io", api_key="pk_live_...")

# List roosts
roosts = client.list_roosts()

# Create a destination
dest = client.create_destination(roost.id, CreateDestination(
    destination_type=DestinationType.url,
    config={"url": "https://example.com/webhook"},
))

# Stream events
for event in event_stream("https://api.pgns.io", token="pk_live_..."):
    print("Pigeon:", event)

For async support (AsyncPigeonsClient, async_event_stream) and complete API reference, see references/sdk-python.md.

Go

import sdk "github.com/pgns-io/sdk-go"

client := sdk.NewClient("https://api.pgns.io", sdk.WithAPIKey("pk_live_..."))

// List roosts
roosts, err := client.ListRoosts(ctx)

// Create a destination
dest, err := client.CreateDestination(ctx, roost.ID, sdk.CreateDestination{
    DestinationType: "url",
    Config:          map[string]any{"url": "https://example.com/webhook"},
})

// Stream events
err = client.ListenEvents(ctx, func(data string) {
    fmt.Println("Pigeon:", data)
}, sdk.WithRoostID(roost.ID))

For complete Go API reference, see references/sdk-go.md.

CLI

# Authenticate
pgns auth login

# List roosts
pgns roost list

# Forward webhooks to localhost
pgns listen my-roost --port 3000

# Watch incoming pigeons in real-time
pgns watch my-roost

# Replay a pigeon
pgns replay pgn_abc123

For complete CLI reference, see references/cli.md.

Common Patterns

Error Handling

All SDKs throw/return typed errors with HTTP status and machine-readable error codes:

  • JS: PigeonsError with .status and .code properties
  • Python: PigeonsError with .status and .code attributes, plus .is_not_found() / .is_unauthorized() helpers
  • Go: *PigeonsError with .StatusCode and .Code fields, plus sdk.IsNotFound(err) / sdk.IsUnauthorized(err) helpers

Pagination

List endpoints that return many items use cursor-based pagination:

{ data: [...], next_cursor: "...", has_more: true }

Pass cursor and limit to page through results. Applies to listPigeons and getPigeonDeliveries.

Webhook Delivery Flow

  1. HTTP request hits roost inbound URL → pigeon created
  2. Each active destination receives the pigeon
  3. Failed deliveries retry with exponential backoff (configurable per destination)
  4. Use replayPigeon to re-trigger delivery for debugging

Reference Navigation

When the user is working with a specific SDK or the CLI, load the appropriate reference file for detailed API docs:

ContextReference File
JavaScript / TypeScript / Node.jsreferences/sdk-js.md
Python / FastAPI / Django / Flaskreferences/sdk-python.md
Go / Golangreferences/sdk-go.md
CLI / terminal / command linereferences/cli.md

Source

git clone https://github.com/pgns-io/claude-skills/blob/main/skills/pgns/SKILL.mdView on GitHub

Overview

pgns is a webhook relay platform that captures incoming webhooks as pigeons, routes them to destinations (URL, Slack, Discord, email), and offers real-time streaming, replay, and delivery tracking. It introduces Roosts as inbound endpoints and Pigeons as stored deliveries, with templates and retry controls for reliable delivery.

How This Skill Works

You create a Roost with an inbound URL (e.g., /r/{roost_id}) and optional signing. Pigeons capture the request data (method, headers, body, query params) and Delivery Attempts record each delivery to a Destination (url, slack, discord, email) with retry settings and templates applied before delivery. Authentication supports API Key (Bearer pk_live_...) for backend and JWT for frontend, with token refresh handled by the SDKs.

When to Use It

  • You need to relay incoming webhooks to multiple destinations in real time (URL, Slack, Discord, email).
  • You want reliable delivery with retry scheduling and delivery tracking for each pigeon.
  • You are building a backend integration using API Key authentication to manage roosts and destinations.
  • You are building a frontend app and prefer JWT with automatic token refresh for user sessions.
  • You want CLI-based local testing, live listening, and replay capabilities for debugging webhooks.

Quick Start

  1. Step 1: pgns auth login
  2. Step 2: pgns roost list
  3. Step 3: pgns listen my-roost --port 3000

Best Practices

  • Secure roost endpoints with signing secrets and validate inbound requests.
  • Use Destination filters and templates to transform pigeons before delivery and reduce payload size.
  • Configure delivery retries with sensible max attempts, delays, and backoff multipliers.
  • Choose the appropriate auth mode (API Key for backend, JWT for frontend) and rely on SDK token refresh.
  • Use the CLI for local testing (listen/watch) and the replay feature to reproduce issues quickly.

Example Use Cases

  • Forward a captured webhook from a GitHub repo to a Slack channel and a fallback URL with templates.
  • Relay Stripe events to an internal analytics endpoint with retry, while logging delivery status.
  • Stream real-time webhooks to a Discord server and provide delivery replay for auditing.
  • Deliver notifications to an email address when a critical event occurs, with delivery tracking.
  • Test and validate webhooks locally by listening on a roost and replaying a pigeon for debugging.

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers