> ## 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) in Tenderly provide a powerful way to automate responses to blockchain events. This guide will walk you through the process of setting up [Alerts](/monitoring/alerts/introduction) as triggers for Web3Actions, allowing you to create automated workflows based on specific blockchain conditions.

<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

  ### CLI Approach

  1. Create an Alert in your Tenderly dashboard and note the `ALERT_ID`
  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: { <YOUR_ALERT_ID> }
          execution_type: parallel
  project_slug: "<YOUR_PROJECT_SLUG>"
  ```

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

  5. Implement your action code
  6. Deploy using:

  ```bash theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
  tenderly actions deploy
  ```
</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

<Note>
  Following these best practices will help ensure smooth operation of your Web3Actions.
</Note>

## Troubleshooting

If you encounter issues:

* Verify your `ALERT_ID` matches the created 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>

## Conclusion

By following this guide, you should now have a Web3Action set up to trigger based on an Alert. This powerful combination allows you to create automated, responsive systems that can react to specific blockchain events or conditions in real-time.
