Skip to main content
This guide presents the three core concepts of Web3 Actions: triggers, events, and functions. You’ll learn how they work and how to use them to build your own Web3 Actions. The three core components that make up a Web3 Action are:
  • Functions: Custom JavaScript or TypeScript code you want to execute when an external event occurs. This is the core of your automation.
  • Triggers: Pre-defined external events that your Web3 Action is configured to listen for. When the event occurs, the trigger instructs Tenderly to execute your custom code (function).
  • Events (Trigger Types): Pre-defined external events that you can listen for by setting a trigger. When the event occurs, the trigger will call your custom code (functions).

Execution Types

Web3 Actions in Tenderly can be executed in two modes: Sequential and Parallel.
execution_type only applies to block and transaction triggers. Periodic and webhook triggers always run in parallel, and any execution_type set on them is ignored.
Web3 Action Execution Type step in the Web3 Action UI Builder

Web3 Action Execution Type step in the Web3 Action UI Builder

Sequential Execution

In sequential execution, actions are executed one by one in the order they were invoked. This is the default mode of execution. In this mode, each action waits for the previous action to complete before it begins execution. Here’s an example of an action configuration for a sequential execution:
example

Parallel Execution

In parallel execution, actions are executed in parallel, which leads to higher throughput. In this mode, the order of execution is not guaranteed and there may be possible race conditions with action storage. Here’s an example of an action configuration for a parallel execution:
example

Action functions

Web3 Action functions refer to the custom code written as standard JavaScript or TypeScript functions, but they must adhere to some rules.
  • Functions must be asynchronous, returning Promise<void>
  • Functions accept two parameters: context and event
  • Functions must be a named export from the file
  • Functions can be placed in any file under the actions root directory
Learn about the Web3 Actions project and file structure. When a Web3 Action function is deployed, the Tenderly runtime will pass the following arguments during invocation:
  • The context parameter that holds access to Storage and Secrets.
  • The event parameter that is an object with information answering the question “what just happened?”. This parameter contains data specific to the trigger type the Web3 Action function is listening for. The section Specifying triggers for external events goes into detail about external events.
The execution of Web3 Action functions is limited to 30 seconds. If your function takes longer than 30 seconds to execute, it will be terminated.
Here’s an example of a Web3 Action function written in TypeScript. The event parameter can be any one of the supported trigger types (events).
example.ts

Available libraries for dashboard-based actions

The Tenderly runtime comes pre-bundled with several javascript libraries that you can import when creating Web3 Actions via the Tenderly Dashboard. Available libraries include: To import any of these libraries, use the require() function as you would with a standard npm-based project (without ES6). Example import for Axios looks like this:
example.jsx

Using npm libraries for CLI-based Web3 Actions

The project created by Tenderly CLI is in fact an npm module. You can install any npm package from your actions root folder.

External events and trigger types

When an external event happens, it triggers the execution of your custom code (functions). You can choose between four external events to listen for:
  • Block event: A block is mined on a selected network.
  • Periodic event: This trigger happens when certain time intervals pass or based on CRON expressions.
  • Webhook event: An HTTP request is posted to the webhook URL (the Web3 Action exposes a webhook)
  • Transaction event: A transaction matching given filter criteria is executed on a selected network.
When defining a Web3 Action, you’ll be effectively defining triggers that react to external events of interest for your project. In the context of trigger specification, we’ll be using the term trigger type.
You should write separate functions for each trigger type. Using the same function for different trigger types is not recommended.

Subscribing Web3 Action functions to events

In addition to defining your action function in JavaScript, you also need to provide the trigger configuration, which tells Tenderly what triggers it, the external event your function subscribes to. When creating Web3 Actions via the Tenderly Dashboard, the creation flow in the UI will handle this part for you. Read the Dashboard Quickstart guide. When working with code-based Web3 Actions, functions and their triggers must be defined in the tenderly.yaml file, which is generated by Tenderly CLI. Read the CLI Quickstart guide. Example In the example below, we’re declaring a Web3 Action called bestActionEver and referencing the function awesomeActionFunction that is exported from the actions/myCoolTsFile.ts file. This is the function that Tenderly will call when the Web3 Action gets triggered. The execution is controlled via execution_type, in this case it’s set to parallel.
tenderly.yaml

