Skip to content

SDKs

The SDKs wrap the parts of the API you call from application code: events, endpoints, subscriptions, deliveries, incoming sources and incoming events, plus signature verification. They authenticate with an API key alone.

Language Package Install
Node.js / TypeScript @railhook/node npm install @railhook/node
Python railhook pip install railhook
PHP 8.1+ railhook/php composer require railhook/php

The Node.js SDK has no runtime dependencies. The PHP SDK needs ext-json and ext-curl.

import { Railhook } from '@railhook/node';
const client = new Railhook({
apiKey: process.env.RAILHOOK_API_KEY,
baseUrl: 'https://railhook.io', // or your instance
});
const event = await client.events.send(
{ type: 'order.completed', data: { orderId: 'ord_12345', amount: 99.99 } },
'order-12345-completed', // idempotency key, optional
);

Pass the raw request body, the X-Signature header and the endpoint secret. Verification throws when the signature does not match or the timestamp is too old.

import { verifySignature } from '@railhook/node';
verifySignature(rawBody, req.headers['x-signature'], process.env.WEBHOOK_SECRET);

Each SDK also provides constructEvent (construct_event in Python), which verifies and parses in one call. If your endpoint uses the Standard Webhooks headers, use verifyStandardWebhook (verify_standard_webhook) with the endpoint’s whsec_ secret.