Webhook
When setting up a project, you can choose between two channels of notifications:
email
webhook
On this page, we will focus on how to set up a webhook in your application to receive the data from Leandexer.
What is a webhook?
A webhook is a method used to send real-time data from one application to another based on specific events. This is achieved by configuring a URL endpoint in the receiver application, which listens for incoming HTTP requests triggered by the sender application whenever the designated event occurs. Webhooks enable seamless, automated data transfers and integrations without the need for continuous polling or manual updates.
Setting up your webhook
To set up the webhook, simply define a new route on your back-end router, using the following payload as request body:
{
"smart_contract_address": String,
"project": {
"id": BigInteger,
"name": String
},
"time": BigInteger, // epoc time format
"network": String,
"event": {
"name": String,
"payload": {
"encoded": String, // hex string encoded payload
"decoded": {
"from": String,
"to": String,
"amount": BigInteger
}
},
"block_number": BigInteger
}
}A little explanation of the code above:
smart_contract_address: the address of the smart contract concerned by the notificationprojectare the information related to the project sending the notification: the name and the identifieridis the internal identifier of the project in the system, that you can use on your application to map datanameis the label you attached to your project when creating it in the Leandexer App
timeis the epoch formated time of the emitted eventnetworkis the name of the network on which the event was emittedeventis all the data related to the event itself:namethe name of the event, as emitted by the smart contract (i.e.TransferApproval...)payloadis the payload of the event, containing:encodedthe hexadecimal encoded string, as read on the blockchaindecodedthe decoded, humanly readable content of the event:fromthe wallet which emitted the transactiontoif eligible, the wallet receiving the transactionamountif eligible, the amount exchanged during the transaction
block_numberthe number of the block which validated the transaction
Last updated