How do I set up webhooks?

4 min de lecturaIntermedio

Webhooks notify your systems when events happen in Better i18n — translations published, keys created, languages added, and more. Use them to trigger deployments, update caches, or sync with external tools.

Creating a webhook endpoint

  1. Go to your project → Integrations tab
  2. Click WebhooksManage
  3. Click Add Endpoint
  4. Configure:
    • URL — the HTTPS endpoint that will receive webhook payloads
    • Events — which events to subscribe to
  5. Click Create

A signing secret is generated and shown once — save it securely. You'll use it to verify webhook signatures.

Available events

Event Triggered when
translations.published Translations are published to CDN
translations.updated Translation values are changed
keys.created New translation keys are added
keys.deleted Translation keys are removed
sync.completed A sync job finishes
language.added A new target language is added
language.removed A target language is removed

Webhook payload

Each webhook sends a JSON payload:

{
  "event": "translations.published",
  "timestamp": "2025-01-15T10:30:00Z",
  "project": {
    "id": "project-uuid",
    "slug": "acme/dashboard"
  },
  "data": {
    // Event-specific data
  }
}

Verifying signatures

Every webhook includes an X-Webhook-Signature header. Verify it using HMAC-SHA256 with your signing secret to ensure the request is authentic:

import { createHmac } from 'crypto';

function verifyWebhook(body: string, signature: string, secret: string): boolean {
  const expected = createHmac('sha256', secret)
    .update(body)
    .digest('hex');
  return signature === expected;
}

Managing endpoints

On the webhook management page you can:

  • Toggle — enable or disable an endpoint without deleting it
  • Send Test — send a test payload to verify your endpoint works
  • View delivery log — see delivery attempts with status codes and response times
  • Redeliver — retry a failed delivery
  • Regenerate secret — get a new signing secret (invalidates the old one)
  • Delete — permanently remove the endpoint

Common use cases

  • Trigger deployment — rebuild your static site when translations are published
  • Clear cache — purge CDN or application cache on translation updates
  • Notify Slack — post to a channel when new keys need translation
  • Sync with TMS — forward events to external translation management systems

Next steps