Skip to content

hooksbase/hooksbase-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hooksbase JS

Official open-source TypeScript SDK and CLI for Hooksbase — the hosted webhook platform for receiving, transforming, and reliably delivering webhooks.

@hooksbase/sdk @hooksbase/cli License CI

Is Hooksbase open source? This repository contains the open-source TypeScript SDK and CLI (Apache-2.0). The Hooksbase service itself is a proprietary, hosted product — there is no self-hosted edition. Start free →

Packages

Package Description npm
@hooksbase/sdk TypeScript SDK for the Hooksbase API, ingest publishing, and signature verification npm
@hooksbase/cli hooksbase command-line interface for projects, webhooks, deliveries, and ingest npm

Install

npm install @hooksbase/sdk
npm install --global @hooksbase/cli

Grab a free API key from the Hooksbase dashboard (5,000 deliveries/month, no card).

Quickstart

Publish an event to an ingest endpoint:

import { createHooksbaseClient } from "@hooksbase/sdk";

const client = createHooksbaseClient({
  baseUrl: "https://api.hooksbase.com",
  apiKey: process.env.HOOKSBASE_API_KEY
});

await client.ingest.publishJson({
  ingestUrl: "https://hooks.hooksbase.com/v1/ingest/hook_123",
  ingestSecret: process.env.HOOKSBASE_INGEST_SECRET,
  payload: { type: "order.created", id: "ord_1" },
  idempotencyKey: "ord_1"
});

Verify an inbound webhook signature (Standard Webhooks-compatible headers):

import { verifyHooksbaseWebhook } from "@hooksbase/sdk";

// `rawBody` must be the unparsed request body bytes/string.
const verified = verifyHooksbaseWebhook({
  headers: request.headers,
  rawBody,
  signingSecret: process.env.HOOKSBASE_SIGNING_SECRET
});

console.log("verified delivery", verified.deliveryId);

From the terminal:

hooksbase auth login
hooksbase webhooks list --json
hooksbase deliveries bulk-replay --idempotency-key replay-1 --file ./bulk-replay.json

See runnable, framework-specific samples in hooksbase/examples.

Links

Contributing

Issues and PRs to the SDK/CLI are welcome — see CONTRIBUTING.md. The platform itself is closed-source; this repo covers only the client libraries.

License

Apache-2.0 © Hooksbase. See NOTICE.

About

Hooksbase TypeScript SDK & CLI

Resources

Contributing

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages