Skip to main content

Overview

When you register a new webhook endpoint, Hirempire sends a challenge request to verify that you own and control the endpoint. Your server must correctly respond to this challenge before it can start receiving webhook events.

How It Works

1

Hirempire Sends a Challenge

When you create or update a webhook, Hirempire sends a POST request to your endpoint with a challenge field in the JSON body.
2

Your Server Returns the Challenge

Your endpoint must read the challenge value from the request body and return it exactly as received in the response.
3

Verification Complete

If the returned value matches, your webhook is verified and will begin receiving event notifications.

Challenge Request

Hirempire sends a POST request with the following JSON body:
{
  "challenge": "a1b2c3d4e5f6g7h8i9j0",
  "type": "url_verification"
}

Expected Response

Your server must return the same challenge value in the response body:
{
  "challenge": "a1b2c3d4e5f6g7h8i9j0"
}
The challenge value must be returned exactly as received. Any modification, extra whitespace, or encoding changes will cause verification to fail.

Example Implementation

app.post('/webhook', (req, res) => {
  const { challenge } = req.body;

  // If a challenge is present, respond with it
  if (challenge) {
    return res.json({ challenge });
  }

  // Otherwise, handle the webhook event
  const event = req.body;
  console.log('Received event:', event.event);

  res.sendStatus(200);
});
Your endpoint should handle both challenge verification requests and regular event notifications on the same URL. Check for the presence of the challenge field to distinguish between the two.