Overview
Webhooks allow you to receive real-time HTTP notifications when events occur in your Bloque accounts. Instead of polling for updates, Bloque pushes event data to your configured endpoint. Common use cases:- Get notified when transfers complete
- Track batch transfer settlement
- Monitor account balance changes
- Receive card transaction notifications
- Track account status changes
Setting Up Webhooks
You can configure webhooks at two levels:- Account-level webhooks - Receive events for a specific account
- Operation-level webhooks - Receive notifications for specific operations (like batch transfers)
Account-Level Webhooks
Configure a webhook URL when creating an account:Operation-Level Webhooks
Receive notifications when specific operations complete:Webhook Endpoint Requirements
Your webhook endpoint must:Webhook Payload
Webhook events are delivered as HTTP POST requests with a JSON payload:Event Types
Transfer Events
Transfer Events
transfer.queued- Transfer has been queuedtransfer.processing- Transfer is being processedtransfer.completed- Transfer completed successfullytransfer.failed- Transfer failed
Batch Transfer Events
Batch Transfer Events
batch.queued- Batch transfer queuedbatch.processing- Batch is being processedbatch.completed- All operations completedbatch.partial_failure- Some operations failedbatch.failed- Batch failed completely
Account Events
Account Events
account.created- Account createdaccount.activated- Account became activeaccount.frozen- Account was frozenaccount.disabled- Account was disabledaccount.balance_changed- Balance was updated
Card Transaction Events
Card Transaction Events
card.transaction.authorized- Transaction authorizedcard.transaction.settled- Transaction settledcard.transaction.declined- Transaction declinedcard.transaction.reversed- Transaction reversed/refunded
Implementing a Webhook Handler
Here’s an example webhook handler using Express:Signature Verification
Bloque signs webhook payloads with HMAC-SHA256 to ensure authenticity:Retry Logic
Bloque automatically retries failed webhook deliveries:- Retry schedule: 1 min, 5 min, 30 min, 2 hours, 6 hours
- Maximum retries: 5 attempts
- Success criteria: HTTP 2xx response within 5 seconds
Testing Webhooks Locally
Use tools like ngrok to test webhooks during development:Idempotency Pattern
Track processed events to handle duplicates:Webhook Debugging
Common issues and solutions:Not receiving webhooks
Not receiving webhooks
- Verify your endpoint is publicly accessible
- Check that you’re using HTTPS in production
- Ensure your server responds within 5 seconds
- Check firewall rules and rate limiting
Signature verification fails
Signature verification fails
- Use the raw request body (before parsing JSON)
- Ensure you’re using the correct webhook secret
- Check for encoding issues in the signature comparison
Missing events
Missing events
- Check webhook URL configuration on the account
- Verify the event type you’re expecting is actually sent
- Look for errors in your webhook handler logs
Best Practices
Respond immediately
Return 200 OK as fast as possible. Process events asynchronously in a background job.
Verify signatures
Always verify webhook signatures in production to ensure authenticity.
Implement idempotency
Track processed event IDs to safely handle duplicate deliveries.
Log everything
Log webhook payloads and processing results for debugging and auditing.
Related
- Transfers - Transferring funds with webhook notifications
- Metadata - Adding context to webhook events
- Card Accounts - Card transaction webhooks
- Error Handling - Handling webhook errors