Back to Documentation

Webhooks

Receive real-time notifications when events occur in your SyncBooks account.

What are Webhooks?

Webhooks are HTTP callbacks that notify your application when specific events happen:

  • Invoice created, sent, or paid
  • Payment received or failed
  • Expense submitted or approved
  • Payroll processed
  • Customer created or updated

Setting Up Webhooks

  1. Go to Settings → Webhooks
  2. Click "Add Webhook Endpoint"
  3. Enter your endpoint URL
  4. Select events to subscribe to
  5. Choose API version
  6. Save webhook
  7. Test with sample event

Webhook Payload

{
  "id": "evt_1234567890",
  "type": "invoice.paid",
  "created": 1234567890,
  "data": {
    "object": {
      "id": "inv_abc123",
      "amount": 1500.00,
      "customer": "cus_xyz789",
      "status": "paid"
    }
  }
}

Verifying Webhooks

Verify webhook signatures to ensure authenticity:

  1. Extract signature from header: X-SyncBooks-Signature
  2. Compute HMAC with webhook secret
  3. Compare computed signature with received signature
  4. Process event only if signatures match

Retry Logic

  • SyncBooks retries failed webhooks automatically
  • Exponential backoff: 1min, 5min, 30min, 2hr, 6hr
  • Maximum 5 retry attempts
  • View delivery status in dashboard

Best Practices

  • Return 200 status code quickly
  • Process events asynchronously
  • Handle duplicate events (idempotency)
  • Log all webhook events
  • Use HTTPS endpoints only

Testing: Use webhook.site or ngrok to test webhooks during development.