Webhooks Rail
Webhooks Rail
Section titled “Webhooks Rail”Event notification and webhook management endpoints.
Overview
Section titled “Overview”The Webhooks rail provides:
- Webhook endpoint management
- Event delivery
- Retry handling
- Delivery logs
Endpoints
Section titled “Endpoints”Create Endpoint
Section titled “Create Endpoint”POST /v1/webhooks/endpointsconst endpoint = await iof.webhooks.createEndpoint({ url: "https://yourapp.com/webhooks", events: ["contract.*", "kyc.verified"], secret: process.env.WEBHOOK_SECRET, // Optional, auto-generated if not provided});Response:
{ "id": "we_abc", "url": "https://yourapp.com/webhooks", "events": ["contract.*", "kyc.verified"], "secret": "WEBHOOK_SECRET_SHOWN_ONCE", "status": "active", "createdAt": "2024-01-15T10:30:00Z"}Get Endpoint
Section titled “Get Endpoint”GET /v1/webhooks/endpoints/:idconst endpoint = await iof.webhooks.getEndpoint("we_abc");Update Endpoint
Section titled “Update Endpoint”PATCH /v1/webhooks/endpoints/:idconst endpoint = await iof.webhooks.updateEndpoint("we_abc", { events: ["contract.*", "kyc.*", "compliance.*"],});Delete Endpoint
Section titled “Delete Endpoint”DELETE /v1/webhooks/endpoints/:idawait iof.webhooks.deleteEndpoint("we_abc");List Events
Section titled “List Events”GET /v1/webhooks/eventsconst events = await iof.webhooks.listEvents({ endpointId: "we_abc", status: "failed", limit: 50,});Retry Event
Section titled “Retry Event”POST /v1/webhooks/events/:id/retryawait iof.webhooks.retryEvent("evt_xyz");Event Types
Section titled “Event Types”Contract Events
Section titled “Contract Events”contract.createdcontract.updatedcontract.activatedcontract.maturedcontract.closed
KYC Events
Section titled “KYC Events”kyc.submittedkyc.verifiedkyc.rejectedkyc.expired
Compliance Events
Section titled “Compliance Events”compliance.check.completedcompliance.alert.triggered
Billing Events
Section titled “Billing Events”billing.invoice.createdbilling.invoice.paid
Delivery Status
Section titled “Delivery Status”| Status | Description |
|---|---|
pending | Awaiting delivery |
delivered | Successfully delivered |
failed | Delivery failed |
retrying | Retry in progress |
Retry Policy
Section titled “Retry Policy”| Attempt | Delay |
|---|---|
| 1 | Immediate |
| 2 | 1 minute |
| 3 | 5 minutes |
| 4 | 30 minutes |
| 5 | 2 hours |
Security
Section titled “Security”See Webhook Security for signature verification.
Next Steps
Section titled “Next Steps”- Search Rail - Full-text search
- Security Guide - Signature verification