Objective
This guide helps you set up an automation that:- Monitors a wallet balance on the Polygon Amoy testnet.
- Emits an event when the balance is below 0.1 POL.
- Sends an instant Telegram alert to the user.
Prerequisites
Make sure you have:- A MetaMask wallet connected to the Polygon Amoy Testnet and Kwala network.
- Remix IDE to deploy the Solidity smart contract.
- A Telegram bot created via @BotFather.
- Access to the Kwala Dashboard to set up the workflow.
Step 1: Build and deploy the Solidity smart contract
This Solidity contract checks user balances and emits an event when the balance drops below 0.1 POL. Solidity smart contract:LowPolBalance event: this event becomes the trigger for your Kwala workflow.
Deploy the contract using Remix and connect your MetaMask wallet to Polygon Amoy Testnet. You must have POL Faucet to deploy the smart contract.
https://amoy.polygonscan.com/) to inspect the contract and its transactions.
Step 2: Configure the Telegram bot
Before building the Kwala workflow, set up your Telegram bot:- Open Telegram and search @BotFather.
- Run
/newbotto create a bot and get a bot token. - Use @userinfobot to obtain your chat ID.
- Bot token to access the HTTP API, for example,
7754368882:AAHS4KbbOkl5rEHoBBIR8eljgwq2PARYLyY - Chat ID, for example,
968602918
Step 3: Build the workflow in Kwala
- Navigate to your Kwala dashboard.
- Select “Create New Workflow”.
- Give your workflow a name. For example,
LowBalanceNotifier1.
Workflow configuration
Triggers This is the event that activates your workflow.- Execute After: Set to event: executes the action after the event is emitted.
- Repeat Every:
eventtriggered by the event. - Expires: Add an expiration timestamp. For example,
17-09-2025 16:00in IST. - ParameterValue: RecurringSource Contract:
0x1C5a23Fd1F7fEd9A5d020858BD4b93e5c93C92a8the deployed smart contract address, available on Amoy Polygonscan. - Trigger Chain ID:
80002Polygon Amoy Testnet - Recurring Event Name:
LowPolBalance(address, uint256) - Event Filter:
NA - Smart contract (optional): You can paste the Solidity code or upload the
.solfile. - Recurring source contract ABI: Automatically fetched from the deployed contract.
- Action Name: for example,
telegram_notifier - Action Type:
POST API CALL - API Endpoint:
https://api.telegram.org/bot<YOUR_BOT>/sendMessage - API Payload (JSON):
- Retries Until Success:
5 - Execution Mode:
Sequentialactions run in order
LowPolBalance event and triggers the action whenever it’s emitted.
Step 4: Add the YAML configuration
Below is the YAML script to use for your Kwala workflow. Save and compile this code in the Kwala dashboard.Step 5: Create a polling workflow (Optional)
You can also create a polling workflow that calls the contract on a schedule. Workflow name: for example,Polling1
Trigger
- Execute After:
immediate— executes the action - Repeat Every: Time interval (actions repeat on a schedule)
- Expires: for example,
17-09-2025 16:00in IST - Recurring source value configurationInterval value: time interval you want (for example,
1in unitMin/hour/days) - Action status Notification POST URL: add the workflow’s notification URL
- Action Name: for example,
Polling1 - Action Type:
CALL (Smart Contract) - Target Function:
function checkAndWarn(address user) - Target Smart contract:
0x1C5a23Fd1F7fEd9A5d020858BD4b93e5c93C92a8(deployed contract address) - Trigger Chain ID:
80002(Polygon Amoy Testnet)
Add the YAML configuration for polling
How it works
The trigger monitors the LowPolBalance event, and when the event fires, the workflow sends a POST request to your Telegram bot API endpoint with a custom message. Within seconds, you’ll receive a Telegram message automatically. The second automated Kwala workflow (polling) runs every minute aftercheckAndWarn is called in Remix; it will trigger a notification each minute. Your Telegram will display: “LOW BALANCE! Recharge your wallet. Add 5 POL” repeatedly, every minute. The process runs automatically with no manual checks required.
Test the workflow
- Ensure your wallet balance is below 0.1 POL.
- In Remix, call
checkAndWarn(address user). - When the balance condition is met, the event is emitted, and Kwala’s nodes detect it.
- Kwala executes the Telegram notification instantly.
Conclusion
In this guide, you built a real-time wallet balance notifier using Kwala’s low-code workflow automation. The notifier has no backend servers or infrastructure overhead; just a smart contract and a YAML configuration. Kwala empowers developers to create, automate, and scale on-chain logic effortlessly.Next steps
Monitor Your Workflows
Learn how to track and analyze your workflow executions in real-time
Best Practices
Discover tips and patterns for building robust Web3 automations