Specifying triggers for external events

In this section, we’ll examine the trigger declaration. For more information on writing tenderly.yaml file, reference this guide. The trigger type and corresponding configurations are defined in the tenderly.yaml file. You first must define the trigger object, which has two mandatory properties:
  • The type property, that specifies the trigger type, which can be: periodic | webhook | block | transaction
  • An object with a configuration specific to the selected trigger type
Below is a detailed explanation of the trigger-specific configurations for each trigger type.

Periodic event

A periodic event is used when you want your Web3 Action to be triggered at specific time intervals. It carries time: the time of invocation.
example.ts
The trigger declaration has the periodic type. It can be interval- or cron-based:
trigger.yaml
The interval property can take any of the following values: 5m | 10m | 15m | 30m | 1h | 3h | 6h | 12h | 1d Use the CRON-based periodic trigger if you need more granular control over when your Web3 Action gets executed:
trigger.yaml
The cron property can be any valid CRON string.

Webhook event

Webhook-based Web3 Actions expose a custom webhook URL, making it possible to trigger them from external systems using a simple HTTP POST request. The corresponding trigger type holds two properties: the time of invocation and any payload (a JSON object). Tenderly doesn’t perform any validation or inspections on your payload.
example.ts
A trigger configuration example:
webhook-trigger.yaml
If authenticated is set to true, you must include the Tenderly Access Token with your request to be able to run the Web3 Action as the value of x-access-key. You can find the cURL of the exposed webhook in the Web3 Action overview in the Tenderly Dashboard.
example

Block event

The block event is used when you want to listen for the mining of blocks on one or several networks. You can make your Web3 Action “block-periodic” by specifying the number of mined blocks between two consecutive invocations.
example.ts
When declaring the block trigger, you can specify the following properties:
  • network: a single value or a list of network IDs you’re interested in
  • blocks: the number of mined blocks between two consecutive executions of the Web3 Action. For example, execute the Web3 Action on every 100th block mined.
block-trigger.yaml

Transaction event

The transaction trigger type allows you to listen for specific transactions as they get executed on-chain.
To listen for transactions from a smart contract, the smart contract must be verified and added to your project in the Tenderly Dashboard. The CLI will throw a warning if this is not the case.
You can specify different conditions in the form of filters to zero in on transactions of interest. Your custom code will be invoked with that exact transaction payload passed through the event parameter.
example.ts
When listening for transaction events, you can also specify the following settings:
  • Transaction mining status: mined (the transaction has been mined) or confirmed10 (10 blocks are confirmed since the block that contains the transaction)
  • Filters: A list of conditions involving transaction payload using the filters list. Only transactions that match filters will trigger the execution of your code.

Filtering transactions

The filters list allows you to define triggering criteria using transaction properties to match specific transactions. Each filter in the list is an object where all fields are AND-ed together. Every condition in the filter must be true for it to match. The filters list itself is OR-ed: a transaction matches if it satisfies any single filter in the list.
Below is a list of all available filters you can combine to build criteria for transactions that will trigger the execution of your Web3 Action.
A trigger must contain network and at least one of the following filters: from, to, function, eventEmitted, logEmitted, ethBalance, or stateChanged
An example of a transaction on Ethereum mainnet or Base sent to 0x236..fd62.
transaction-trigger.yaml
In this case, we’re interested only in transactions that are mined, matching either of these two filters:
  • Filter 1: network 1 (Ethereum) AND status fail AND to 0x2364...fd62
  • Filter 2: network 8453 (Base) AND status fail AND to 0x2364...fd62
Since we didn’t filter by any particular sender, all transactions coming to the mentioned recipient will result in the Web3 Action being triggered.

Filtering transactions by transaction fields

Among the common transaction fields, you can filter by the following properties having specific values.
  • from - filtering on a specific sender. Can be a single address or a list of addresses (OR-ed). Optional.
  • to - filtering on a specific receiver. Can be a single address or a list of addresses (OR-ed). Optional.
  • status - filtering on transaction status: success or fail. Can be a single value or a list (OR-ed). Optional.
  • network - filtering by network. Can be a single chain ID or a list of chain IDs (OR-ed). Mandatory.
  • contract.address - filtering only transactions involving the contract with this specific address. Optional.
