Add a webhook

Set up webhooks so that your systems can automatically trigger reactions from Indent events.

Indent uses webhooks to notify your application when an event happens. Webhooks are particularly useful for asynchronous events like when a someone approves an access request, someone's time-based access grant expires, or a suspicious access pattern is identified.

First, you’ll need to create your space:


If you didn’t create an Input as part of setting up your space, you’ll need to create one:


Now you’ll create an Output that sends events to your webhook:


Here's an example webhook handler:

import { json, send } from 'micro'
import { verify } from '@indent/webhook'

export default async function(req, res) {
  const body = await json(req)

  await verify({
    secret: process.env.INDENT_WEBHOOK_SECRET,
    timestamp: req.headers['x-indent-timestamp'],
    signature: req.headers['x-indent-signature'],
    body
  })

  const { events } = body

  events.forEach(event => {
    // process each event
  })

  send(res, 200, 'ok')
}

Once you’ve deployed this webhook, update the URL in your Output and you should start to see events flow into your webhook!