npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@gathertown/webhook-object-sdk

v0.3.0

Published

Typed client for emitting events to Gather webhook objects (Smart Objects): Standard Webhooks signing, retries, and a fully-inferred send API.

Readme

@gathertown/webhook-object-sdk

Typed client for emitting events to Gather webhook objects (Smart Objects). Handles the fiddly parts of the wire protocol (Standard Webhooks v1 signing, retries, rate limits, and error decoding) behind a fully type-safe send.

Event types and payload shapes come from @gathertown/webhook-object-types, generated from the same definitions the Gather server enforces. When new capabilities ship, this SDK picks them up via a types-package bump, no SDK release needed.

Usage

Each Smart Object is one (url, secret) pair, copied from the object's ⋮ menu in Gather. Secrets are per-object: a key for one object never authenticates another.

import { createWebhookObjectClient, secretFromEnv } from "@gathertown/webhook-object-sdk"

const counter = createWebhookObjectClient({
  url: process.env.GATHER_COUNTER_URL!,
  secret: secretFromEnv("GATHER_COUNTER_SECRET"), // whsec_…, read from the environment
})

await counter.send("counter.increment", { by: 2 }) // data type inferred from the event type
await counter.send("counter.reset") // empty-payload events take no data argument
await counter.ping() // verify url + secret; returns the object's declared capabilities

secret accepts the raw whsec_… string, so it plugs straight into whatever secret management you already have. The opaque handles are the recommended hardening on top: secretFromEnv(name) reads the variable itself, and a handle redacts itself if it ever reaches a log or JSON.stringify, a bare string can't. For values from elsewhere (a secret manager, a non-Node runtime), unsafeSecretLiteral(value) wraps them; the name makes hardcoded secrets easy to catch in review.

Every event is also available as capability-namespaced sugar with the same typing; snake_case wire names become camelCase methods:

await counter.counter.increment({ by: 2 })
await counter.counter.reset()
await lamp.switch.setState({ on: true }) // → switch.set_state

The fluent surface is derived from the generated event union and backed by a Proxy, so new capabilities appear via a types-package bump with zero SDK changes.

Object catalog

To keep several objects at hand (inboxes, lamps, counters, …), build a named catalog. An entry's optional preset narrows its send at compile time to the events that preset declares, so wiring the lamp's events to the inbox is a type error, not a runtime 404.

import { createWebhookObjectCatalog } from "@gathertown/webhook-object-sdk"

const office = createWebhookObjectCatalog({
  supportInbox: { url: INBOX_URL, secret: secretFromEnv("GATHER_INBOX_SECRET"), preset: "inbox" },
  buildLamp: { url: LAMP_URL, secret: secretFromEnv("GATHER_LAMP_SECRET"), preset: "switch" },
})

await office.supportInbox.send("activity.add", { id: "pr-142", text: "PR #142 merged" })
await office.buildLamp.send("switch.toggle")

Wire behavior

  • Signs with the standardwebhooks reference library: HMAC-SHA256 over ${webhook-id}.${webhook-timestamp}.${body}, sent as the webhook-id / webhook-timestamp / webhook-signature headers. The exact serialized body is signed and sent unchanged.
  • One webhook-id (UUID) per event, reused across retries; the server dedups the last 10 ids per object, so retries are idempotent. Each retry is re-signed with a fresh timestamp.
  • Retries transient failures only (429, 5xx, network errors), honoring RateLimit-Reset / Retry-After, with exponential backoff + jitter otherwise. 4xx failures never retry.
  • Cancelable via a signal (AbortSignal) in config: aborting cancels the in-flight request and any pending backoff, rejecting with an aborted error.
  • Rejects payloads over the server's 4 KB body cap client-side, with a clear error instead of the receiver's uniform 404.
  • Refuses non-https URLs at construction (signing authenticates but does not encrypt), with an http carve-out for localhost so local development keeps working.
  • Never exposes the secret: error messages never contain it, and the opaque-handle form additionally redacts itself when logged or serialized.
  • Failures throw WebhookObjectError with a code mirroring the server's error bodies (not_found, capability_not_declared, token_revoked, …) plus client-side codes (payload_too_large, invalid_secret, invalid_url, network_error, aborted, unexpected_response).

Uses global fetch and crypto.randomUUID by default (Node 19+, modern browsers, Deno, workers). Both are overridable via config. Inject fetch and/or newWebhookId for other runtimes, proxies, or deterministic tests.