regenerateWebhookSecret()
Signature
client.regenerateWebhookSecret(id: string): Promise<RegenerateWebhookSecretResponse>Parameters#
| Param | Type | Description |
|---|---|---|
id | string | UUID of the job to rotate the secret for |
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
})
const jobId = '9f4a1c2b-3d4e-5f6a-7b8c-9d0e1f2a3b4c'
const { webhook_secret } = await client.regenerateWebhookSecret(jobId)
// Store the new secret immediately — it will not be shown again
console.log('New webhook secret:', webhook_secret)
await saveSecretToVault(jobId, webhook_secret)Response#
RegenerateWebhookSecretResponse
{
"id": "9f4a1c2b-3d4e-5f6a-7b8c-9d0e1f2a3b4c",
"webhook_secret": "whsec_4f9a1c2b3d4e5f6a7b8c9d0e1f2a3b4c",
"msg": "Webhook secret regenerated"
}Store the secret immediately. The raw
webhook_secret value is only returned on this response. Future calls to getJob() will omit the secret. If you lose it, you must call regenerateWebhookSecret() again.Cron job signatures: After regenerating, all cron job POST requests to your target_url will include the X-Hub-Signature-256 header. Use the SDK's
computeHmacSignature(secret, body) utility to verify these signatures on your server.Required scope#
Requires: jobs:write (or admin, *)
Common errors#
| Status | error | Cause |
|---|---|---|
401 | invalid_api_key | Missing or revoked API key |
403 | insufficient_scope | Key lacks jobs:write scope |
404 | not_found | Job does not exist |