Constructor
new WebHookDispatcher(endpointsByEvent, optionsopt)
Parameters:
| Name | Type | Attributes | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
endpointsByEvent |
Object.<string, Array.<string>> | Mapping of event names to arrays of webhook URLs. |
|||||||||||||
options |
Object |
<optional> |
Properties
|
- Source:
Methods
(async) trigger(eventName, payload, headersopt) → {Promise.<{event: string, deliveries: Array.<{url: string, ok: boolean, status: (number|undefined), error: (string|undefined)}>}>}
Trigger a webhook event and POST the payload to all configured URLs.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
eventName |
string | The webhook event identifier. |
|
payload |
Object | Payload to serialise as JSON. |
|
headers |
Object |
<optional> |
Additional HTTP headers for the request. |
- Source:
Returns:
Summary of delivery attempts (always resolves, never rejects).
- Type
- Promise.<{event: string, deliveries: Array.<{url: string, ok: boolean, status: (number|undefined), error: (string|undefined)}>}>