> ## Documentation Index
> Fetch the complete documentation index at: https://docs.contentmod.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Webhooks

> Parse webhooks received from ContentMod

We provide a utility function to parse webhooks received from ContentMod and make them Type safe.

To parse a webhook, you can use the `parseWebhook` function.

```ts index.ts theme={null}
import { ContentMod, WebhookEvent } from "@contentmod/sdk";

const body = req.body; // JSON body of the POST request.

const contentMod = new ContentMod({
  publicKey: "<YOUR_PUBLIC_KEY>",
  secretKey: "<YOUR_SECRET_KEY>",
});

const webhook = contentMod.parseWebhook(body);

switch (webhook.event) {
  case WebhookEvent.ModerationCompleted:
    console.log("moderation.completed", webhook);
    break;
  case WebhookEvent.QueueReviewCompleted:
    console.log("queue.review.completed", webhook.data.status);
    break;
}

console.log(webhook);
```
