0watch Webhook Alerts

0watch fires webhook notifications when a transaction on a watched wallet exceeds a threshold you set. Supported targets: any HTTP/HTTPS endpoint, and Telegram via a bot token.


How it works

  1. Register a webhook: provide a URL, a wallet address, and an ETH threshold.
  2. The indexer processes each new block. When a transaction's value exceeds the threshold, 0watch POSTs a JSON payload to your URL.
  3. If the delivery fails, 0watch retries once after 5 seconds.
  4. All delivery attempts (success and failure) are logged and queryable.

Webhooks fire on transactions where the watched wallet is either sender or recipient.


Register a webhook

curl -X POST http://localhost:3001/api/webhooks \
  -H 'Content-Type: application/json' \
  -d '{
    "url": "https://example.com/hook",
    "wallet_address": "0xYourWalletAddress",
    "threshold_eth": 0.5
  }'

Response:

{
  "id": 1,
  "url": "https://example.com/hook",
  "walletAddress": "0xyourwalletaddress",
  "thresholdEth": 0.5,
  "createdAt": 1741550000000
}

Use the returned id to delete the webhook later.


Webhook payload

{
  "event": "high_value_transaction",
  "walletAddress": "0xyourwalletaddress",
  "thresholdEth": 0.5,
  "valueEth": 1.25,
  "transaction": {
    "hash": "0xdeadbeef...",
    "blockNumber": 27480000,
    "timestamp": 1741550000,
    "fromAddress": "0xyourwalletaddress",
    "toAddress": "0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
    "valueWei": "1250000000000000000",
    "txType": "eth_transfer",
    "status": 1,
    "chainId": 8453
  }
}

Your endpoint must return any 2xx status. valueWei is a string — parse large values with BigInt().


Telegram notifications

0watch supports Telegram natively. You need a Telegram bot token and a chat ID.

Step 1 — Create a bot

Message @BotFather on Telegram and run /newbot. Copy the token it gives you.

Step 2 — Get your chat ID

Send any message to your bot, then fetch:

https://api.telegram.org/bot<YOUR_TOKEN>/getUpdates

Find "chat":{"id": ...} in the response. That's your chat ID.

Step 3 — Register the webhook

Use a telegram:// URL with your credentials:

curl -X POST http://localhost:3001/api/webhooks \
  -H 'Content-Type: application/json' \
  -d '{
    "url": "telegram://<CHAT_ID>?token=<BOT_TOKEN>",
    "wallet_address": "0xYourWalletAddress",
    "threshold_eth": 0.1
  }'

When a transaction fires, 0watch sends a plain-text message to the chat:

0watch high-value transaction
Wallet: 0xyourwalletaddress
Value: 1.25 ETH
Threshold: 0.1 ETH
Hash: 0xdeadbeef...
From: 0xyourwalletaddress
To: 0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
Type: eth_transfer
Chain: 8453

List webhooks

# All webhooks
curl http://localhost:3001/api/webhooks

# Webhooks for a specific wallet
curl 'http://localhost:3001/api/webhooks?wallet=0xYourWalletAddress'

Delete a webhook

curl -X DELETE http://localhost:3001/api/webhooks/1

Check delivery history

# Last 25 deliveries (all wallets)
curl http://localhost:3001/api/deliveries

# Deliveries for a specific wallet
curl 'http://localhost:3001/api/deliveries?wallet=0xYourWalletAddress'

# More results
curl 'http://localhost:3001/api/deliveries?limit=100'

A "status": "failed" delivery means both attempts (initial + retry) failed. The error field contains the failure reason.


Multiple thresholds

Register multiple webhooks for the same wallet with different thresholds to route by severity:

# Low threshold → Telegram for immediate awareness
curl -X POST http://localhost:3001/api/webhooks \
  -d '{"url":"telegram://...","wallet_address":"0x...","threshold_eth":0.1}'

# High threshold → PagerDuty / Slack for escalation
curl -X POST http://localhost:3001/api/webhooks \
  -d '{"url":"https://hooks.slack.com/...","wallet_address":"0x...","threshold_eth":5.0}'

Each webhook is evaluated independently. A 10 ETH transaction fires both.