Skip to main content
POST
/
v1
/
webhooks
/
{id}
/
test
웹훅 테스트
curl --request POST \
  --url https://sajuapi.dev/v1/webhooks/{id}/test \
  --header 'Content-Type: application/json' \
  --header 'X-API-Key: <api-key>' \
  --data '
{
  "event_type": "<string>",
  "reactivate": true
}
'

Documentation Index

Fetch the complete documentation index at: https://docs.sajuapi.dev/llms.txt

Use this file to discover all available pages before exploring further.

v1 Enterprise API (Coming Soon)이 엔드포인트는 Enterprise 버전에서 제공될 예정입니다. 현재는 v0 API를 사용하세요.
웹훅에 테스트 이벤트를 전송합니다. 웹훅 설정이 올바른지 확인하거나, 비활성화된 웹훅을 다시 활성화할 때 사용합니다.
테스트 이벤트의 data 필드에는 test: true가 포함됩니다. 이를 통해 실제 이벤트와 구분할 수 있습니다.

Path 파라미터

id
string
required
테스트할 웹훅의 ID입니다. whk_ 접두사로 시작합니다.

Request Body 파라미터

event_type
string
default:"test.ping"
테스트할 이벤트 유형입니다. 웹훅에 등록된 이벤트 중 하나를 선택할 수 있습니다.
reactivate
boolean
default:"false"
비활성화된 웹훅을 다시 활성화할지 여부입니다. 테스트가 성공하면 웹훅이 활성화됩니다.

Response

성공

테스트 전송에 성공하면 전송 결과가 반환됩니다.

실패

상태 코드에러 타입설명
401authentication_errorAPI 키가 유효하지 않음
404not_found웹훅을 찾을 수 없음
429rate_limited요청 한도 초과

요청 예시

# 기본 테스트
curl -X POST https://api.sajuapi.dev/v1/webhooks/whk_abc123def456/test \
  -H "X-API-Key: bs_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "event_type": "fortune.generated"
  }'

# 비활성화된 웹훅 재활성화
curl -X POST https://api.sajuapi.dev/v1/webhooks/whk_abc123def456/test \
  -H "X-API-Key: bs_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "event_type": "test.ping",
    "reactivate": true
  }'

응답 예시

성공

{
  "webhook_id": "whk_abc123def456",
  "event_type": "fortune.generated",
  "delivery": {
    "id": "dlv_test_xyz789",
    "status": "success",
    "response_code": 200,
    "response_time_ms": 145,
    "attempted_at": "2025-01-16T09:00:00Z"
  },
  "payload_sent": {
    "id": "evt_test_abc123",
    "type": "fortune.generated",
    "test": true,
    "created_at": "2025-01-16T09:00:00Z",
    "data": {
      "test": true,
      "message": "This is a test event"
    }
  },
  "reactivated": false
}

재활성화 성공

{
  "webhook_id": "whk_abc123def456",
  "event_type": "test.ping",
  "delivery": {
    "id": "dlv_test_xyz789",
    "status": "success",
    "response_code": 200,
    "response_time_ms": 89
  },
  "reactivated": true,
  "message": "웹훅이 성공적으로 재활성화되었습니다."
}

테스트 실패

{
  "webhook_id": "whk_abc123def456",
  "event_type": "fortune.generated",
  "delivery": {
    "id": "dlv_test_xyz789",
    "status": "failed",
    "response_code": 500,
    "error_message": "Internal Server Error",
    "response_time_ms": 5000
  },
  "reactivated": false
}

테스트 이벤트 페이로드

테스트 이벤트는 다음과 같은 형식으로 전송됩니다.
{
  "id": "evt_test_abc123",
  "type": "fortune.generated",
  "test": true,
  "created_at": "2025-01-16T09:00:00Z",
  "data": {
    "test": true,
    "message": "This is a test event",
    "fortune_id": "ftn_test_xxx",
    "profile_id": "prf_test_xxx",
    "score": 85
  }
}
테스트 이벤트는 test: true 필드를 포함합니다. 웹훅 핸들러에서 이 필드를 확인하여 실제 이벤트와 구분할 수 있습니다.

재활성화 조건

비활성화된 웹훅을 재활성화하려면 다음 조건을 충족해야 합니다.
  1. reactivate: true 파라미터를 전달해야 합니다.
  2. 테스트 이벤트가 성공적으로 전달되어야 합니다 (HTTP 2xx 응답).
  3. 응답 시간이 30초 이내여야 합니다.
재활성화에 성공하면 failure_count가 0으로 초기화됩니다.