Webhooks

Provides methods for registering, listing and deleting webhooks necessary to participate in the validator marketplace



📘

For more inspiration, check out these recipes involving validator marketplace webhooks


deleteWebhook(webhookId: string)**:

Delete a registered validator marketplace webhook

const webhookId= 'a1a1a1_a1a1a1_a1a1_a1a1a1'

const deletion = await api.validatorMarketplaceWebhooks.deleteWebhook('webhook-id')
  
if (deletion.status === 204) {
    console.log('Webhook deleted')
  }
  else {
    console.log('Webhook deletion failed')
  }

listRegisteredWebhooks(webhookId: string)**:

List all validator marketplace webhooks for the user

  const {body: myWebhooks} = await api.validatorMarketplaceWebhooks.listRegisteredWebhooks()

  for (const webhook of myWebhooks) {
    console.log(`
    Webhook ID: ${webhook.id}
    Webhook URL: ${webhook.url}
    Webhook Type: ${webhook.eventType}
    `)
  }

registerWebhook(webhookId: string)**:

Register a new webhook.

  const bidReceivedWebhook: WebhookRegistration = {
    url: 'https://webhook.site/1b1b1b1b-1b1b-1b1b-1b1b-1b1b1b1b1b1b',
    eventType: 'RFQBidReceived',
    secret: 'secret', //bearer token secret which should be validated by the webhook
  }

  await api.validatorMarketplaceWebhooks.registerWebhook(bidReceivedWebhook)