Webhooks

In this guide, we will look at how to register and consume webhooks to integrate your app with Signet. With webhooks, your app can know when something happens in Signet, such as when user has been blacklisted or verification has been completed.

Registering webhooks

To register a new webhook, you need to have a URL in your app that Signet can call. You can configure a new webhook from the Signet dashboard under API settings. Give your webhook a name, pick the events you want to listen for, and add your URL.

Now, whenever something of interest happens in your app, a webhook is fired off by Signet. In the next section, we'll look at how to consume webhooks.

Consuming webhooks

When your app receives a webhook request from Signet, check the eventTypes attribute to see what event caused it. The first part of the event type will tell you the payload type, e.g., a user created, fraud reported, etc.

Example webhook payload

{
  "success": true,
  "data": {
    "id": "endpoint-uuid",
    "secret": "64-character-hex-secret",
    "url": "https://your-app.com/webhook",
    "eventTypes": ["FRAUD_REPORTED"],
    // ...
  }
}

In the example above, a fraud has been reported, and the payload type is a FRAUD_REPORTED.

Event types

  • Name
    FRAUD_REPORTED
    Description

    When fraud is detected and reported.

  • Name
    USER_CREATED
    Description

    When a new user is created.

  • Name
    USER_UPDATED
    Description

    When user information is updated.

  • Name
    PAYMENT_PROCESSED
    Description

    When a payment is processed.

Example payload

{
  "success": true,
  "data": {
    "id": "endpoint-uuid",
    "secret": "64-character-hex-secret",
    "url": "https://your-app.com/webhook",
    "eventTypes": ["FRAUD_REPORTED"],
    "metadata": {
      "createdAt": "2025-01-01T12:00:00.000Z",
      "status": "active",
      "verification": {
        "verifiedAt": "2025-01-01T12:00:00.000Z",
        "validUntil": "2025-04-01T12:00:00.000Z"
      }
    },
    "usage": {
      "rateLimit": {
        "maxRequests": 100,
        "windowSeconds": 60
      }
    }
  }
}

Security

To know for sure that a webhook was, in fact, sent by Signet instead of a malicious actor, you can verify the request signature. Each webhook request contains a header named x-signet-signature, and you can verify this signature by using your secret webhook key. The signature is an HMAC hash of the request payload hashed using your secret key. Here is an example of how to verify the signature in your app:

Verifying a request

const signature = req.headers['x-signet-signature']
const hash = crypto.createHmac('sha256', secret).update(payload).digest('hex')

if (hash === signature) {
  // Request is verified
} else {
  // Request could not be verified
}

If your generated signature matches the x-signet-signature header, you can be sure that the request was truly coming from Signet. It's essential to keep your secret webhook key safe — otherwise, you can no longer be sure that a given webhook was sent by Signet. Don't commit your secret webhook key to GitHub!

Was this page helpful?