Triggers

A few examples of get-triggers queries

Get all triggers

The following fields can be queried to retrieve all triggers data:

query {
  allTriggers {
    UUID
    name
    isActive
    createdAt
    updatedAt
    type
    matchesCount
    ... on EventsTrigger {
      statement {
        contract {
          address
          abi
        }
        filters {
          method {
            name
          }
          type
          parameter
          condition {
            predicate
            attribute
            unit
          }
        }
      }
    }
    ... on TransactionsTrigger {
      statement {
        contract {
          address
          abi
        }
        filters {
          type
          method {
            name
          }
          parameter
          condition {
            predicate
            attribute
            unit
          }
        }
      }
    }
    ... on ContractsTrigger {
      statement {
        contract {
          address
          abi
        }
        method {
          name
        }
        inputs
        outputFilters {
          returnIndex
          condition {
            predicate
            attribute
            unit
          }
          parameter
        }
      }
    }
    actions {
      ... on EmailAction {
        type
        attributes {
          to
          subject
          body
        }
      }
      ... on WebhookAction {
        type
        attributes {
          uri
        }
      }
    }
  }
}

We also support specific trigger-type queries, if you if you are only interested in a specific trigger type.

Get events triggers

query {
  eventsTriggers {
    UUID
    name
    isActive
    createdAt
    updatedAt
    type
    matchesCount
    statement {
      contract {
        address
        abi
      }
      filters {
        type
        method {
          name
        }
        parameter
        condition {
          predicate
          attribute
          unit
        }
      }
    }
    actions {
      ... on EmailAction {
        type
        attributes {
          to
          subject
          body
        }
      }
      ... on WebhookAction {
        type
        attributes {
          uri
        }
      }
    }
  }
}

Get contracts triggers

query {
  contractsTriggers {
    UUID
    name
    isActive
    createdAt
    updatedAt
    type
    matchesCount
    statement {
      contract {
        address
        abi
      }
      method {
        name
      }
      inputs
      outputFilters {
        returnIndex
        condition {
          predicate
          attribute
          unit
        }
        parameter
      }
    }
    actions {
      ... on EmailAction {
        type
        attributes {
          to
          subject
          body
        }
      }
      ... on WebhookAction {
        type
        attributes {
          uri
        }
      }
    }
  }
}

Get transactions triggers

query {
  transactionsTriggers {
    UUID
    name
    isActive
    createdAt
    updatedAt
    type
    matchesCount
    statement {
      contract {
        address
        abi
      }
      filters {
        type
        method {
          name
        }
        parameter
        condition {
          predicate
          attribute
          unit
        }
      }
    }
    actions {
      ... on EmailAction {
        type
        attributes {
          to
          subject
          body
        }
      }
      ... on WebhookAction {
        type
        attributes {
          uri
        }
      }
    }
  }
}

Query a single trigger

Using filters you can retrieve a single trigger by UUID or by name.

query {
  allTriggers(filter: {UUID: {eq: "8a30c4e8-e6cf-444b-863e-cf786c7f1a2b"]}}) {
    UUID
  }
}

Please refer to the filtering record section of this guide for details on how to use the filter argument.

Last updated