Daftarkan webhook
Melanggankan URL publik ke event yang didukung. Setiap endpoint menerima secret HMAC-SHA256 sendiri, ditampilkan sekali saat dibuat. Jika hilang, hapus endpoint lalu tambahkan kembali.
https://notpanel.com/api/v3action=webhook.addapplication/x-www-form-urlencodedParameter
| Nama | Tipe | Deskripsi |
|---|---|---|
| keyWajib | string | API key Anda. |
| actionWajib | string | Harus berupa string literal "webhook.add". |
| urlWajib | string (URL) | Endpoint HTTPS publik yang akan menerima POST. Harus dapat dijangkau dari internet publik. |
| events | string (CSV) | Subset dipisah koma dari enam event yang didukung di bawah. Hilangkan untuk melanggan keenamnya. |
Contoh request
Ganti YOUR_API_KEY dengan key yang dibuat di halaman API dashboard Anda.
curl -X POST https://notpanel.com/api/v3 \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "key=YOUR_API_KEY&action=webhook.add&url=https://your-server.example.com/notpanel-webhook&events=order.completed,order.refunded"const res = await fetch("https://notpanel.com/api/v3", {
method: "POST",
headers: { "Content-Type": "application/x-www-form-urlencoded" },
body: new URLSearchParams({
key: "YOUR_API_KEY",
action: "webhook.add",
url: "https://your-server.example.com/notpanel-webhook",
events: "order.completed,order.refunded",
}),
});
const data = await res.json();
console.log(data);import requests
res = requests.post(
"https://notpanel.com/api/v3",
data={
"key": "YOUR_API_KEY",
"action": "webhook.add",
"url": "https://your-server.example.com/notpanel-webhook",
"events": "order.completed,order.refunded",
},
)
print(res.json())<?php
$body = http_build_query([
'key' => 'YOUR_API_KEY',
'action' => 'webhook.add',
'url' => 'https://your-server.example.com/notpanel-webhook',
'events' => 'order.completed,order.refunded',
]);
$response = file_get_contents('https://notpanel.com/api/v3', false, stream_context_create([
'http' => [
'method' => 'POST',
'header' => "Content-Type: application/x-www-form-urlencoded\r\n",
'content' => $body,
'ignore_errors' => true,
],
]));
print_r(json_decode($response, true));
Contoh response
{
"webhook_id": "3f2504e0-4f89-41d3-9a0c-0305e82c3301",
"url": "https://your-server.example.com/notpanel-webhook",
"secret": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
"events": [
"order.completed",
"order.refunded"
]
}Error umum
| Status | Body | Penyebab |
|---|---|---|
| 400 | {"error":"Maximum 5 webhook endpoints per API key"} | Endpoint yang ada telah menghabiskan batas. Hapus endpoint yang tidak terpakai dengan action=webhook.remove terlebih dahulu. |
| 400 | {"error":"Webhook URL must be a publicly reachable HTTPS URL"} | URL bukan alamat HTTPS yang valid, tidak dapat di-parse, atau me-resolve ke IP privat/loopback. |
| 400 | {"error":"Webhook event is invalid","error_code":"INVALID_WEBHOOK_EVENT"} | Nama event tidak ada di allow-list. Periksa kembali ejaan — nama menggunakan bentuk "order.<status>". |