Webhook Events: NFTs
The NFT webhook event signals when an NFT is created or modified. It includes token_id to metadata_id mappings, which link metadata stacks to each NFT. When used in conjunction with the metadata_updated event, it enables the mapping of assets to their respective metadata, providing a comprehensive view of NFTs and their associated metadata within Immutable's ecosystem.
What information does the NFT webhook event provide?
The nft_updated
event is triggered when a new asset is minted from a collection on zkEVM or when an existing NFT is updated (e.g., an asset receives a new metadata_id
due to metadata updates). While this event does not provide metadata attributes, it does offer valuable token_id
to metadata_id
mappings for assets. By storing metadata attribute details and token mappings in an application's backend, developers can gain deeper insights into the assets that have been updated on the blockchain.
Subscribing to both nft_updated
and metadata_updated events enables the creation of a local record containing an asset's metadata, along with the establishment of mappings from token_id
to metadata_id
. This approach significantly reduces the need for frequent queries to the NFT endpoint to retrieve additional asset details.
This event does not indicate when an asset changes ownership as a result of a transfer or trade. Information related to ownership changes can be found in the webhooks Activities events, specifically under activityTypes
"transfer" and "sale."
Example responses
Below are some examples of nft_updated
events for common use-cases:
New NFT is minted (created)
{
"event_name": "imtbl_zkevm_nft_updated",
"event_id": "018b4123-9b19-c08e-afc4-e76bcebae547",
"chain": "imtbl-zkevm-testnet",
"data": {
"chain": {
"id": "eip155:13472",
"name": "imtbl-zkevm-testnet"
},
"contract_address": "0x43c98025464e9b326be3c3782db5867073b8e78c",
"indexed_at": "2023-10-18T04:55:34.400837Z",
"metadata_synced_at": null,
"token_id": "4201",
"metadata_id": null
}
}
Existing NFT is updated with a new metadata_id
{
"event_name": "imtbl_zkevm_nft_updated",
"event_id": "018b4123-aa9e-1081-0fcc-8a5c838662de",
"chain": "imtbl-zkevm-testnet",
"data": {
"chain": {
"id": "eip155:13472",
"name": "imtbl-zkevm-testnet"
},
"contract_address": "0x43c98025464e9b326be3c3782db5867073b8e78c",
"indexed_at": "2023-10-18T04:55:34.400837Z",
"metadata_synced_at": "2023-10-18T04:55:38.352336Z",
"token_id": "4201",
"metadata_id": "018b4123-aa5b-dde7-df64-b23e450cbf23"
}
}