플레이어 업데이트 웹훅
player.update 웹훅은 Game Hub에서 플레이어의 프로필이 업데이트될 때 트리거됩니다. 이 이벤트는 게임 내에서 플레이어의 닉네임, 이메일, 아바타와 같은 플레이어 정보를 업데이트하는 데 유용합니다.
요구 사항
Aghanim의 플레이어 업데이트 웹훅을 사용하려면 웹훅 서버를 다음과 같이 구성해야 합니다:
- POST 웹후크 요청을 수락하는 HTTPS 엔드포인트.
- Aghanim이 생성하고 서명한 이벤트를 수신합니다.
- 수신된 콘텐츠를 사용하여 모바일 푸시 표시를 트리거합니다.
- 웹훅을 성공적으로 수신하고 처리한 경우에는 2xx 상태 코드를 응답하며, 거부 또는 오류가 발생한 경우에는 4xx 또는 5xx를 응답합니다.
구성
player.update웹훅 처리를 위한 함수를 개발합니다.- 엔드포인트를 사용 가능하게 설정하세요.
- Aghanim 계정 내에서 엔드포인트를 등록합니다 → 게임 → 웹훅 → 새 웹훅에서 플레이어 업데이트 이벤트 유형을 선택합니다.
대안으로, 웹후크 생성 API 방법을 사용하여 Aghanim 내에서 엔드포인트를 등록할 수 있습니다.
요청 스키마
아래는 예시입니다 player.update 웹훅 요청:
- HTTP
- cURL
POST /your/webhook/uri HTTP/1.1
Content-Type: application/json
Host: your-webhook-endpoint.com
User-Agent: Aghanim/0.1.0
X-Aghanim-Signature: 2e45ed4dede5e09506717490655d2f78e96d4261040ef48cc623a780bda38812
X-Aghanim-Signature-Timestamp: 1725548450
{
"event_type": "player.update",
"event_data": {
"player_id": "2D2R-OP3C",
"email": "PlayerOne@aghanim.com"
},
"event_time": 1725548450,
"event_id": "whevt_eCacGbJVbvToOgzjXUgOCitkQE",
"idempotency_key": null,
"request_id": "d1593e9c-c291-4004-8846-6679c2e5810b",
"sandbox": false,
"trigger": "hub.profile_update",
"transaction_id": "whtx_eCacGbJVbvT",
"context": null,
"game_id": "gm_exTAyxPsVwh"
}
curl "https://your-webhook-endpoint.com/your/webhook/uri" \
-X POST \
-H "Content-Type: application/json" \
-H "User-Agent: Aghanim/0.1.0" \
-H "X-Aghanim-Signature: 2e45ed4dede5e09506717490655d2f78e96d4261040ef48cc623a780bda38812" \
-H "X-Aghanim-Signature-Timestamp: 1725548450" \
-d '{
"event_type": "player.update",
"event_data": {
"player_id": "2D2R-OP3C",
"email": "PlayerOne@aghanim.com"
},
"event_time": 1725548450,
"event_id": "whevt_eCacGbJVbvToOgzjXUgOCitkQE",
"idempotency_key": null,
"request_id": "d1593e9c-c291-4004-8846-6679c2e5810b",
"sandbox": false,
"trigger": "hub.profile_update",
"transaction_id": "whtx_eCacGbJVbvT",
"context": null,
"game_id": "gm_exTAyxPsVwh"
}'
이벤트 스키마
| Key | 유형 | 설명 |
|---|---|---|
event_id | string | Aghanim에 의해 생성된 고유 이벤트 ID. |
game_id | string | Aghanim 시스템에서의 귀하의 게임 ID. |
event_type | string | 이벤트의 유형, player.update 이럴 경우. |
event_time | number | 유닉스 에포크 시간으로 된 이벤트 날짜. |
event_data | EventData | 이벤트 특정 데이터가 포함되어 있으며, 상속된 객체에 대한 가능한 키가 포함됩니다. |
idempotency_key | string|null | 웹훅 작업이 재시도되 어도 한 번만 실행되도록 보장합니다. 일 수 있습니다 null 이벤트 유형에 따라 달라집니다. |
request_id | string|null | 이벤트가 API 요청에 의해 트리거된 경우, 요청 ID가 포함됩니다. |
sandbox | boolean | 이 이벤트가 샌드박스 게임 환경에서 전송되었는지를 표시합니다. |
trigger | string|null | The trigger that caused the event to be sent. |
transaction_id | string | Aghanim이 생성한 거래 ID입니다. 이 ID는 동일한 거래 내에서 발생한 여러 이벤트에서 동일할 수 있습니다. |
context | EventContext|null | 이벤트에 대한 컨텍스트 정보. |
EventContext 스키마
| Key | 유형 | 설명 |
|---|---|---|
order | OrderContext|null | 해당되는 경우 이벤트와 관련된 주문 정보입니다. |
player | PlayerContext|null | 플레이어 정보를 추가하려면 웹훅 설정에서 "플레이어 컨텍스트 추가"를 활성화하세요. |
EventData 스키마
| Key | 유형 | 설명 | 필수 여부 |
|---|---|---|---|
player_id | string | 플레이어 인증을 위해 선택된 고유한 플레이어 ID. | 예 |
name | string | 플레이어의 닉네임. | 아니요 |
email | string | 플레이어의 이메일 주소. | 아니요 |
avatar_url | string | 플레이어의 아바타 URL. | 아니요 |
응답 스키마
웹훅 응답 예시
{
"status": "ok"
}
실패 응답 예시
200 상태 코드와 다음 JSON 응답을 반환하세요:
{
"status": "error",
"code": "not_found",
"message": "플레이어를 찾을 수 없습니다"
}
가능한 오류 코드 목록:
not_found: 플레이어를 찾을 수 없습니다.invalid_signature: 서명이 유효하지 않았습니다.validation_error: 요청 데이터가 유효하지 않았습니다.
도움이 필요하세요?
통합팀에 문의하십시오 integration@aghanim.com