Create Webhooks

Create price, decoded log, decoded call, raw call trace, token/pair event, and NFT event webhooks.

ℹ️

This endpoint is available on Codex Growth and Enterprise Plans

Endpoint: createWebhooks

Method: POST

Arguments

NameTypeDescription
inputCreateWebhooksInput!Input for creating webhooks.
Required

NameTypeDescription
nftEventWebhooksInputCreateNftEventWebhooksInputInput for creating NFT event webhooks.
priceWebhooksInputCreatePriceWebhooksInputInput for creating price webhooks.
tokenPairEventWebhooksInputCreateTokenPairEventWebhooksInputInput for creating token pair event webhooks.

Response

NameTypeDescription
nftEventWebhooks[Webhook]!

The list of NFT event webhooks that were created.

priceWebhooks[Webhook]!

The list of price 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 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"
                      }
                  }
              }
          ]
      }
  }) {
    priceWebhooks {
      alertRecurrence
      callbackUrl
      created
      id
      name
      webhookType
      groupId
      status
      conditions {
        ... on PriceEventWebhookCondition {
          __typename
          networkId {
            eq
          }
          priceUsd {
            eq
            gt
            gte
            lt
            lte
          }
          tokenAddress {
            eq
          }
        }
      }
    }
  }
}

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"
                        }
                    }
                }
            ]
        }
    }
}

👋

Join our Discord

Ask questions, share what you're working on and request new features 👬👭