All address fields must be 0x-prefixed, 40 hex characters (e.g. 0xf63c48626f874bf5604D3Ba9f4A85d5cE58f8019).
list-fields.yaml
You can also query numerics related to exchanged value and gas, using relational operators. All of the following are in wei:
  • value
  • gasUsed
  • gasLimit
  • fee
Numeric fields accept either a single comparison object or a list of comparison objects. When a list is provided, comparisons are OR-ed. Within a single comparison object, all operators are AND-ed. You can use any of the common comparison operators: eq, gte, gt, lt, lte. You can also use the not boolean flag to negate a comparison.
Below is an example of a filter demonstrating filters using scalar values in the transaction payload.
numeric-filters.yaml
Using the not flag to negate a comparison:
negated-comparison.yaml

Filtering transactions using emitted EVM Events

Configuring Web3 Actions to listen for EVM events emitted by a transaction execution allows you to respond to significant changes logged by these events. You can achieve this by using the eventEmitted operator, which supports the following nested properties:
  • contract (mandatory): To specify the origin of the event.
    • contract.address: The address of the contract that emitted the event.
    • contract.invocation: Controls how the contract was called: direct, internal, or any (default). See contract filter for details.
  • name: The name of the event (requires a verified contract).
  • id: The topic hash of the event signature (alternative to name). Useful for unverified contracts where the ABI is not available. For example, the Transfer(address,address,uint256) event has the topic hash 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef.
  • not: Boolean. Set to true to negate the entire event match, including parameters (trigger when the event is not emitted with the specified parameters).
  • parameters: A list of conditions on decoded event argument values. All conditions are AND-ed: every condition must match. Each entry supports:
    • name (required): The name of the event argument.
    • string: String comparison. Accepts a plain string for exact match, or an object with exact and not fields. See StringComparison for details.
    • int: Integer comparison. Supports the same operators as numeric filters (eq, gt, gte, lt, lte). All operators within a single int block are AND-ed. Use the not flag to negate the combined condition. See IntComparison for details.
There is no OR within a single eventEmitted entry’s parameters. All conditions are AND-ed. For OR logic on the same parameter, use multiple eventEmitted entries (which are OR-ed in the outer list).
To use the eventEmitted filter with name or parameters, the contract must be verified and added to the project in the Tenderly Dashboard. Use id (topic hash) for unverified contracts.
For the complete field reference, see EventFilter. Below is an example of a Web3 Action that will be invoked when either TxSubmission or TxConfirmation event is emitted when the smart contract is executed at the address 0x418d..9d45 on Sepolia.
event-emitted-filter.yaml
Here is an example filtering by decoded event parameters. All parameter conditions are AND-ed:
event-parameters.yaml
Numeric range with negation on parameters:
negated-parameter.yaml
For OR logic on parameters, use multiple eventEmitted entries:
event-parameter-or.yaml
Using not on the event itself to negate the entire match:
negated-event.yaml

Filtering transactions by emitted logs

Another way to listen for EVM events is to query them by the log topic. The logEmitted filter can be a single object or a list (entries are OR-ed). It supports the following properties:
  • startsWith (mandatory): A list of topic values to match against the transaction’s log topics. Each entry is compared by exact equality (case-insensitive) to the corresponding topic. In practice these are full 32-byte topic hashes (0x-prefixed, 64 hex chars), but the field accepts any valid hex string.
  • contract.address (optional): The source of the logs. When specified, only logs from this contract are matched.
  • matchAny: Boolean. When true, matching any single topic from startsWith is sufficient. When false (default), all topics must match.
  • not: Boolean. Set to true to negate the entire log match (trigger when the log is not emitted).
Using logEmitted enables you to use the event topic prefix in its raw form to filter for events. This is useful if you’re setting up a Web3 Action on an unverified contract.
For the complete field reference, see LogFilter. Below is an example of a Web3 Action that will be invoked when a transaction contains log entries starting with the given prefixes.
log-emitted-filter.yaml

Filtering transactions involving a specific contract

To filter for transactions that call a specific contract during their execution, you can use the optional contract filter. The contract filter supports the following properties:
  • address: The address of the contract.
  • invocation: Controls how the contract was called. Possible values:
    • direct: the contract was called directly by the transaction sender (EOA). Use this when you only care about top-level calls to the contract.
    • internal: the contract was called internally by another contract during execution (e.g. via CALL, DELEGATECALL, or STATICCALL opcodes). Use this to detect when your contract is invoked as part of a multi-contract interaction.
    • any: matches both direct and internal calls. This is the default.
