Back to Docs
Advanced6 min read

Webhooks

Receive real-time notifications via webhooks

Webhook Setup

Configure webhooks to receive real-time notifications for important events.

Creating a Webhook

typescript
const webhook = await client.createWebhook({
  url: 'https://your-server.com/nexo-webhook',
  events: ['transaction.confirmed', 'alert.mev', 'scan.complete'],
  secret: 'your_webhook_secret'
});

Event Types

  • transaction.pending - Transaction submitted
  • transaction.confirmed - Transaction confirmed
  • transaction.failed - Transaction failed
  • alert.mev - MEV attempt detected
  • alert.risk - High-risk activity detected
  • scan.complete - Contract scan finished

Webhook Payload

json
{
  "id": "evt_123456",
  "type": "transaction.confirmed",
  "timestamp": 1699999999,
  "data": {
    "signature": "...",
    "wallet": "...",
    "status": "confirmed",
    "slot": 123456789
  }
}

Verifying Webhooks

typescript
import { verifyWebhookSignature } from '@nexo/sdk';

const isValid = verifyWebhookSignature(
  payload,
  signature,
  secret
);