API Reference

Webhook object

ThirdFi sends webhook payload in JSON format. You have to parse it into a readable object.

Below is the list of the events when ThirdFi sends the webhook:

Decentralised Exchange Swap (DeX Swap)

Webhook Event CodeDescription
dex.approvalThe allowance approval transaction is executed by the blockchain network.
dex.swapThe token swap transaction is executed by the blockchain network.
dex.addLiquidityThe add Liquidity transaction is executed by the blockchain network.

Sample JSON payload data (dex.approval)

{
  "publicSessionId": "VTJGc2RHVmtYMThwanh1VUM5WWFEWmxqQjl5Nm1KU0F1a28rM254OFZ3Syt2b0pjZzFnbzJZWHdiL1c5Wml6eQ==",
  "orderId": "9247-092917-6892",
  "data": {
    "token": "0xBF1d14a1A5aC7A3d556F1161Ce972A1Caf0301F3",
    "spender": "0xb3756Cb11935921aE368654E4bd0E9ccCA3308C3",
    "owner": "0x99a002090f3c393e1a6dbd9c9c36db3d2fa0caf7",
    "amount": "200.0",
    "event": {
      "transactionIndex": 4,
      "blockNumber": 35087731,
      "transactionHash": "0x4c07ea24823322639e4f403103c24e9d8ff1929e7fd91a1ef3213a3b912567aa",
      "address": "0xBF1d14a1A5aC7A3d556F1161Ce972A1Caf0301F3",
      "topics": [
        "0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925",
        "0x00000000000000000000000099a002090f3c393e1a6dbd9c9c36db3d2fa0caf7",
        "0x000000000000000000000000477b15afa64ba3ae52426215ab8407d176344719"
      ],
      "data": "0x000000000000000000000000000000000000000000000000000000000bebc200",
      "logIndex": 14,
      "blockHash": "0x6b2d5bf068f4dbf41b1ac05eb196c8d4ae56cc10a75ff142dc10f4c740ad2bf6"
    },
    "status": 1,
    "eventType": "dex.approval"
  },
  "eventType": "dex.approval"
}

Sample JSON payload data (dex.swap)

{
  "publicSessionId": "VTJGc2RHVmtYMS9MbW1oSnhkU2dWek93Z1NCdkdQQVlUNkhLVFZNQzdoUGlZZGpZYVlCem9SSjBHQ2hlYVIrZA==",
  "orderId": "9247-090945-2547",
  "data": {
    "sender": "0xb3756Cb11935921aE368654E4bd0E9ccCA3308C3",
    "to": "0x64F53914013ADcE581B2EA9f8E335D50996646b6",
    "amount0In": "10000000",
    "amount1In": "0",
    "amount0Out": "0",
    "amount1Out": "47101",
    "event": {
      "transactionIndex": 3,
      "blockNumber": 35084884,
      "transactionHash": "0x14004c18a47d84d1ab2ab15b9b1ff33a90b3b045b57217ee0e2c9857ee3ddabf",
      "address": "0x579C0Cf5F3bfC40E50E7cbD27aFD4e387713eFE6",
      "topics": [
        "0xd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d822",
        "0x000000000000000000000000b3756cb11935921ae368654e4bd0e9ccca3308c3",
        "0x00000000000000000000000064f53914013adce581b2ea9f8e335d50996646b6"
      ],
      "data": "0x000000000000000000000000000000000000000000000000000000000098968000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b7fd",
      "logIndex": 10,
      "blockHash": "0x55419a146640433e061dcd65b51431549362b8a6679a357d0777b7bedd3e4ad5"
    },
    "status": 1,
    "eventType": "dex.swap"
  },
  "eventType": "dex.swap"
}

Sample JSON payload data (dex.addLiquidity)

{
  "publicSessionId": "VTJGc2RHVmtYMThsOG5KOWVBWHpwaDNRaGlMZzhZL05scUF6aGZZK2RObk9HWHpOWnFNZEg3WHFiREloVnZvNA==",
  "orderId": "9241-545097-8937",
  "data": {
    "sender": "0xb3756Cb11935921aE368654E4bd0E9ccCA3308C3",
    "amount0": "2116",
    "amount1": "10",
    "event": {
      "transactionIndex": 1,
      "blockNumber": 34837310,
      "transactionHash": "0xe51558f89a10daed1a3a2ecc028fafb94fe9119a6251a47971900b514e0b1de4",
      "address": "0x579C0Cf5F3bfC40E50E7cbD27aFD4e387713eFE6",
      "topics": [
        "0x4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f",
        "0x000000000000000000000000b3756cb11935921ae368654e4bd0e9ccca3308c3"
      ],
      "data": "0x0000000000000000000000000000000000000000000000000000000000000844000000000000000000000000000000000000000000000000000000000000000a",
      "logIndex": 11,
      "blockHash": "0xc83ff92d66e4098179d88b9560b2d80a3bebb2adce26fb3ba2f8cd218b3ee999"
    },
    "status": 1,
    "eventType": "dex.addLiquidity"
  },
  "eventType": "dex.addLiquidity"
}

