웹훅 설정
웹훅을 등록하면 새 메시지, 채널 상태 변경 등의 이벤트를 실시간으로 수신할 수 있습니다.
웹훅 등록
- 대시보드 → 설정 → 웹훅으로 이동합니다
- 웹훅 추가를 클릭합니다
- 수신할 URL과 이벤트를 설정합니다
이벤트 목록
| 이벤트 | 설명 |
|---|---|
message.created | 새 메시지 수신 |
channel.opened | 채널 열림 |
channel.closed | 채널 닫힘 |
contact.created | 새 연락처 생성 |
요청 형식
웹훅 요청은 POST로 전송되며, 본문은 JSON입니다.
{
"event": "message.created",
"timestamp": "2026-04-25T12:00:00Z",
"data": {
"channelId": "ch_abc123",
"message": {
"id": "msg_def456",
"content": "안녕하세요",
"sender": "contact"
}
}
}
서명 검증
웹훅 요청의 X-ZeroTalk-Signature 헤더로 요청의 진위를 검증할 수 있습니다.
const crypto = require('crypto');
function verifySignature(payload, signature, secret) {
const expected = crypto
.createHmac('sha256', secret)
.update(payload)
.digest('hex');
return signature === expected;
}