TypeScript SDK
import { NinjaChat } from "@ninjachat/sdk";
const client = new NinjaChat({ apiKey: process.env.NINJACHAT_API_KEY! });
const endpoint = await client.webhooks.create({
url: "https://example.com/webhooks/ninjachat",
events: ["video.completed", "video.failed"],
});
console.log(endpoint.secret); // Store once, then redact it from logs.import os
from ninjachat import NinjaChat
client = NinjaChat(api_key=os.environ["NINJACHAT_API_KEY"])
endpoint = client.webhooks.create(
url="https://example.com/webhooks/ninjachat",
events=["video.completed", "video.failed"],
)
print(endpoint["secret"]) # Store once, then redact it from logs.curl --request POST \
--url https://www.ninjachat.ai/api/v1/webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "<string>"
}
'{
"id": "<string>",
"url": "<string>",
"events": [
"video.completed"
],
"secret": "<string>",
"message": "<string>",
"destination": "webhook"
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}Webhooks
Create a webhook
Register an HTTPS URL. Generic receivers get signed JSON; Discord and Slack incoming webhook URLs are detected automatically and receive rich alerts without NinjaChat signing-secret setup. Platform URL credentials are redacted in responses. New events require explicit subscription; omitted events retain the six original defaults. Console: https://www.ninjachat.ai/developers/webhooks
POST
/
webhooks
TypeScript SDK
import { NinjaChat } from "@ninjachat/sdk";
const client = new NinjaChat({ apiKey: process.env.NINJACHAT_API_KEY! });
const endpoint = await client.webhooks.create({
url: "https://example.com/webhooks/ninjachat",
events: ["video.completed", "video.failed"],
});
console.log(endpoint.secret); // Store once, then redact it from logs.import os
from ninjachat import NinjaChat
client = NinjaChat(api_key=os.environ["NINJACHAT_API_KEY"])
endpoint = client.webhooks.create(
url="https://example.com/webhooks/ninjachat",
events=["video.completed", "video.failed"],
)
print(endpoint["secret"]) # Store once, then redact it from logs.curl --request POST \
--url https://www.ninjachat.ai/api/v1/webhooks \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "<string>"
}
'{
"id": "<string>",
"url": "<string>",
"events": [
"video.completed"
],
"secret": "<string>",
"message": "<string>",
"destination": "webhook"
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}Authorizations
Use an API key created in the NinjaChat developer console.
Body
application/json
Maximum string length:
2000Minimum array length:
1Available options:
video.completed, video.failed, pipeline.completed, pipeline.failed, request.failed, budget.alert, balance.low, balance.exhausted, credits.added, auto_recharge.failed, key.created, key.revoked, budget.updated Response
Webhook created. The signing secret is returned once (used only by generic receivers).
Available options:
video.completed, video.failed, pipeline.completed, pipeline.failed, request.failed, budget.alert, balance.low, balance.exhausted, credits.added, auto_recharge.failed, key.created, key.revoked, budget.updated Available options:
webhook, discord, slack