---
updatedAt: 2025-09-24T23:45:44.000Z
agentTools:
  projectIndex: https://docs.zettablock.com/llms.txt
---

# Real-Time Triggers (Webhooks)

Real-Time Triggers, commonly known as webhooks, are pivotal in integrating real-time data into Web3 applications. They enable instantaneous data access, prompt notifications, dynamic interactions, enhanced user experiences, automation, and streamlined workflows.

This document provides a step-by-step guide on implementing Real-Time Triggers in your Web3 applications.

### Prerequisites

* Familiarity with ZettaBlock's APIs.
* Understanding of HTTP request methods and JSON format.

#

# General Implementation Steps

## Step 1: Write a Query

Choose the relevant data tables and write your desired logic. Keep in mind that webhooks are currently only supported for real-time (postgreSQL) tables.

## Step 2: Create a Real-Time API

Create a one-click-ready API endpoint based on your query. Set your primary key and indexers depending on your logic.

## Step 3: Create and Test a Webhook

In the API settings, select 'Create a Trigger'.

**Configuration**:

* **Destination URL**: Specify where the webhook should send data.
* **Granularity**: Choose between PerRecord and PerBatch.
* Format is automatically set to **JSON**.
* **Testing**: Use a [testing tool ](https://webhook.site/#!/57630f93-b44c-4ec3-95c1-95fddc53f06f)to simulate events and verify the webhook's response.

## Error Handling and Debugging

* **Logs**: Monitor webhook logs for errors or unexpected behavior.

<Image align="center" width="50% " src="https://files.readme.io/f5f0976-image.png" />

* **Status Codes**: Pay attention to (external) HTTP status codes for success (200 OK), client errors (4xx), and server errors (5xx).
* **Retry Logic**: Implement retry mechanisms for failed webhook deliveries.

#

# Example: Real-Time Notifications for High-Value ETH Transfers

This example demonstrates setting up a Real-Time Trigger in ZettaBlock for monitoring Ethereum transfers exceeding 50 ETH. The webhook will notify a specified Telegram channel upon detecting such transfers.

## Step 1: Write a Query

```sql
SELECT
  from_address,
  transaction_hash,
  amount
FROM
  (
    SELECT
      from_address,
      transaction_hash,
      (CAST(VALUE as numeric) / POW(10, 18)) AS amount
    FROM
      ethereum_mainnet.native_token_transfers
    WHERE
      block_date = CURRENT_DATE
  ) AS subquery
WHERE
  amount > 50
GROUP BY
  1,
  2,
  3
```

## Step 2: Create a Real-Time API

In this case, set your primary key to `transaction_hash` and `trace_index` .

![](https://files.readme.io/b1cf63b-image.png)

![](https://files.readme.io/774a9ae-image.png)

## Step 3: Create and Test a Webhook

![](https://files.readme.io/e799873-image.png)

**Configuration**:

* **Destination URL:** Enter the webhook URL provided by your Telegram bot.
* **Granularity:** Set to PerRecord to trigger notifications for each qualifying transaction.

With this setup, you receive real-time Telegram notifications for high-value ETH transfers, effectively utilizing ZettaBlock's Real-Time Triggers. These notifications not only keep you informed but also empower you to take immediate action.

Upon receiving a notification, you have the option to manually monitor the involved addresses more closely - however, you can also further automate this process.

The real-time data provided by these webhooks can be integrated into your own trading systems. For instance, you could automate a trading bot to initiate specific actions in response to these high-value transactions. The webhook acts as a trigger, setting off predefined trading strategies or adjustments in your bot, based on the nature and scale of the transactions detected.