@bimetal/channel-webhook
Scope — generic HTTP POST. Delivery semantics are the receiver's: no retry, no dedup, no
ordering. fetch is injectable, so timeouts and auth headers stay the caller's decision.
Generic HTTP-POST webhook adapter for @bimetal/channel. send(url, message) POSTs the
notification message as JSON to the recipient URL, built on the standard fetch (injectable for
tests/runtimes). Zero external npm dependencies.
The recipient is the target URL; the message is the JSON body.
Installation
npm install @bimetal/channel-webhook @bimetal/channel
Usage
import { createWebhookChannel } from '@bimetal/channel-webhook';
const channel = createWebhookChannel({
headers: { authorization: 'Bearer <token>' },
});
await channel.send('https://hooks.example.com/incoming', {
title: 'Deploy finished',
body: 'v0.30.0 is live.',
});
Options (WebhookChannelOptions)
headers? | Extra headers merged onto every request (e.g. an auth token). content-type: application/json is always set. |
fetch? | Injectable fetch — defaults to the global. Pass a fake in tests. |
timeoutMs? | Per-request timeout in ms. Default 10000. |
Capabilities: { batch: false, retries: false } — one POST per send, no batching or retry logic
(the host decides retry policy).