Webhooks are used to get real time guaranteed messages of ecosystem events such as state finalization, transfers, marketplace sales, and more from the platform.
First, register the webhook.
// Define the webhookconstwebhook= {"url":"http://url.com/webhook","authorizationHeaderName":"Authorization","authorizationKey":"Bearer jwt"}// Register the webhookconstresponse=awaitfetch('/v1/webhook', { method:'POST', headers: {"Content-Type":"application/json" }, body:JSON.stringify(webhook),});constdata=awaitresponse.json();