Skip to main content

Overview

Webhooks allow you to receive HTTP notifications when specific events occur in your Smartbills account. Instead of polling the API for changes, Smartbills pushes notifications to your server in real-time.
Real-time updates: Webhooks are delivered within seconds of the event occurring, making them ideal for automation and integrations.

How Webhooks Work

1

Event Occurs

An action happens in Smartbills (e.g., expense created, report approved)
2

Webhook Triggered

Smartbills prepares a webhook payload with event details
3

HTTP POST Sent

Smartbills sends an HTTP POST request to your configured endpoint
4

Your Server Responds

Your server processes the webhook and returns a 200 OK response

Setting Up Webhooks

Register Your Webhook

Register your endpoint with Smartbills via the API:

Response

Save the secret: The webhook secret is only shown once. Store it securely, you need it to verify webhook signatures.

Available Events

Expense Events

Expense Report Events

Bill Events

Business Events

Webhook Payload Structure

All webhooks follow this structure:

Payload Fields

Webhook Security

Verify Signatures

Always verify webhook signatures to ensure requests are from Smartbills. Smartbills signs every webhook payload using HMAC-SHA256 with your webhook secret:

Retry Policy

Smartbills automatically retries failed webhook deliveries: Retry conditions:
  • HTTP status code >= 500
  • Connection timeout
  • Connection refused
  • DNS resolution failure
No retry for:
  • HTTP status code < 500 (including 4xx errors)
  • Invalid SSL certificate
Return 200 OK: Always return a 200 status code when you successfully receive the webhook, even if processing fails. Handle processing errors internally to avoid unnecessary retries.

Managing Webhooks

List Webhooks

Update Webhook

Delete Webhook

Test Webhook

Send a test event to verify your endpoint is working:

Best Practices

Return a 200 OK response within 5 seconds. Acknowledge receipt immediately and process the event asynchronously using a job queue.
Webhooks may be delivered more than once. Store event IDs and check for duplicates before processing.
Always verify the x-smartbills-signature header before processing any webhook payload.
Your webhook endpoint must use HTTPS in production to protect the payload in transit.
Log incoming webhook payloads, signature verification results, and processing outcomes for debugging.

Testing Webhooks Locally

Use tools like ngrok to test webhooks during local development:

API Keys

Secure your webhook endpoints

Error Handling

Handle webhook errors

Rate Limits

API rate limiting

Environments

Sandbox and production