The invocation field is available wherever a contract object is used, including inside eventEmitted filters. For example, you can use invocation: internal on an eventEmitted contract to only match events emitted during internal calls. See Contract for the schema.
invocation is not supported on logEmitted. Only contract.address is used to restrict log matching; the invocation type is ignored.
In the example below, the first filter matches any successful transaction sent to 0x2364...fd62 on Sepolia. The second filter is more restrictive: only transactions that also involve an internal call to contract 0xad88...80d6 will trigger the Web3 Action.
contract-filter.yaml

Filtering transactions by function call

To filter for transactions that directly call a specific function, you can use the optional function filter. It requires the address of the contract contract.address and either the name or signature of the function. The function filter supports the following properties:
  • contract (mandatory): To specify the target contract.
    • contract.address: The address of the contract being called.
    • contract.invocation: Controls how the function must be called: any (default, both direct and internal), direct (EOA-initiated only), or internal (sub-calls only). See contract filter for details.
  • name: The name of the function (requires a verified contract).
  • signature: The 4-byte function selector (e.g. 0xa9059cbb). Useful for unverified contracts where the ABI is not available.
  • not: Boolean. Set to true to negate the entire function match, including parameters (trigger when the function is not called with the specified parameters).
  • parameters: A list of conditions on decoded function input argument values. All conditions are AND-ed: every condition must match. Each entry supports:
    • name (required): The name of the function argument.
    • string: String comparison. Accepts a plain string for exact match, or an object with exact and not fields. See StringComparison for details.
    • int: Integer comparison. Supports the same operators as numeric filters (eq, gt, gte, lt, lte). All operators within a single int block are AND-ed. Use the not flag to negate the combined condition. See IntComparison for details.
There is no OR within a single function entry’s parameters. All conditions are AND-ed. For OR logic on the same parameter, use multiple function entries (which are OR-ed in the outer list).
To use the function filter with name or parameters, the contract must be verified and added to the project in the Tenderly Dashboard. Use signature (4-byte selector) for unverified contracts.
You can specify function as a single object or as a list. When a list is provided, entries are OR-ed. The filter matches if any function in the list is called. For the complete field reference, see FunctionFilter. Below is an example of a Web3 Action trigger responding to any call (direct or internal) to the verySpecialFunction of the contract deployed at 0xad88...80d6.
function-filter.yaml
You can also match by function selector and use multiple function entries:
function-selector.yaml
Here is an example filtering by decoded function input parameters. All parameter conditions are AND-ed:
function-parameters.yaml
String negation, trigger when the recipient is not a specific address:
function-negated-string.yaml
Numeric range with negation on parameters:
function-negated-parameter.yaml
For OR logic on parameters, use multiple function entries:
function-parameter-or.yaml
To match only internal calls, for example, a transfer triggered by a router or flash-loan provider rather than directly by a user, set invocation: internal. This example triggers only when another contract internally calls transfer on USDC for at least 1,000 USDC:
function-internal-with-params.yaml

Filtering transactions by ETH balance

The ethBalance filter triggers your Web3 Action when an account or contract’s ETH balance meets a numeric condition during a transaction. This is useful for monitoring large whale movements, protocol treasury thresholds, or wallet funding events. The filter supports the following properties:
  • address (mandatory): The account or contract address to monitor.
  • balanceCmp (mandatory): A numeric comparison against the balance at transaction time. Uses BigIntComparison operators (eq, gt, gte, lt, lte). Values are in wei and can be provided as decimal strings (e.g. "1000000000000000000") or 0x-prefixed hex (e.g. "0xde0b6b3a7640000").
  • not (optional): Set to true to negate the entire match.
You can provide a single ethBalance object or a list, entries are OR-ed. For the complete field reference, see EthBalanceFilter. Example: trigger when a wallet’s balance reaches at least 1 ETH:
eth-balance-filter.yaml
Example: multiple accounts monitored in one filter (OR-ed):
eth-balance-multi.yaml
Example: balance within a range:
eth-balance-range.yaml
Example: trigger when a wallet’s balance is not below 1 ETH (i.e. negating the condition):
eth-balance-not.yaml

