Webhook
Cloudin POST event ke URL kamu setiap email masuk (atau event lain yang kamu subscribe).
Setup
- Buka Layanan → Webhook → Tambah webhook
- Input URL endpoint kamu
- Pilih event types
- Secret muncul sekali — catat untuk verify HMAC
Event types
message.received— email baru masukmessage.deleted— email dihapusaddress.created— address baru di-generateaddress.expired— address kedaluwarsadomain.verified— DNS verify OKdomain.lost— DNS verify gagal 3xservice.suspended/service.reactivated— billing state
Payload format
{
"id": "evt_01HXY...",
"type": "message.received",
"created_at": "2026-05-28T07:00:00Z",
"data": {
"message": {
"id": "msg_01HXY...",
"address": "abc@inbox.brandkamu.id",
"from": "sender@example.com",
"subject": "Verifikasi Email",
"preview": "Klik link...",
"otp_code": "891-203"
}
}
}
Verify signature (HMAC SHA256)
Setiap delivery dikirim dengan header:
X-Cloudin-Timestamp— Unix timestampX-Cloudin-Signature—sha256=
const crypto = require('crypto');
function verifyWebhook(rawBody, timestamp, signature, secret) {
// Reject kalau >5 menit (anti-replay)
if (Math.abs(Date.now()/1000 - parseInt(timestamp)) > 300) return false;
const expected = 'sha256=' + crypto
.createHmac('sha256', secret)
.update(${timestamp}.${rawBody})
.digest('hex');
return crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(expected)
);
}
Retry policy
Webhook delivery retry exponential backoff:
| Attempt | Delay |
|---|---|
| 1 | instant |
| 2 | 1 menit |
| 3 | 5 menit |
| 4 | 30 menit |
| 5 | 6 jam |
| 5x fail | webhook disabled, kamu dapat notif |