Marketing Consent Webhooks
Aghanim's marketing consent webhooks notify your game about changes to a player's marketing consent, allowing you to keep your marketing lists in sync.
Webhook events
Use these webhook events to manage your marketing lists.
| Event | When it fires | What you should do |
|---|---|---|
player.marketing_consent.updated | A player's marketing consent state changes | Update your marketing lists accordingly |
Requirements
To use marketing consent webhooks from Aghanim, you should have the webhook server configured as follows:
- HTTPS endpoint, accepting POST webhook requests.
- Listen for events, generated and signed by Aghanim.
- Handle the
idempotency_keyincluded in the webhook payload to prevent processing duplicate webhooks. - Respond with 2xx status codes if the event was processed successfully, and 4xx or 5xx for errors.
Configuration
- Develop a function for marketing consent webhook processing.
- Make your endpoint available.
- Register your endpoint within Aghanim account → Game → Webhooks → New Webhook by choosing the marketing consent event types you want to handle.
Alternatively, you can register your endpoint within Aghanim using the Create Webhook API method.
Request schema
아래는 예시입니다 player.marketing_consent.updated 웹훅 요청:
- 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.marketing_consent.updated",
"event_data": {
"player_id": "2D2R-OP3C",
"email": {
"address": "player@example.com",
"granted_at": 1704067200,
"revoked_at": null
}
},
"event_time": 1725548450,
"event_id": "whevt_eCacGbJVbvToOgzjXUgOCitkQE",
"idempotency_key": null,
"request_id": "d1593e9c-c291-4004-8846-6679c2e5810b",
"sandbox": false,
"trigger": "hub.purchase",
"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.marketing_consent.updated",
"event_data": {
"player_id": "2D2R-OP3C",
"email": {
"address": "player@example.com",
"granted_at": 1704067200,
"revoked_at": null
}
},
"event_time": 1725548450,
"event_id": "whevt_eCacGbJVbvToOgzjXUgOCitkQE",
"idempotency_key": null,
"request_id": "d1593e9c-c291-4004-8846-6679c2e5810b",
"sandbox": false,
"trigger": "hub.purchase",
"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.marketing_consent.updated 이럴 경우. |
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 | object|null | 이벤트에 대한 컨텍스트 정보. |
The EventData schema
| Key | Type | Description |
|---|---|---|
player_id | string | The unique Player ID chosen for player authentication. |
email | EmailChannel|null | Email channel consent. Present when email consent changed. |
The EmailChannel schema
| Key | Type | Description |
|---|---|---|
address | string | The player's email address. |
granted_at | number | Unix timestamp when consent was granted. |
revoked_at | number|null | Unix timestamp when consent was revoked. null if consent has not been revoked. |
The Trigger values
| Value | Description |
|---|---|
hub.purchase | When a player opts in to marketing during checkout. |
s2s.player.marketing_consent.grant | When consent is granted via the Grant Email Marketing Consent S2S API. |
s2s.player.marketing_consent.revoke | When consent is revoked via the Revoke Email Marketing Consent S2S API. |
dashboard.player.marketing_consent.revoke | When consent is revoked through the Aghanim Dashboard. |
test | When using the "Send test event" in the Dashboard. |
도움이 필요하세요?
통합팀에 문의하십시오 integration@aghanim.com