Skip to content

Connect webhooks

  1. Prepare your HTTPS receiver and choose a new file in an existing private directory for its signing secret.
  2. Set HERMITBOX_API_URL, HERMITBOX_API_KEY, HERMITBOX_WEBHOOK_URL and HERMITBOX_WEBHOOK_FILE privately; install hermitbox in the Node program that registers the receiver.
  3. Run this once. Keep the saved file private: the signing secret is returned only at registration.
import { writeFileSync } from 'node:fs'
import { Hermitbox } from 'hermitbox'
// The receiver and the secret's file come from the environment.
const receiver = process.env.HERMITBOX_WEBHOOK_URL
const file = process.env.HERMITBOX_WEBHOOK_FILE
if (!receiver || !file) throw new Error('Set HERMITBOX_WEBHOOK_URL and HERMITBOX_WEBHOOK_FILE')
// Connect with the URL and key from the environment.
const hb = new Hermitbox({
url: process.env.HERMITBOX_API_URL!,
key: process.env.HERMITBOX_API_KEY!,
})
// Register the receiver for sandbox creation and deletion.
const hook = await hb.webhook({ url: receiver, kinds: ['created', 'deleted'] })
try {
// Save the signing secret once, to a new private file.
const saved = JSON.stringify({ id: hook.id, secret: hook.secret }) + '\n'
writeFileSync(file, saved, { mode: 0o600, flag: 'wx' })
} catch (error) {
// Without the saved secret the registration is useless, so remove it.
await hook.delete()
throw error
}
console.log('Webhook registered')

The file is created without overwriting an existing path; the block never prints the secret. Verify timestamp and HMAC on the exact received bytes, deduplicate delivery IDs and acknowledge promptly. Signing, retries and dead letters describe the receiver contract. Private destinations need the host’s allowlist; a caller cannot relax it. Events still reflect the selected tier’s lifecycle limits.

run it yourself
$curl -fsSL https://hbx.sh | sh
or ask your agent
Install Hermitbox and set it up for me
agents can read every page: llms.txt · llms-full.txt