Webhooks
Call sendWebhook() from any callback. ViteHub stores the delivery, signs it, waits for the debounce, and retries.
Deploys on
server/webhooks/t3.ts
import { defineWebhook } from 'vite-hub/webhooks'
// One file is one webhook. The values are names of server variables.
export default defineWebhook({
url: 'T3_WEBHOOK_URL',
secret: 'T3_WEBHOOK_SECRET',
debounce: '30 minutes',
})What you get
Section titled "What you get"| Part | What it does |
|---|---|
| Definition | server/webhooks/<name>.ts names the target URL and secret by their server variables. The file name is the webhook name, and sendWebhook() types it. |
| Signature | Each delivery has an HMAC-SHA256 signature in GitHub (x-hub-signature-256) or Stripe (stripe-signature) format. |
| Storage | Each delivery is stored in the Default Database so it survives restarts and deploys. |
| Debounce | With debounce, sends within the window collapse into one delivery with the latest body. |
| Retries | Queue retries a failed delivery under the same delivery ID, up to 4 attempts in total. |
| Inspection | vite-hub/webhooks/runtime lists, flushes, cancels, and redelivers deliveries. |
Webhooks or Queue
Section titled "Webhooks or Queue"Use Webhooks when the job goes to a URL outside your app. Use Queue when your own code does the job. Webhooks uses Queue to send each delivery. To receive a webhook from Stripe or GitHub, use verifyWebhook().
- Get started sends a signed webhook from a ViteHub app.
- Comments to a T3 Code thread starts a T3 Code thread 30 minutes after the last comment.
- Send events forwards Forms, Blob, Content, and Auth events.
- Failure alerts posts to Slack when an Agent Invocation, Workflow run, or Schedule run fails.
- Server API covers
defineWebhook(),sendWebhook(), headers, and delivery helpers.