Intro to Web3 Actions
Tenderly Web3 Actions will run your code in response to on-chain (or even off-chain) events, usually on your smart contracts.
You can use Web3 Actions to create custom scenarios in order to further deepen your debugging process, create alerting patterns that are not available out-of-the-box in the Alerting section, automating testing or live production execution in the Simulator and Forks, or anything else that comes to (your) mind.
The code Web3 Actions run is called a function. The function must be written in TypeScript (or JavaScript) and run in Node 14 runtime. Specification of events that your action listens to is called a trigger. There are 5 types of triggers:
  • Transaction - runs a function in response to transactions, with statuses like as soon as the transaction is mined or after 10 blocks have passed and filters such as emitted events, invoked methods, etc.
  • Block - runs your function when the block is mined on a chosen chain(s).
  • Webhook - runs your function when a request is POSTed to an endpoint.
  • Periodic - runs your function in periodic intervals or configured CRON.
  • Alert - use your action as the destination channel for an alert (trigger your action when your defined alert is triggered).

Getting Started (CLI)

To get started, run tenderly actions init in a directory where you want to initialize actions project, which will lead you through setting up a project for your Web3 Actions.
You will need Tenderly CLI to initialize Web3 Actions. You will need npm if you are using TypeScript actions or use tenderly actions init --language javascript.
After initialization, the project contains:
  • tenderly.yaml with the specification of all actions (e.g. name, description, etc.) and their triggers. For more details, see the configuration page.
  • actions directory (or whatever is chosen during setup) where functions implementation should go including files package.json or tsconfig.json in the case of TypeScript.
All tenderly actions commands must be run from a directory that contains tenderly.yaml.
When you initialize actions project, you must select a Tenderly project which will be used for deploying your actions. You can deploy actions from multiple locations to the same Tenderly project. You can also initialize actions multiple times in the same directory and select a different Tenderly project for each initialization.
If your actions are very different or have different dependencies, it is recommended to separate them. You can still use the same Tenderly project to deploy them.
If your Web3 Actions have dependencies, node_modules directory located in the same directory with your actions source files will be packaged and deployed with your actions. npm install must be run from a directory where actions sources are. Note that this might be a different directory than one where you run tenderly actions commands.
Zipped dependencies must not exceed 45MB. Reach out to us if your requirements exceed this limit.

Step-by-Step Guide

If you want to create your first Web3 Action and go through a step-by-step guide, we prepared for you an onboarding flow in the UI. When you go to Actions Page, you will see an onboarding flow that will help you to get started with Web3 Actions.
Quick Guide provides a quick overview of the steps you need to reproduce in order to deploy your first Web3 Action.
Quick Guide
Step-by-Step Guide provides an in-depth explanation for each step you need to reproduce in order to deploy your first Web3 Action.
You need to import an example contract into your project in order to start the tutorial and create your Web3 Action example. If you are not using the tutorial, you don't have to do this in order to use Web3 Actions.
Step-by-Step Guide
Create a Function Step
Use Secrets Step
Configure a Trigger Step
Deploy Action Step

Deploying Actions

To view your actions in the dashboard, you must deploy them first. Run tenderly actions deploy in an initialized project to deploy generated example and go to provided link to view the action in the dashboard. If you initialized actions for multiple projects in the same directory, you will be asked to select a project which you want to deploy. All actions for a single project are deployed together.
Deployed action can be stopped through the dashboard. Action will stay deployed, but it won't run automatically.
If you just want to validate configuration or build implementation without deploying it, run tenderly actions build.

Create and Edit Action from the UI

If you prefer a more visual experience while setting up your actions, we created a Web3 Action UI Builder. Go to the Actions tab in the sidebar and click on Add Action button in the upper right corner.
Web3 Actions Welcome Screen
You will enter to Web3 Action Cration page where you can configure action type, set up code and trigger and name it as you want to be recognizable.
Web3 Action UI Builder
The first step is setting up the trigger type where you can determine what type of event your action is listening to. After that, you'll be prompted to add a source code of your Web3 Action (you can see the event schema, secret and storage source code at our GitHub repository). The next step is to set up a trigger on which event or by which schedule your function will be executed. The last step is setting up the name and a description of the Web3 Action.

Manual Trigger

While action must specify trigger type, it doesn't have to configure a trigger. Without a configured trigger, the action will never run automatically. But you can still run your action manually! This can be useful for testing. Navigate to the specific action and click the Manual Trigger button.
You can provide any payload you want, as long as it matches the required schema. If your trigger type is transaction or block, you can fetch a transaction or block from a network instead of manually creating a payload.
If you deployed initialized block action, here is an example of a valid payload:
"network": "1",
"blockNumber": 1000,
"blockHash": "0x5b4590a9905fa1c9cc273f32e6dc63b4c512f0ee14edc6fa41c26b416a7b5d58"
You can use a manual trigger even if the action is stopped.

Web3 Actions Tutorials

If youโ€™re already familiar with Web3 Actions, check out these tutorials to get a more hands-on experience:
Web3 Actions - A Serverless Backend for Development Efficiency:
Tenderly's Guide to Web3 Actions: An Efficient Serverless Backend
Blog | Tenderly
Get guidance on writing Web3 Actions for handling on-chain events:
This comprehensive step-by-step tutorial shows you how to set up a serverless backend for a well-known example โ€“ Tic Tac Toe, a game with multiple state changes. The steps cover deploying the gameโ€™s smart contract to Tenderly, configuring Web3 Action files, writing functions that respond to different game events, setting up relevant Action triggers, and other important functionalities. This extensive tutorial gives you everything you need to write your own Web3 Actions for on-chain events.
Learn how to use Web3 Actions to set up your Oracle:
If you want to feed real-world data to your smart contract, you can use Web3 Actions to gather information from a Web2 API. The tutorial guides you through deploying relevant smart contracts, writing your Action, specifying when it should be executed, getting and storing API keys as Secrets, and running your Action.
Find out how to send a Discord message about (new) Uniswap pools using Web3 Actions:
Follow a few steps to add a Uniswap contract to Tenderly, write the code, gather token data, configure your Action, save the Discord webhook to Secrets in your Tenderly Dashboard, and then run your Action.
Copy link
On this page
Getting Started (CLI)
Step-by-Step Guide
Deploying Actions
Create and Edit Action from the UI
Manual Trigger
Web3 Actions Tutorials