Dokumentasi Resmi
|tulis.org

Arsitektur Dokumentasi

Peta jalan panduan, SDK integration, dan API reference lengkap yang disiapkan secara terstruktur.

TULIS CMS/DEVELOPER HUB
/api-reference-webhooks-manage

Webhooks

Mengkonfigurasi webhook yang akan dipanggil saat event tertentu terjadi di workspace (post published, post updated, dll). Berguna untuk integrasi dengan deployment pipeline, notifikasi, atau search indexing.


Create Webhook

Mendaftarkan URL webhook baru.

Endpoint

POST /api/webhooks

Authentication

Bearer Token (JWT) + X-Workspace-ID header · Role: editor+

Request Body

FieldTypeRequiredDescription
urlstringyaURL endpoint yang akan dipanggil.
eventsarrayyaEvent yang memicu webhook.
secretstringtidakSecret untuk validasi signature (rekomendasi: selalu isi).

Event yang tersedia:

EventDipicu saat
post.createdPost baru dibuat.
post.updatedPost diperbarui.
post.publishedPost status berubah ke published.
post.deletedPost dihapus.
comment.createdKomentar baru (perlu moderasi).
comment.approvedKomentar disetujui.
{
  "url": "https://my-frontend.com/api/revalidate",
  "events": ["post.published", "post.updated", "post.deleted"],
  "secret": "whsec_mysecret123"
}

Response

{
  "status": 201,
  "message": "Webhook created",
  "data": {
    "id": "wh_abc123...",
    "url": "https://my-frontend.com/api/revalidate",
    "events": ["post.published", "post.updated", "post.deleted"],
    "created_at": "2026-01-17T10:00:00Z"
  }
}

List Webhooks

Mendapatkan daftar semua webhook yang terdaftar.

Endpoint

GET /api/webhooks

Authentication · Role: editor+


Delete Webhook

Menghapus webhook.

Endpoint

DELETE /api/webhooks/:id

Authentication · Role: editor+


Webhook Delivery Logs

Melihat log pengiriman webhook (sukses/gagal).

Endpoint

GET /api/webhooks/:id/logs

Authentication · Role: editor+

Response

{
  "status": 200,
  "data": [
    {
      "id": "dl_abc123...",
      "event": "post.published",
      "url": "https://my-frontend.com/api/revalidate",
      "status": "success",
      "status_code": 200,
      "response_body": "{\"revalidated\":true}",
      "delivered_at": "2026-01-17T10:05:00Z"
    },
    {
      "id": "dl_def456...",
      "event": "post.updated",
      "url": "https://my-frontend.com/api/revalidate",
      "status": "failed",
      "status_code": 500,
      "error": "Internal Server Error",
      "delivered_at": "2026-01-17T10:10:00Z"
    }
  ]
}

Verifikasi Signature

Tulis CMS mengirim header X-Tulis-Signature di setiap request webhook. Gunakan secret untuk memverifikasi:

// Contoh verifikasi di Node.js
const crypto = require('crypto');

function verifySignature(payload, signature, secret) {
  const expected = crypto
    .createHmac('sha256', secret)
    .update(JSON.stringify(payload))
    .digest('hex');
  return crypto.timingSafeEqual(
    Buffer.from(signature),
    Buffer.from(expected)
  );
}

Panduan Lengkap

Lihat Webhooks Guide untuk contoh integrasi lengkap dengan Next.js ISR dan deployment trigger.

Lini Masa Peluncuran Fitur

Fase 1: Setup Awal & KonfigurasiSELESAI

Docker Compose, pengaturan file environment, dan panduan setup lokal telah lengkap dibuat.

Fase 2: Referensi RESTful APISELESAI

Dokumentasi route endpoint publik, otentikasi JWT, dan kontrol hak akses telah selesai disusun.

Fase 3: Integrasi Frontend & Fitur LanjutSEDANG BERJALAN

Mempersiapkan boilerplate untuk Next.js client, manajemen revisi konten, dan optimasi query.