Borrowing and Lending

Webhook Event CodeDescription
approvalThe allowance approval transaction is executed by the blockchain network.
aave.supplyThis event is produced when Lending is done with/without borrowing assets from the Aave Protocol.
aave.borrowAllowanceDelegatedThis event is produced when borrowing assets from the Aave Protocol.
aave.repayThis event is produced when a user repays the debt to the Protocol.
aave.swapBorrowRateModeThis event is produced when a user swaps borrowed assets between variable to fixed mode.

Sample JSON payload data (approval)

{
  "publicSessionId": "VTJGc2RHVmtYMS9xaGJ3dVhncGNucjIzUzNiTllTVE0zOTF4ZDFYdVd6eG00VksxRWloYTBMeWxnaGQzTnQ0Sg==",
  "orderId": "9247-993427-3586",
  "data": {
    "token": "0xe9DcE89B076BA6107Bb64EF30678efec11939234",
    "spender": "0x6069864d8B9f0c08250366F6c37ae28299aA107D",
    "amount": "115792089237316195423570985008687907853269984665640564039457584007913129639935",
    "walletAddress": "0x7DC2E9dD9167526A9403b8D01a4B69E3d89C5476"
  },
  "eventType": "approval"
}

Sample JSON payload data (Lending and Borrow Assets)

{
  "publicSessionId": "VTJGc2RHVmtYMThmNGlWNzNQUXZqeGt0RmwvTDNDTVYwanVhYTl4NXluRE00UHhxZUZtc25yNG43OERvZFhaTQ==",
  "orderId": "9241-968374-8834",
  "data": {
    "version": 3,
    "chainId": 80001,
    "supplyAsset": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
    "supplyAmount": 0.1,
    "borrowAsset": "0xe9DcE89B076BA6107Bb64EF30678efec11939234",
    "borrowAmount": 0.1,
    "borrowInterestRateMode": 2,
    "walletAddress": "0x64F53914013ADcE581B2EA9f8E335D50996646b6",
    "supplyValueInUSD": "0.14",
    "borrowValueInUSD": "0.1"
  },
  "eventType": "aave.supply"
}

Sample JSON payload data (Supply Asset - Lending)

{
  "publicSessionId": "VTJGc2RHVmtYMThRcjFmaUJ5ZEVQV0llRVVQZkh5aW8xMFVtY2xOUmQvQlFvdWI1SUQwUTVsbVpBSnBtbGVsTg==",
  "orderId": "9241-962109-8694",
  "data": {
    "version": 3,
    "chainId": 80001,
    "asset": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
    "amount": 0.000001,
    "walletAddress": "0x64F53914013ADcE581B2EA9f8E335D50996646b6",
    "supplyValueInUSD": "0.0000014"
  },
  "eventType": "aave.supply"
}

Sample JSON payload data (Borrow Asset from Collateral)

{
  "publicSessionId": "VTJGc2RHVmtYMTl2YUNjRkh1VjNqcTVRTzVxR2lNQWRpcGczdWVpdWZlSnhhUk1SdjZDNHNwYXpaKys3Z0FDTg==",
  "orderId": "9241-945375-5066",
  "data": {
    "version": 3,
    "chainId": 43113,
    "asset": "0x6a17716Ce178e84835cfA73AbdB71cb455032456",
    "amount": 10,
    "interestRateMode": 1,
    "walletAddress": "0x64F53914013ADcE581B2EA9f8E335D50996646b6"
  },
  "eventType": "aave.borrowAllowanceDelegated"
}

Sample JSON payload data (Repay Debt)

