Create price, decoded log, decoded call, raw call trace, token/pair event, and NFT event webhooks.
This endpoint is available on Defined Growth and Enterprise Plans
Endpoint: createWebhooks
Method: POST
Arguments
Name | Type | Description |
---|---|---|
input | CreateWebhooksInput! | Input for creating webhooks. Required |
Name | Type | Description |
---|---|---|
decodedCallWebhooksInput | CreateDecodedCallWebhooksInput | Input for creating decoded call webhooks. |
decodedLogWebhooksInput | CreateDecodedLogWebhooksInput | Input for creating decoded log webhooks. |
nftEventWebhooksInput | CreateNftEventWebhooksInput | Input for creating NFT event webhooks. |
priceWebhooksInput | CreatePriceWebhooksInput | Input for creating price webhooks. |
rawCallTraceWebhooksInput | CreateRawCallTraceWebhooksInput | Input for creating raw call trace webhooks. |
tokenPairEventWebhooksInput | CreateTokenPairEventWebhooksInput | Input for creating token pair event webhooks. |
Response
Name | Type | Description |
---|---|---|
decodedCallWebhooks | [Webhook]! | The list of decoded call webhooks that were created. |
decodedLogWebhooks | [Webhook]! | The list of decoded log webhooks that were created. |
nftEventWebhooks | [Webhook]! | The list of NFT event webhooks that were created. |
priceWebhooks | [Webhook]! | The list of price webhooks that were created. |
rawCallTraceWebhooks | [Webhook]! | The list of raw call trace webhooks that were created. |
tokenPairEventWebhooks | [Webhook]! | The list of token pair event webhooks that were created. |
Webhook Conditions
Each webhook type is triggered with a different set of conditions.
Fire when a token hits a specific USD price. Requires a token address
and networkId
and the priceUsd
to be greater than, less than or equal to.
Fire when a decoded call has a particular property value. Requires a decodingId
, and either methodName
or address
(address
is only applicable to ContractDecodings
where the contractAddress
field is set).
Use the getContractDecodings
endpoint (coming soon) to find decodingId
and more.
Fire when a decoded log has a particular property value. Requires a decodingId
, and either methodName
or address
(address
is only applicable to ContractDecodings
where the contractAddress
field is set).
Use the getContractDecodings
endpoint (coming soon) to find decodingId
and more.
Fire when any raw call trace occurs. All conditions are optional. Uses can pass networkId
to listen on a particular set of networks, result
to listen for a particular string in (or not in) the code
property, or traceType
to fire when a trace is created (for now, the only raw call trace type supported is create
).
Fire when any token pair event occurs. All conditions are optional. Users can specify which network, exchange, pair, token, event type, maker address or swap value to listen for.
Fire when any NFT event occurs. All conditions are optional. Users can specify which network, marketplace, fill source, collection, token, event type or maker address to listen for.
Stringified JSON
"{ "amount0": { "gt": "100000000" } }"
Example
Mutation
mutation CreateWebhooks {
createWebhooks(input: {
priceWebhooksInput: {
webhooks: [
{
alertRecurrence: INDEFINITE,
callbackUrl: "https://myserver.mydomain.com/my-webhook-handler",
name: "uniswap",
securityToken: "dasdsfds",
groupId: "test-group",
conditions: {
tokenAddress: {
eq: "0x5a98fcbea516cf06857215779fd812ca3bef1b32"
},
networkId: {
eq: 1
},
priceUsd: {
gt: "0"
}
}
}
]
}
decodedLogWebhooksInput: {
webhooks: [
{
alertRecurrence: ONCE,
callbackUrl: "https://myserver.mydomain.com/my-webhook-handler",
name: "uniswapv3 swap event",
securityToken: "dasdsfds",
groupId: "uniswap",
conditions: {
address: {
eq: "0x824a30f2984f9013f2c8d0a29c0a3cc5fd5c0673"
},
decodingId: {
eq: "uniswapv3:pool:1"
},
eventName: {
eq: "Swap"
},
event: "{ \"amount0\": { \"gt\": \"100000000\" } }"
}
}
]
}
decodedCallWebhooksInput: {
webhooks: [
{
alertRecurrence: ONCE,
callbackUrl: "https://myserver.mydomain.com/my-webhook-handler",
name: "uniswapv3 swap event greater than 100000000",
securityToken: "dasdsfds",
groupId: "uniswap",
conditions: {
decodingId: {
eq: "uniswapv3:pool:1"
},
methodName: {
eq: "mint"
},
input: "{ \"amount\": { \"gt\": \"100000000\" } }"
}
}
]
}
rawCallTraceWebhooksInput: {
webhooks: [
{
alertRecurrence: ONCE,
callbackUrl: "https://myserver.mydomain.com/my-webhook-handler",
name: "create events on eth",
securityToken: "dasdsfds",
groupId: "uniswap",
conditions: {
traceType: {
eq: create
},
result: {
code: {
contains: ["0xabc", "pb4ll2"],
notContains: ["123lll"]
}
},
networkId: {
oneOf: [1, 137]
}
}
}
]
}
}) {
priceWebhooks {
alertRecurrence
callbackUrl
created
id
name
webhookType
groupId
status
conditions {
... on PriceEventWebhookCondition {
__typename
networkId {
eq
}
priceUsd {
eq
gt
gte
lt
lte
}
tokenAddress {
eq
}
}
}
}
decodedLogWebhooks {
alertRecurrence
callbackUrl
conditions {
... on DecodedLogWebhookCondition {
event
address {
eq
}
decodingId {
eq
}
eventName {
eq
}
}
}
created
groupId
id
name
status
webhookType
}
decodedCallWebhooks {
webhookType
alertRecurrence
callbackUrl
conditions {
... on DecodedCallWebhookCondition {
input
output
address {
eq
}
decodingId {
eq
}
from {
eq
}
methodId {
eq
}
methodName {
eq
}
to {
eq
}
}
}
created
groupId
id
name
status
}
rawCallTraceWebhooks {
webhookType
status
name
id
groupId
created
conditions {
... on RawCallTraceWebhookCondition {
__typename
networkId {
oneOf
}
result {
code {
contains
notContains
}
}
traceType {
eq
}
}
}
callbackUrl
alertRecurrence
}
}
}
Response
{
"data": {
"createWebhooks": {
"priceWebhooks": [
{
"alertRecurrence": "INDEFINITE",
"callbackUrl": "https://myserver.mydomain.com/my-webhook-handler",
"created": 1676661647,
"id": "8f436b05-2894-4e21-ae40-5587bf3ec13b",
"name": "uniswap",
"webhookType": "PRICE_EVENT",
"groupId": "test-group",
"status": "ACTIVE",
"conditions": {
"__typename": "PriceEventWebhookCondition",
"networkId": {
"eq": 1
},
"priceUsd": {
"eq": null,
"gt": "0",
"gte": null,
"lt": null,
"lte": null
},
"tokenAddress": {
"eq": "0x5a98fcbea516cf06857215779fd812ca3bef1b32"
}
}
}
],
"decodedLogWebhooks": [
{
"alertRecurrence": "ONCE",
"callbackUrl": "https://myserver.mydomain.com/my-webhook-handler",
"conditions": {
"event": "{\"amount0\":{\"gt\":\"100000000\"}}",
"address": {
"eq": "0x824a30f2984f9013f2c8d0a29c0a3cc5fd5c0673"
},
"decodingId": {
"eq": "uniswapv3:pool:1"
},
"eventName": {
"eq": "Swap"
}
},
"created": 1676661647,
"groupId": "uniswap",
"id": "469923e6-feb5-43c6-a6b9-519f55502700",
"name": "uniswapv3 swap event",
"status": "ACTIVE",
"webhookType": "DECODED_LOG"
}
],
"decodedCallWebhooks": [
{
"webhookType": "DECODED_CALL",
"alertRecurrence": "ONCE",
"callbackUrl": "https://myserver.mydomain.com/my-webhook-handler",
"conditions": {
"input": "{\"amount\":{\"gt\":\"100000000\"}}",
"output": null,
"address": null,
"decodingId": {
"eq": "uniswapv3:pool:1"
},
"from": null,
"methodId": null,
"methodName": {
"eq": "mint"
},
"to": null
},
"created": 1676661647,
"groupId": "uniswap",
"id": "6cec73dc-42d9-4769-9eb2-6d32bbf8dd33",
"name": "uniswapv3 swap event greater than 100000000",
"status": "ACTIVE"
}
]
"rawCallTraceWebhooks": [
{
"webhookType": "RAW_CALL_TRACE",
"status": "ACTIVE",
"name": "create events on eth",
"id": "059e5e93-f0a9-459a-907e-bd587c186f05",
"groupId": "uniswap",
"created": 1678207388,
"conditions": {
"__typename": "RawCallTraceWebhookCondition",
"networkId": {
"oneOf": [
1
]
},
"result": null,
"traceType": {
"eq": "create"
}
},
"callbackUrl": "https://myserver.mydomain.com/my-webhook-handler",
"alertRecurrence": "ONCE"
}
]
}
}
}
Ask questions, share what you're working on and request new features