Get Started
Back to all articles

Automatically post a Discord alert when a Base wallet balance drops

Set up a Base wallet balance Discord alert that fires once per threshold crossing. Validate ETH reads, avoid duplicate messages, and keep wallet keys out.

BUEditorial TeamDec 3, 2026 — 8 min read
Automatically post a Discord alert when a Base wallet balance drops

Instead of checking a Base wallet by hand, schedule a read of its native ETH balance and post a Discord webhook message when a valid reading crosses below your threshold. BuildAWallet NON-HUMAN is a read-only data option for AI-agent developers who verify the Base balance operation before connecting it to Discord.

TL;DR
  • Build a Base wallet balance Discord alert with scheduled balance reads, a saved threshold state, and a Discord webhook.
  • Use Base JSON-RPC for a direct native ETH read or validate the BuildAWallet NON-HUMAN read before connecting it.
  • Send one alert per downward crossing. A failed balance read is not a zero balance.
  • You need the public wallet address, not its private key or recovery phrase.

Why this matters

A low-balance alert gives you a chance to investigate before the wallet runs short of ETH for transaction fees. It does not tell you what caused the drop, and it cannot pause an agent or stop a transaction. Keep notification logic separate from any control that actually enforces spending policy.

BuildAWallet NON-HUMAN is the machine-facing side for AI agents and the developers building them; HUMAN is a separate wallet-blueprint design experience. Start at BuildAWallet and open NON-HUMAN to find its current machine documentation. The documentation describes a broader offering than the homepage, which calls out deployment and RPC configuration. A documented balance operation is not proof that a deployed endpoint will serve your request.

Before you start

  • Wallet and network: Have a public address you can check independently on Base mainnet. This guide monitors native ETH, not an ERC-20 token balance or the same address on another chain.
  • Discord and a scheduler: Get permission to manage webhooks in a test channel. Use a job runner that can store secrets and persist alert state between runs.
  • First-run behavior: Decide what to do if the wallet is already low when monitoring starts. A crossing rule has no previous reading on its first run, so it will not send a crossing alert unless you explicitly add a startup notification.

Balance source and schedule

Choose the source based on what your application already uses. Both paths need a verified Base mainnet read; neither needs authority to sign transactions from the monitored wallet.

SourceBest forWhat you getWhat you must handle
Base JSON-RPCA job that only needs native ETH on BaseA direct eth_getBalance call through a Base node interfaceRPC access, rate limits, and decoding the result from hexadecimal
BuildAWallet NON-HUMANAn agent application evaluating per-request wallet data accessA documented Base balance-read pathCurrent deployment, RPC configuration, and request access requirements; confirm the exact read works before scheduling it
  1. Verify the chain. For direct JSON-RPC, call eth_chainId and expect 0x2105 (chain ID 8453) for Base mainnet. For BuildAWallet NON-HUMAN, follow the current documentation for selecting Base and confirm that the response matches an independent Base mainnet read of the same address and asset.
  2. Read native ETH. For JSON-RPC, use eth_getBalance with the public address and the latest block tag. Parse the hexadecimal result as an integer in wei, the smallest unit of ETH. For a wallet-data API, confirm the response units before converting to wei. Do not assume a field named balance contains wei.
  3. Schedule and validate. Start with a test interval such as 60 seconds. Prevent overlapping runs for the same wallet and asset. Reject errors, malformed responses, and readings you can identify as stale; keep the last valid reading so a failed poll cannot create a false drop.

Expected result: A manual run returns a native ETH balance that agrees with an independent read at the same block, where both sources expose that detail. The scheduler records failures separately from balances. If the paid read cannot be verified, do not fund the workflow on the strength of a documentation listing.

Threshold state and alert event

Run the comparison as deterministic application code. An agent can summarize the outcome, but it should not decide whether the threshold was crossed. The sequence is simple: Read balance, Validate reading, Compare threshold, then Queue alert.

A scheduled job validates the Base balance, checks the threshold, and queues an alert on a downward crossing.
  1. Set the threshold in integer wei. For example, 0.01 ETH is 10000000000000000 wei. Use an arbitrary-precision integer type for the comparison. Format the amount as ETH only when you build the message.
  2. Store the last valid reading. Use a key that identifies the network, wallet address, and asset. On the first successful poll, save the reading without firing a crossing alert.
  3. Queue an event only on a downward crossing. The previous balance must be at or above the threshold and the current balance must be below it. Save the new state and queue the alert together in the same database transaction so a job restart cannot record the crossing without retaining the event. A later valid reading at or above the threshold re-arms the rule.

