SDK
The TypeScript SDK lets you create endpoints, capture and replay requests, stream webhooks in real-time, and integrate webhooks.cc into your test suite programmatically.
Install
npm install @webhooks-cc/sdk
Authentication
Generate an API key from your account page. Pass it when creating the client:
import { WebhooksCC } from "@webhooks-cc/sdk";
const client = new WebhooksCC({
apiKey: process.env.WHK_API_KEY,
});Create an endpoint
const endpoint = await client.endpoints.create({
name: "test-payments",
});
console.log(endpoint.url);
// https://go.webhooks.cc/w/<slug>Send a test webhook
await client.endpoints.send(endpoint.slug, {
method: "POST",
headers: { "x-event-type": "payment.success" },
body: { amount: 4999, currency: "usd" },
});Send provider templates with signatures
await client.endpoints.sendTemplate(endpoint.slug, {
provider: "stripe",
template: "checkout.session.completed",
secret: "whsec_test_123",
// Optional:
// event: "checkout.session.completed",
});Wait for a request
Timeouts accept human-readable strings like "30s", "5m", or milliseconds.
import { matchMethod, matchBodyPath } from "@webhooks-cc/sdk";
const request = await client.requests.waitFor(endpoint.slug, {
timeout: "10s",
match: matchBodyPath("event", "payment.success"),
});
console.log(request.body);Stream requests in real-time
for await (const request of client.requests.subscribe(endpoint.slug)) {
console.log(request.method, request.path);
if (request.method === "POST") break;
}Replay a captured request
const response = await client.requests.replay( request.id, "http://localhost:3000/webhooks" ); console.log(response.status); // 200
Detect webhook providers
import {
isStripeWebhook,
isGitHubWebhook,
isShopifyWebhook,
isSlackWebhook,
} from "@webhooks-cc/sdk";
if (isStripeWebhook(request)) {
console.log("Stripe webhook received");
}Learn more
- API Reference - all methods, matchers, and types
- Testing patterns - CI/CD integration examples
- MCP Server - AI agent integration for Claude, Cursor, VS Code