> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tenderly.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Setting Up Alerts as Triggers for Web3Actions

> Learn how to set up and configure Alerts as triggers for Web3Actions in Tenderly, enabling automated responses to blockchain events.

[Web3 Actions](/monitoring/web3-actions/introduction) automate responses to blockchain events. This guide shows how to set up [Alerts](/monitoring/alerts/introduction) as triggers for Web3Actions, so an action runs whenever its alert conditions are met.

<Note>
  This guide assumes you have a Tenderly account and basic familiarity with Web3Actions.
</Note>

## Prerequisites

Before you begin, make sure you have:

* [Tenderly CLI](https://github.com/Tenderly/tenderly-cli) installed
* A Tenderly account with appropriate permissions
* Basic understanding of Web3Actions

## Setup Process

You can set up Alert triggers for Web3Actions through either the UI or CLI approach.

<Steps>
  ### UI Approach

  1. Log in to your Tenderly dashboard
  2. Navigate to the Web3Action section
  3. Click on `Create New Action`
  4. In the trigger type selection, choose `Alert`
  5. Configure your action:

  * Set a name for your action
  * Define the function that will be executed
  * Specify any necessary environment variables

  6. Click `Deploy` to create and deploy your Web3Action
  7. Open your Alert (**Alerts** in the left-hand menu) and add the deployed Web3 Action as its destination

  ### CLI Approach

  1. Create an Alert in your Tenderly dashboard (or pick an existing one)
  2. Initialize your Web3Action:

  ```bash theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
  tenderly actions init
  ```

  3. Configure your `tenderly.yaml`:

  ```yaml theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
  account_id: "<YOUR_ACCOUNT_ID>"
  actions:
    <YOUR_ACCOUNT_ID>/<YOUR_PROJECT_SLUG>:
      runtime: v2
      sources: actions
      specs:
        <YOUR_ACTION_NAME>:
          description: "Description of what your action does"
          function: example:actionFn
          trigger:
            type: alert
            alert: {}
          execution_type: sequential
  project_slug: "<YOUR_PROJECT_SLUG>"
  ```

  <Warning>
    Make sure to replace all placeholder values (`<YOUR_ACCOUNT_ID>`, `<YOUR_PROJECT_SLUG>`, and `<YOUR_ACTION_NAME>`) with your actual values.
  </Warning>

  The `alert` trigger takes no configuration: the yaml only declares that the action is alert-triggered. The link to a specific Alert is made in the next step, by adding the action as that Alert's destination.

  4. Implement your action code
  5. Deploy using:

  ```bash theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
  tenderly actions deploy
  ```

  6. Open your Alert (**Alerts** in the left-hand menu) and add the deployed Web3 Action as its destination
</Steps>

## Understanding the Configuration

Here's what each configuration element means:

* `account_id` and `project_slug`: Identify your Tenderly account and project
* `runtime`: Specifies the runtime version for your action
* `sources`: Indicates the directory containing your action code
* `specs`: Defines the specifications for your action
* `trigger`: Configures how your action is triggered
* `execution_type`: Determines how multiple instances are handled

## Best Practices

1. Use descriptive names for your actions and alerts
2. Keep your action code modular and focused
3. Use environment variables for sensitive information
4. Test thoroughly before deployment
5. Monitor your action executions regularly

## Troubleshooting

If you encounter issues:

* Verify the Web3 Action is added as a destination on the Alert
* Check alert conditions are properly configured
* Review Tenderly dashboard logs for errors
* Ensure CLI is up to date and properly authenticated

<Warning>
  If your action isn't triggering, first check the alert configuration and action logs in the Tenderly dashboard.
</Warning>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.