Webhook Integration
Webhooks notify your application when blockchain operations complete. Instead of polling, receive HTTP callbacks with event data.
Register an Endpoint
const endpoint = await urblock.webhooks.create({
url: "https://example.com/webhooks/urblock",
events: [
"token.deployed",
"transaction.confirmed",
"transaction.failed",
],
});
Common Event Types
The most frequently used event types are listed below. For the complete list of all 55+ event types, see the Webhooks API reference.
| Event | Description |
|---|---|
token.deployed | Token contract deployed on-chain |
transaction.confirmed | Transaction confirmed |
transaction.failed | Transaction failed |
token.minted | Token minted |
token.transferred | Token transferred |
token.burned | Token burned |
token.approved | Token approval set |
token.paused | Token paused |
token.unpaused | Token unpaused |
nft.minted | NFT minted |
nft.transferred | NFT transferred |
nft.burned | NFT burned |
nft.metadata_updated | NFT metadata updated |
token.frozen | T-REX address frozen |
token.unfrozen | T-REX address unfrozen |
token.force_transferred | T-REX forced transfer |
token.recovered | T-REX identity recovery |
role.granted | Role granted |
role.revoked | Role revoked |
Webhook Payload
{
"object": "event",
"id": "evt_abc123",
"type": "transaction.confirmed",
"data": {
"object": "transaction",
"id": "tx_xyz789",
"status": "confirmed",
"tx_hash": "0x...",
"block_number": 12345678
},
"created": 1709740800
}
Signature Verification
Every webhook request includes an X-Urblock-Signature header signed with HMAC-SHA256. Verify it to ensure the request came from Urblock:
import crypto from "node:crypto";
function verifyWebhookSignature(
payload: string,
signature: string,
secret: string,
): boolean {
const expected = crypto
.createHmac("sha256", secret)
.update(payload)
.digest("hex");
return crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(expected),
);
}
List Endpoints
const endpoints = await urblock.webhooks.list();
Delete an Endpoint
await urblock.webhooks.delete("whe_abc123");
List Events
Query past events:
const events = await urblock.events.list({ limit: 20 });
Best Practices
- Verify signatures — always validate
X-Urblock-Signature - Return 2xx quickly — process events asynchronously
- Handle retries — Urblock retries failed deliveries with exponential backoff (5 attempts)
- Idempotency — use the
evt_ID to deduplicate events
Next Steps
- API: Webhooks — full webhook endpoint reference
- API: Events — event listing endpoints
- Concepts: Webhooks Overview — webhook architecture
- Async Operations — replace polling with webhooks