triggerWebhook()
Signature
client.triggerWebhook(
id: string,
body?: unknown,
opts?: {
token?: string
signature?: string
headers?: Record<string, string>
}
): Promise<WebhookTriggerResponse>Parameters#
| Param | Type | Description |
|---|---|---|
id | string | UUID of the job |
body | unknown | Request body (JSON-serialised and forwarded as-is) |
opts.token | string | Per-job webhook token set when the job was created |
opts.signature | string | HMAC-SHA256 signature (sha256=<hex>). See computeHmacSignature() |
opts.headers | Record<string, string> | Additional HTTP headers to include in the request |
Usage#
ts
import { VeloraClient } from '@rimora/velora'
import fetch from 'node-fetch'
const client = new VeloraClient({
apiKey: process.env.VELORA_API_KEY,
fetch: fetch as any
})
// Fire with a per-job token for simple auth
const result = await client.triggerWebhook(
'9f4a1c2b-3d4e-5f6a-7b8c-9d0e1f2a3b4c',
{ event: 'user.signup', userId: 'u_123' },
{ token: process.env.JOB_WEBHOOK_TOKEN }
)
console.log(result.msg)Response#
WebhookTriggerResponse
{
"id": "9f4a1c2b-3d4e-5f6a-7b8c-9d0e1f2a3b4c",
"msg": "Webhook triggered"
}This endpoint does not require your Velora API key to be passed in the
Authorization header. All authentication is handled by opts.token or opts.signature. This makes it safe to call from browser-side code using only a public webhook token.Required scope#
None — this is a public endpoint. Authenticity is verified via the token or HMAC signature.
Common errors#
| Status | error | Cause |
|---|---|---|
401 | invalid_token | Token is missing or does not match the job |
401 | invalid_signature | HMAC signature verification failed |
404 | not_found | Job does not exist |