Filtering transactions by contract state changes

The stateChanged filter triggers your Web3 Action when a contract’s state variable changes during a transaction. You can match on any combination of: whether the variable changed at all, a specific new value, a percentage change, or a raw storage slot key. The filter supports the following properties:
  • address (mandatory unless matchAny: true): The contract address to watch.
  • matchAny (optional): When true, matches state changes on any contract in the transaction, address can be omitted. Useful for protocol-wide monitoring.
  • params (optional): A list of state variable conditions. All entries are AND-ed. When omitted, the filter matches any state change on the specified address.
  • not (optional): Set to true to negate the entire match.
Each entry in params requires:
  • name (mandatory): The name of the state variable.
  • At least one condition:
    • change: true: matches when the variable’s value changed at all.
    • valueCmp (BigIntComparison), matches when the new value meets a numeric condition.
    • percentageCmp (BigIntComparison), matches on the signed percentage change computed as (newValue - oldValue) * 100 / oldValue. Positive values mean an increase, negative values mean a decrease. For example, gte: "10" fires on increases of 10%+; lte: "-10" fires on decreases of 10%+. Note: when oldValue is 0, the percentage is always 0, use change: true or valueCmp instead.
    • storageSlotKey: matches by raw storage slot key (useful for unverified contracts).
For the complete field reference, see StateChangedFilter.
To use name-based state variable matching, the contract must be verified and added to your project in the Tenderly Dashboard.
Example: trigger when totalSupply changes at all:
state-changed-basic.yaml
Example: trigger when totalSupply reaches a threshold:
state-changed-value.yaml
Example: trigger when totalSupply increases by 50% or more:
state-changed-percentage-increase.yaml
Example: trigger when totalSupply decreases by 10% or more:
state-changed-percentage-decrease.yaml
Example: multiple param conditions AND-ed (totalSupply changed AND new value is above a floor):
state-changed-multi-params.yaml
Example: watch a specific mapping slot (e.g. balances[bob]) using a raw storage slot key: For mappings, there is no named variable per entry, use storageSlotKey with the keccak256-derived slot for the key you care about. The slot for mapping(address => uint256) balances at storage slot N and key addr is keccak256(abi.encode(addr, N)).
state-changed-slot.yaml
The storageSlotKey approach works for unverified contracts and any storage layout, it does not require the contract to be verified or added to your Tenderly project. Example: matchAny to monitor any contract in the transaction:
state-changed-match-any.yaml
stateChanged and ethBalance can be combined with any other filter in the same filter object, all fields are AND-ed. The examples below show common real-world combinations. Example: mint() was called AND totalSupply changed (confirm the call had on-chain effect):
state-changed-with-function.yaml
Example: Transfer event emitted AND paused state changed (ownership or pause flag toggled during a transfer):
state-changed-with-event.yaml
Example: any call to a contract AND the caller’s ETH balance is above a threshold:
eth-balance-with-to.yaml
Example: trigger when togglePause() was called but balances did not change (i.e. the tx affected only the paused flag):
state-changed-not.yaml

Complete transaction trigger reference

The following annotated YAML block shows every available field for transaction triggers in one place. Use it as a quick reference when building your trigger configuration. For type definitions, see the Trigger YAML schema reference below.
complete-reference.yaml

Trigger YAML schema reference

The schema below describes the structure and types of every field accepted by the trigger configuration. Use it alongside the annotated example above when building your tenderly.yaml. Notation: ? = optional, | = one of, [] = list. Fields marked “single or list” accept either a scalar value or a YAML list.

All trigger types

schema.yaml

TransactionFilter

schema.yaml
At least one of from, to, function, eventEmitted, logEmitted, ethBalance, or stateChanged must be present in each filter.
The top-level contract field acts as a shared default for the filter. It is automatically applied to any function or eventEmitted entry that does not specify its own contract, letting you avoid repeating the same address. It does not apply to logEmitted.

Shared types

schema.yaml

FunctionFilter

schema.yaml

EventFilter (eventEmitted)

schema.yaml

LogFilter (logEmitted)

schema.yaml

EthBalanceFilter (ethBalance)

schema.yaml

StateChangedFilter (stateChanged)

schema.yaml