{
  "publicSessionId": "VTJGc2RHVmtYMS9Sd3kwYm1USTcyRXdZdTFENzdFOFkwVzRkN0JDOGtNV0ZGTDVRNUloK2FDbEcrY2xBeU1Ecw==",
  "orderId": "9241-948713-3172",
  "data": {
    "version": 3,
    "chainId": 43113,
    "asset": "0x6a17716Ce178e84835cfA73AbdB71cb455032456",
    "amount": 2,
    "interestRateMode": 1,
    "debtTokenAddress": "0x6982F4511E411D3Aaf11070D578c04F95CBa2839",
    "walletAddress": "0x64F53914013ADcE581B2EA9f8E335D50996646b6",
    "estimatedAmountToRepay": "2",
    "repayValueInUSD": "2"
  },
  "eventType": "aave.repay"
}

Sample JSON payload data (Repay Debt and Withdraw Collateral)

{
  "publicSessionId": "VTJGc2RHVmtYMStvSDR0TU45VmRmaXJ4UTlOMGRHQWFOUjB2NXVHVEtRUDdCb1J6SzhHVGl1S2xPUEI5cXlBVA==",
  "orderId": "9241-948866-9705",
  "data": {
    "version": 3,
    "chainId": 43113,
    "repayAsset": "0x6a17716Ce178e84835cfA73AbdB71cb455032456",
    "repayAmount": 5,
    "repayInterestRateMode": 1,
    "repayDebtTokenAddress": "0x6982F4511E411D3Aaf11070D578c04F95CBa2839",
    "withdrawalAsset": "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
    "withdrawalAmount": 0.2,
    "walletAddress": "0x64F53914013ADcE581B2EA9f8E335D50996646b6",
    "estimatedAmountToRepay": "5",
    "estimatedAmountToWithdraw": "0.2",
    "repayValueInUSD": "5",
    "withdrawalValueInUSD": "17.318"
  },
  "eventType": "aave.repay"
}

Sample JSON payload data (Swap Borrow Rate Mode)

{
  "publicSessionId": "VTJGc2RHVmtYMTlWMDFuck1rUEhGU09CR1FJVlZFakNwNVA2c2V1dkJoNTNYdG5YcjRpSlJoOG1tcXR4UWtnWA==",
  "orderId": "9241-942768-8192",
  "data": {
    "version": 3,
    "chainId": 43113,
    "asset": "0x6a17716Ce178e84835cfA73AbdB71cb455032456",
    "rateMode": 2,
    "walletAddress": "0x64F53914013ADcE581B2EA9f8E335D50996646b6"
  },
  "eventType": "aave.swapBorrowRateMode"
}

Investment for Index Funds

Webhook Event CodeDescription
approvalThe allowance approval transaction is executed by the blockchain network.
depositThe deposit transaction is executed by the blockchain network.
withdrawThe withdrawal transaction is executed by the blockchain network.

Sample JSON payload data (approval)

{
  "publicSessionId": "VTJGc2RHVmtYMThDbXkzRm8rWHdPMnVyN3RlbVVQc241Q1AzOGxlNElrZURCTHpMRTRlRXIzbTQrd0luMDVVdg==",
  "orderId": "9247-428795-8866",
  "data": {
    "token": "0x1F326a8CA5399418a76eA0efa0403Cbb00790C67",
    "spender": "0x69380cc2169046f8a3b2c03d58fe206475aae3cb",
    "owner": "0x7709b3f9ee9ed2af680776f2c72a77a7a5ff2b96",
    "amount": "200.0",
    "event": {
      "transactionIndex": 3,
      "blockNumber": 29724224,
      "transactionHash": "0xb9b5f4e730a32f30a2bbc6faa4686f16b8f752d915b1c280cc836767eb3ceedc",
      "address": "0x1F326a8CA5399418a76eA0efa0403Cbb00790C67",
      "topics": [
        "0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925",
        "0x0000000000000000000000007709b3f9ee9ed2af680776f2c72a77a7a5ff2b96",
        "0x00000000000000000000000069380cc2169046f8a3b2c03d58fe206475aae3cb"
      ],
      "data": "0x00000000000000000000000000000000000000000000000ad78ebc5ac6200000",
      "logIndex": 19,
      "blockHash": "0x7c1f78023c9b2f7b7eb5d0a625ce4406ce07bb09c6668e7552e0983e99f829a0"
    },
    "status": 1,
    "eventType": "approval"
  },
  "eventType": "approval"
}

Sample JSON payload data (deposit)

