Webhooks
Describes how to configure and use webhooks for the Wallet-API.
Intro
Introducing Webhooks that allow you to configure your endpoint URL and receive notifications for all your transactions. Configure webhooks from the Wallet-API product section on the Developer Portal.
Wallet-API: Receive notifications for all the successful and failed transactions carried out on all your wallets.
- Transaction Succeeded
- Transaction Failed
Retry Mechanism
If your endpoint URL is down, Venly will attempt to resend the notification message five times with an interval of 10 seconds in between to ensure delivery. After the last try, the message will be dropped since we don't store the webhook messages, they're not retrievable anymore.
In case your endpoint is down for more than 50 seconds and you don't receive the message:
Wallet-API: You can call the check transaction status endpoint using the transactionHash
of your specific transaction.
How to configure webhooks?
- Head over to the Developer Portal.
- Click on the product you want to configure webhooks for (Wallet API)
- Click on Create webhook
- Add the relevant information:
- Description: Any sample description of the webhook.
- Endpoint (POST): The endpoint URL that can accept POST calls.
- Type: Select your preferred authentication type.
- Username/ Header name: Enter your custom username or header name (depends on the authentication type you selected.)
- Password/ API key: Enter your custom password or API key (depends on the authentication type you selected).
- Finally, click Create.
Authentication is to be set up by you for your endpoint. This allows you to verify that the calls are coming from Venly.
- The webhook is created successfully!
- Click on the three dots to update or delete a webhook.
Payload Examples
In the payloads you receieve, look for
eventType
andresult.status
.
Successful Transaction
Following is the example of a payload that you will receive for a successful transaction.
{
"eventType": "TRANSACTION_SUCCEEDED",
"result": {
"hash": "0xa2b91d7032c71f6810aeb075c17de25c44af7fe7f75ad5c58ffd853d31fad5cd",
"status": "SUCCEEDED",
"confirmations": 5,
"blockHash": "0x35c20162d34a73fabbabcf5ed4d5f8585e3581f246a1a154ede1c01812cf405d",
"blockNumber": 46095097,
"hasReachedFinality": false,
"chain": "MATIC",
"nonce": 1,
"gas": 21000,
"gasUsed": 21000,
"gasPrice": 30000000016,
"logs": [
{
"logIndex": 0,
"data": "0x000000000000000000000000000000000000000000000000002386f26fc10000000000000000000000000000000000000000000000000000015ecb81c114ff00000000000000000000000000000000000000000000000000016345785d8a0000000000000000000000000000000000000000000000000000013b448f5153ff000000000000000000000000000000000000000000000000000186cc6acd4b0000",
"topics": [
"0xe6497e3ee548a3372136af2fcb0696db31fc6cf20260707645068bd3fe97f3c4",
"0x0000000000000000000000000000000000000000000000000000000000001010",
"0x000000000000000000000000734dd2331ded9754ad8c39ddda8067a723cc36a9",
"0x0000000000000000000000005e353f92bcaffcae9fd5c8d8ec530d63112f32fb"
]
},
{
"logIndex": 1,
"data": "0x00000000000000000000000000000000000000000000000000023cfb4e3560000000000000000000000000000000000000000000000000000161087d0f4f7f8000000000000000000000000000000000000000000000066cbb3ed45d1250c8ee000000000000000000000000000000000000000000000000015ecb81c11a1f8000000000000000000000000000000000000000000000066cbb411158608628ee",
"topics": [
"0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63",
"0x0000000000000000000000000000000000000000000000000000000000001010",
"0x000000000000000000000000734dd2331ded9754ad8c39ddda8067a723cc36a9",
"0x0000000000000000000000005082f249cdb2f2c1ee035e4f423c46ea2dab3ab1"
]
}
],
"from": "0x734dd2331ded9754ad8c39ddda8067a723cc36a9",
"to": "0x5e353f92bcaffcae9fd5c8d8ec530d63112f32fb",
"rawValue": 10000000000000000,
"value": 0.01,
"timestamp": "2024-02-19T10:48:33"
}
}
Failed Transaction
Following is the example of a payload that you will receive for a failed transaction.
{
"eventType": "TRANSACTION_FAILED",
"result":
{
"hash": "0x68561b2a59413c372a1fab4353b8904e7460726cf3437621b9237ef2ce82d718",
"status": "FAILED",
"confirmations": 10,
"blockHash": "0x56b131735b33bc5502197d0416bbf3578efde89490d8a64aa5a463657ec3fbf0",
"blockNumber": 46099161,
"hasReachedFinality": false,
"chain": "MATIC",
"nonce": 25,
"gas": 500000,
"gasUsed": 26548,
"gasPrice": 30000000019,
"logs":
[
{
"logIndex": 0,
"data": "0x0000000000000000000000000000000000000000000000000002d45ba34957b4000000000000000000000000000000000000000000000000037cd7d78c65cf0000000000000000000000000000000000000000000000365eaa4ab987f7626320000000000000000000000000000000000000000000000000037a037be91c774c00000000000000000000000000000000000000000000365eaa4d8de39aabbad4",
"topics":
[
"0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63",
"0x0000000000000000000000000000000000000000000000000000000000001010",
"0x00000000000000000000000096f06471cb1653617b778841106e40594f8d2105",
"0x000000000000000000000000be188d6641e8b680743a4815dfa0f6208038960f"
]
}
],
"from": "0x96f06471cb1653617b778841106e40594f8d2105",
"to": "0xa89fc45fd76a4f46a48fcd0058ab28a3b9da55d5",
"rawValue": 0,
"value": 0.0,
"timestamp": "2024-02-19T13:12:29"
}
}
Updated 3 months ago