Hook
The hook service allows the Playtix API to communicate with your application to inform you of an internal event.
#
ProcessWhen one or more events relevant to you are triggered, the API checks if a hook exists and sends the events to the registered URL.
An event that is relevant to you is an event that concerns an on chain item related to a game that you own.
#
Subscribe to Playtix hookHook need just a few parameters to be created and subscribed :
- The Playtix Identifier of the game you want to receive the event for.
- The URL that the hook will call when an event is generated and caught.
Hooks are currently registered manually by our team, send us these informations, and we will set them up for you. It is recommended to have only one hook. Security enhancements are coming soon with authentication and validation of hooks.
#
List of events that trigger the hook#
Change of ownerWhen an item has changed ownership, we generate an event with the following data :
- event : Contain "ItemOwnerChanged", this is the name of the event
- item_id : The Playtix Identifier of the item
- old_owner_player_id : The Playtix Identifier of the old player who owns the NFT, if the player is not registered and does not have a Playtix account, the value is null.
- new_owner_player_id : The Playtix Identifier of the new player who owns the NFT, if the player is not registered and does not have a Playtix account, the value is null.
#
NFT burnedWhen an item is burned, we generate an event with the following data :
- event : Contain "ItemNftBurned", this is the name of the event
- item_id : The Playtix Identifier of the item
- owner_id : The Playtix Identifier of the player who owns the NFT, if the player is not registered and does not have a Playtix account, the value is null.
- schema_id : The Playtix identifier of the burned item schema.
#
receiving a hook callIf you subscribe to Playtix hook, events are grouped and sent to the URL by a POST call. The events are grouped by interval of five seconds and sent in the body in JSON.
Example of RAW HTTP request :
All events are mixed in the same array, you have to check which type of event you receive individually.
Use the "event" parameters to check the type of event.