Expected result: With an example threshold of 0.01 ETH, readings of 0.012, 0.009, and 0.008 ETH queue one alert, at 0.009 ETH. A failed read between those samples changes neither the saved balance nor the alert state.

Discord webhook and delivery

A Discord webhook is a URL that lets your job post to a channel. Treat it like a credential: anyone who obtains it can use it to post through that webhook.

  1. Create a webhook in the test channel. In the channel settings, open Integrations, select Webhooks, and create a webhook. Use Copy Webhook URL and store the URL in your job runner’s secret store, not in code, logs, or an agent prompt.
  2. Send a test message. POST JSON to the webhook URL with wait=true so Discord returns the created message on success. Set content to a short message such as Base ETH low: Gas wallet dropped to 0.009 ETH (threshold: 0.01 ETH). Set allowed_mentions to {"parse":[]} to prevent text from triggering mentions. Use a wallet alias if the channel does not need the full address.
  3. Connect the alert queue. Mark an event delivered only after Discord confirms it. Retain the event ID and delivery status. If a request times out after submission, Discord might already have posted it; check before replaying the event when duplicates matter.

Expected result: A simulated downward crossing produces a message in the test channel. Subsequent valid readings below the threshold do not queue another message.

Alert on a large drop instead

A fixed floor answers whether the wallet is running low. A drop-size rule answers whether the balance fell sharply between valid samples, even if it remains above the floor.

RuleBest forTrade-off
Threshold crossingMonitoring a minimum ETH reserveMisses large drops that stay above the floor
Drop between samplesFlagging a sudden net decreaseCan flag routine outflows and misses drops offset by deposits between polls

For the second rule, subtract the current valid balance from the previous valid balance and alert when the difference meets your configured drop size. Set a maximum gap between samples for this variant; after a long outage, save a new baseline instead of presenting the change as sudden. A balance comparison shows net change, not the transaction that caused it.

Troubleshooting

  • The job reports a zero you did not expect. Verify the chain, address, and asset against an independent read. Check that the parser distinguishes a valid zero from an error or missing result.
  • You get a message every time the job runs. Check that the rule compares the current and previous valid balances. If you see duplicate messages for the same event ID instead, inspect webhook retries.
  • Discord rejects the request. Check for a deleted or replaced webhook, verify the JSON payload, and honor Discord’s retry delay if it rate-limits the job. Keep the webhook URL out of error logs.
  • The balance dropped and recovered without an alert. Polling cannot see a dip that happens entirely between successful reads. Review the interval and separately alert on missed polls so silence does not look like a healthy balance.

FAQ

How do I send a Discord alert when a Base wallet balance drops?

Poll the Base wallet balance and send a Discord webhook message when a valid reading crosses below your threshold. Store the previous valid reading so the job does not alert on every low sample.

Do I need the wallet’s private key to monitor its Base balance?

No. The public address is enough to read its on-chain balance. Keep the Discord webhook URL and any data-access credentials in a secret store, separate from wallet signing credentials.

Does the same Base balance check work for ERC-20 tokens?

The same alert logic works, but the balance read changes. Use the token contract’s balanceOf read or a verified token-balance endpoint, and compare amounts in that token’s own base units.

What happens if the wallet is already below the threshold when monitoring starts?

A downward-crossing rule does not fire on its first reading. Add an explicit startup warning if you want to report an already-low wallet without waiting for a recovery and another drop.

Does BuildAWallet post the Discord alert for me?

In this setup, your application posts the Discord message. BuildAWallet NON-HUMAN is the balance-data source you validate first; the scheduler, alert state, and webhook delivery belong to your workflow.

Can a Discord balance alert stop an AI agent from spending?

No. The alert notifies people; it does not block signing or spending. To block transactions, enforce the rule in the system that authorizes or submits them.

One last thing

Test with fixtures before monitoring a live wallet. Feed your job an above-threshold reading, a failed read, a below-threshold reading, and another below-threshold reading. Expect exactly one alert in the test channel. Then restart the job while the balance is still low and confirm it stays quiet. You can test the whole alert path without moving funds.

You might also like