{
  "publicSessionId": "VTJGc2RHVmtYMSsrZHA3Qk9Uanl6TWxXdFBxMTdEY3h6dmNta2hhWXIwenJoa3JaQkNpbWMrcGViS1hQVUhtMQ==",
  "orderId": "9247-006570-2867",
  "data": {
    "token": "BSC.LCI",
    "sender": "0x64f53914013adce581b2ea9f8e335d50996646b6",
    "stableTokenAddress": "0x1F326a8CA5399418a76eA0efa0403Cbb00790C67",
    "amount": "0.1",
    "shares": "0.099999999999999994",
    "event": {
      "transactionIndex": 7,
      "blockNumber": 29438515,
      "transactionHash": "0xaf881cc9e2cfe8e96fc2e8ad726f094ceab0e9ef3ecb5d78ffededafb7cfe5f0",
      "address": "0x1F326a8CA5399418a76eA0efa0403Cbb00790C67",
      "topics": [
        "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
        "0x00000000000000000000000064f53914013adce581b2ea9f8e335d50996646b6",
        "0x00000000000000000000000069380cc2169046f8a3b2c03d58fe206475aae3cb"
      ],
      "data": "0x000000000000000000000000000000000000000000000000016345785d8a0000",
      "logIndex": 6,
      "blockHash": "0x200bab280a6e7846304dc4c93f1c0aa7345902a416791d76aacbe9f3c0c19005"
    },
    "status": 1,
    "eventType": "deposit"
  },
  "eventType": "deposit"
}

Sample JSON payload data (withdraw)

{
  "publicSessionId": "VTJGc2RHVmtYMStlcnpHcjBjQnJIQjBIWU1rOTNKcEJkcTNJNXZRVEQ5VmVJWDd3ckJaLzBnTlBoOENOM05Ybg==",
  "orderId": "9247-004155-0801",
  "data": {
    "token": "BSC.LCI",
    "sender": "0xab81d2f209e2d6e0959ff0d457996c447fa4f3b4",
    "stableTokenAddress": "0x1F326a8CA5399418a76eA0efa0403Cbb00790C67",
    "amount": "0.049999999999997823",
    "shares": "0.05",
    "event": {
      "transactionIndex": 9,
      "blockNumber": 29438776,
      "transactionHash": "0x08bbb0f3a1c6ee2540a4e0fe74ef3ea5db8a7eb720ca6d263b496fc84d5fa160",
      "address": "0x1F326a8CA5399418a76eA0efa0403Cbb00790C67",
      "topics": [
        "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
        "0x000000000000000000000000ab81d2f209e2d6e0959ff0d457996c447fa4f3b4",
        "0x00000000000000000000000069380cc2169046f8a3b2c03d58fe206475aae3cb"
      ],
      "data": "0x00000000000000000000000000000000000000000000000000b1a2bc2ec4f77f",
      "logIndex": 9,
      "blockHash": "0x2ab51800d2425693b60c90f6c8827b26cca7d12d32c4a52c94f70b02b0ef1b1c"
    },
    "status": 1,
    "eventType": "withdraw"
  },
  "eventType": "withdraw"
}

Fiat-to-Crypto

Webhook Event CodeDescriptionStatus Code
payment.topupThe purchase order transaction is executed successfully.success
payment.topupThe purchase order transaction is failed to executed.failed
payment.topupThe purchase order transaction is processing. There are different *orderStatus* in the event data to indicate the process stage of the order.pending

Sample JSON payload data (payment.topup)

{
  type: 'payment.topup',
  data: {
    invoiceId: '0225-968059-1010',
    totalFees: 7.81,
    cryptoCurrency: 'USDT',
    fiatCurrency: 'MYR',
    paymentMethod: 'credit_debit_card',
    paymentStatus: 'success',
    orderStatus: 'COMPLETED',
    isBuyOrSell: 'Buy',
    tax: 0,
    blockchainNetwork: 'ethereum',
    exchangeRate: 0.2104691449501919,
    fiatAmount: 142,
    cryptoAmount: 28.24,
    expiredDate: '2022-11-01T09:22:53.000Z',
    createdAt: '1667208172520',
    createdDate: '2022-10-31T09:22:52.525Z',
    paymentProvider: 'Transak',
    walletAddress: '0x69380cc2169046f8A3B2c03D58Fe206475aAe3CB',
    user: {
      emailAddress: '[email protected]',
      firstName: '[email protected]',
      lastName: null,
      mobileNumber: null,
      dateOfBirth: null,
      street: null,
      city: null,
      state: null,
      country: null,
      postalCode: null
    }
  }
}