How to use DeFi Alerts webhooks?

How to use DeFi Alerts webhooks?

HTTP Webhooks allow you to receive DeFi Alerts as soon as they happen. Instead of polling the API  constantly, you can receive the alerts directly on your server as soon as they happen. There are a few requirements to work with HTTP Webhooks on Xypher.


Xypher requirements

  1. Xypher Pro++ Subscription
  1. A HTTP Webhook delivery endpoint
  1. Configure every address you wish to receive alerts from on the DeFi Alerts page

Server Requirements:

  1. Your server should accept connections from our backend IP addresses. You can find a list of our addresses here.
  1. Your server must be properly configured to answer our POST requests with a 200 status code. Failure to do so will deactivate your endpoint on our backend after 3 failed retries.
  1. A basic request from Xypher looks like this

[
{
"protocol": "curve", // str() protocol in lowercase
"internal_id": "Curve_TokenExchange_0x8b3e96", // str() internal id we use to identify events
"level": 1, // int() level filtering (check docs for level filtering)
"hash": "0x4297bd2523853cdaf79d16a02e1be56237eda58034137eaa9ab5f1d3e02d2a03", // str() hash where the event was found
    "sender": "0x0000000000000000000000000000000000000000",  // str() address who initiated the transaction
"receiver": "0x0000000000000000000000000000000000000000, // str() address who received the transaction
"network": "Ethereum", // str() EVM network
"tokens": [ // a list of every token found in the event,
{
"address": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
"name": "Wrapped Ether",
"symbol": "WETH",
"decimals": 18,
"id": "token0" // unique identifier (for this event only)
},
{
"address": "0xb26C4B3Ca601136Daf98593feAeff9E0CA702a8D",
"name": "Aladdin Token",
"symbol": "ALD",
"decimals": 18,
"id": "token1" // unique identifier (for this event only)
}
],
"amounts": [ // important amounts found in the event // human: str() amount in human-readable format. We output this to alerts // raw: int() raw amount. Can be used with their respective ID from the tokens list // id: str() unique identifier (for this event only)
{
"human": "2.00",
"raw": 2000000000000000000,
"id": "token0_amount"
},
{
"human": "53.89 K",
"raw": 5.388544565048564574574e+22,
"id": "token1_amount"
}
],
"addresses": { // list of addresses found in the event. Every msg is from the point of view of the address // address: str() checksummed ethereum address // id: str() unique identifier (for this type of event only) // filter: str() correlates the amounts list to a message
"0x58BD13974D76FCEc0F7d7C31f725CeD41c9C4287": {
"id": "sender",
"msg": "Trade 2.00 WETH for 53.89 K ALD on Curve"
},
"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2": {
"id": "token0",
"msg": "0x58BD13 traded 2.00 WETH for 53.89 K ALD on Curve",
"filter": "token0_amount"
},
"0xb26C4B3Ca601136Daf98593feAeff9E0CA702a8D": {
"id": "token1",
"msg": "0x58BD13 traded 2.00 WETH for 53.89 K ALD on Curve",
"filter": "token1_amount"
},
"0xBDFAe7D2cF2E69E27b75a5287ECD3808F62B5a76": {
"id": "pool",
"msg": "0x58BD13 traded 2.00 WETH for 53.89 K ALD on Curve"
}
}
}
]


A notification might include more than one event in a single notification. For example: