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.
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.
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);