Webhooklar

Temel URL https://arteza.ai/api/v1

OpenAPI 3.1 spesifikasyonu, SDK oluşturucuları ve ajanlar için: /api/v1/openapi.json

TypeScript ve Python için resmi SDK'lar, bir komut satırı ve agent becerlileri: SDK'lar ve CLI

Bir oluşturmayı oluştururken webhook_url iletin ve oluşturma tamamlandığında, başarısız olduğunda veya iptal edildiğinde son oluşturmayı buna POST edin. URL genel HTTPS olmalıdır.

Her teslimat, Standart Webhooks şemasını kullanarak webhook gizli anahtarınız ile imzalanır: webhook-id, webhook-timestamp ve webhook-signature başlıkları. Gövdeye güvenmeden önce imzayı doğrulayın ve yinelemeleri yok saymak için webhook-id'yi kullanın.

import crypto from "node:crypto";

// secret: whsec_... from the console. body: the raw request body string.
export function verify(secret, headers, body) {
  const id = headers["webhook-id"];
  const ts = headers["webhook-timestamp"];
  if (Math.abs(Date.now() / 1000 - Number(ts)) > 300) return false;
  const key = Buffer.from(secret.replace(/^whsec_/, ""), "base64");
  const expected = crypto.createHmac("sha256", key).update(`${id}.${ts}.${body}`).digest("base64");
  return headers["webhook-signature"].split(" ").some((s) => {
    const sig = s.split(",")[1] ?? "";
    return sig.length === expected.length && crypto.timingSafeEqual(Buffer.from(sig), Buffer.from(expected));
  });
}

On saniye içinde herhangi bir 2xx ile yanıtlayın. Aksi takdirde 24 saat boyunca geri çekilme ile yeniden deneriz. Konsoldan her teslimatı görebilir ve birini yeniden gönderebilirsiniz.