Overview
Webhooks allow you to receive real-time notifications when events occur in your GetBill account. Instead of repeatedly polling the API for changes, webhooks push updates directly to your application, making your integration more efficient and responsive.How Webhooks Work
Setting Up Webhooks
1. Create a Webhook Endpoint
Your webhook endpoint must:- Accept POST requests
- Return a 2xx status code (200-299) for successful processing
- Respond within 10 seconds
- Verify the webhook signature (recommended)
- Node.js (Express)
- Python (Flask)
- PHP
2. Configure Webhooks in GetBill
- Log in to your GetBill dashboard
- Navigate to Settings → External Services
- Scroll down to the Webhook Endpoints section
- Click Create New Webhook Endpoint
- Configure your webhook:
- Name: A descriptive name (e.g., “CRM Integration”)
- URL: Your webhook endpoint URL (e.g.,
https://yourapp.com/webhooks/getbill) - Description: Optional description of what this webhook does
- Events: Select which events to receive (check the boxes for the event types you want)
- Click Create - a secret key will be automatically generated
- Important: Copy and save the secret key securely - you’ll need it for signature verification
Verifying Webhook Signatures
GetBill signs all webhook requests to ensure they’re authentic and haven’t been tampered with. You should always verify the signature before processing webhook events to protect your application from malicious requests.How It Works
When GetBill sends a webhook to your endpoint, it includes a cryptographic signature in the request headers. Here’s the process:- GetBill generates a signature: Using HMAC-SHA256 with your webhook secret key and the raw request body
- Signature is sent in header: The signature is included in the
X-GetBill-Signatureheader - You compute the same signature: Using the same algorithm, your secret key, and the raw request body
- Compare signatures: Use a timing-safe comparison function to verify they match
Signature Details
HMAC-SHA256
The cryptographic hash algorithm used to generate signatures
X-GetBill-Signature
The HTTP header containing the signature (lowercase hex string)
Raw Request Body
The exact raw JSON payload as received (before parsing)
Webhook Secret
The secret key generated when you created the webhook endpoint
Verification Steps
- Extract the signature from the
X-GetBill-Signatureheader - Get the raw request body (before JSON parsing)
- Compute HMAC-SHA256 hash of the raw body using your secret key
- Compare using a timing-safe comparison function (prevents timing attacks)
- Reject the request if signatures don’t match
Implementation Examples
The code examples in the sections above demonstrate proper signature verification. Key points:- Node.js: Use
crypto.timingSafeEqual()with Buffer.from() - Python: Use
hmac.compare_digest() - PHP: Use
hash_equals()
Testing Signature Verification
You can test your signature verification with this example:Webhook Events
Available Event Types
Debt Events
Debt Events
debt.created- A new debt was createddebt.updated- A debt was modified. Use this when you need to sync debt details beyond collection progress.debt.deleted- A debt was deleteddebt.status_changed- Debt status was updated. When the debt becomes paid because of a payment transaction, the payload also includes transaction context.
Followup Events
Followup Events
followup.created- A new followup was createdfollowup.updated- A followup was modifiedfollowup.completed- A followup was marked as completedfollowup.failed- A followup attempt failed
Payment Events
Payment Events
payment.received- A payment was recordedpayment.failed- A payment attempt failedpayment_plan.created- A payment plan was set uppayment_plan.completed- All payments in a plan were completedpayment_plan.canceled- A payment plan was canceled
System Events
System Events
company.credits_low- Credit balance is running lowintegration.error- An integration error occurred
Event Payload Structure
All webhook events follow this structure:string
Unique identifier for the webhook event (format:
evt_[32 hex characters])string
The type of event that occurred (e.g.,
debt.created, followup.completed)string
When the event occurred (ISO 8601 format with timezone)
object
The actual data for the event (structure varies by event type - see examples below)
object
Additional context about the event including:
source: Always “getbill”version: API version (currently “1.0”)company_id: Your company ID- Additional fields depending on event type (e.g.,
debt_id,followup_id,payment_id)
Event Type Examples
Debt Events
debt.created
debt.updated
Usedebt.updated when you need to keep debt details synchronized. For collection progress, prefer debt.status_changed.
The
changes field is included when specific field changes are tracked. It shows the previous and new values for each modified field. This field may not be present for all updates.debt.status_changed
data.status_change_context is optional. It is included only when the new status is a paid status and that transition was directly caused by a payment transaction.provider_transaction_idis GetBill’s canonical transaction identifier for the provider.provider_identifiersincludes additional native provider IDs when available.- For Stripe,
provider_identifiersmay includecheckout_session_id,payment_intent_id, andcharge_id. - For Axepta,
provider_identifiersmay includepay_idandtrans_id. - For Adyen,
provider_identifiersmay includepayment_link_idandpsp_reference. - For SumUp,
provider_identifiersmay includecheckout_idandtransaction_id. - For Bridge,
provider_identifiersmay includepayment_link_id,payment_request_id, andclient_reference. - For GoCardless,
provider_identifiersmay includeevent_id. - For Scellius, PayZen, and SystemPay,
provider_identifiersmay includeorder_idandtransaction_uuid. - For Monetico,
provider_identifiersmay includenumauto.
Debt Status Values
Debt Status Values
The
status field uses translation key format status.default.* (not simple strings):Important Notes:
- Format is always
status.default.{name}, never just the name (e.g.,"status.default.paid"not"paid") - Companies can create custom statuses with the
status.custom.*prefix - When filtering or comparing status values, always use the full format
debt.deleted
Followup Events
followup.created
followup.updated
followup.completed
Media URLs: The
audio_url and pdf_url fields contain presigned CloudFront URLs that expire after 1 hour (indicated by media_urls_expire_at). These URLs provide temporary access to call recordings and PDF documents. Important: Cache these URLs but refresh them before the expiration time if you need continued access.Followup Status Values
Followup Status Values
The
status field uses lowercase underscore format (e.g., deal_found, not DEAL_FOUND):Note: Always use lowercase format (e.g.,
"deal_found" not "DEAL_FOUND").followup.failed
Payment Events
payment.received
payment.failed
payment_plan.created
payment_plan.completed
payment_plan.canceled
System Events
company.credits_low
integration.error
Handling Specific Events
Debt Events
Followup Events
Error Handling & Reliability
Automatic Retry Behavior
GetBill automatically handles webhook delivery retries for you. If your endpoint fails to respond with a 2xx status code or times out, GetBill will automatically retry with exponential backoff:- 1st retry: After 1 minute
- 2nd retry: After 5 minutes
- 3rd retry: After 30 minutes
Important: Make sure your endpoint returns a 2xx status code (like 200 or 204) quickly, even if you queue the actual processing for later. GetBill waits up to 10 seconds for a response before timing out.
Monitoring Failed Deliveries
Monitor webhook delivery failures through your dashboard:- Go to Settings → External Services
- Find your webhook endpoint
- Click Deliveries to see:
- Delivery status for each event
- HTTP status codes returned
- Error messages for failures
- Retry attempts and timing
- Full request/response payloads
Idempotency
Ensure your webhook handlers are idempotent to handle duplicate deliveries:Testing Webhooks
Local Development with ngrok
For local testing, use ngrok to expose your local server:Testing Webhook Endpoints
Monitoring & Debugging
Monitoring Webhooks
Monitor webhook deliveries through your GetBill dashboard:- Delivery Status: Check webhook delivery success/failure rates
- Event History: Review recent webhook events and their outcomes
- Error Analysis: Investigate failed deliveries and common issues
- Performance Metrics: Track response times and delivery patterns
Security Best Practices
Verify Signatures
Always verify webhook signatures to ensure requests come from GetBill
Use HTTPS
Only accept webhooks over HTTPS to protect data in transit
Validate Payloads
Validate webhook payloads before processing to prevent malicious input
Rate Limiting
Implement rate limiting on your webhook endpoints to prevent abuse