Objective
Create a Kwala workflow that:- TRIGGER: Detects
USDCAcceptedevents emitted by the Treasury Vault contract when a USDC deposit happens. - ACTION: Instantly posts a notification to a Discord channel via webhook.
Prepare your Discord webhook
- Open Discord and go to Server Settings > Apps > Create New App
- Select Create a Bot and configure the name, avatar, and permissions
- Go to Server Settings > Integrations > Webhooks
- Select New Webhook, choose your target channel, then select Copy Webhook URL
- (Optional) Test the webhook with a POST request:
{"content": "Test message from Discord Webhook!"}
Step 1: Smart contract setup
This use case uses two Solidity contracts: a simple ERC20 (USDC-like) and a treasury vault that accepts deposits and emits an event. MintERC20USDC.sol Contract Address (Base Sepolia):0x025B55313ac120435963f571F02EcC3d35FA6e6e
0x60Fc086C786e8B66aeD0163A266bd3aF9125e8D0
- Mint USDC tokens from
MintERC20USDC. - Approve the
TreasuryAcceptUSDCcontract to spend tokens. - Deposit tokens into the treasury (calls
deposit). TreasuryAcceptUSDCemitsUSDCAccepted, which Kwala detects and uses to send a Discord alert.
Step 2: Build the Kwala workflow
Step 2.1: Create a new workflow
- Open the Kwala Dashboard: Kwala Dashboard
- Select Create New Workflow
- Name it, for example:
USDC_Received_Notifier1
Step 2.2: Configure the trigger
- Execute After: immediately
- Repeat Every: event
- Recurring Source Contract:
0x60Fc086C786e8B66aeD0163A266bd3aF9125e8D0(Treasury contract on Base Sepolia) - Recurring Chain ID:
84532(Base Sepolia testnet) - Recurring Event Name:
USDCAccepted(address,uint256,uint256) - Expires: An expiration date such as
08-10-2025 15:00IST - Action Status Notification POST URL:
This ensures every USDC deposit triggers the workflow.
Step 2.3: Configure the action (Discord notification)
- Action Name:
discord_call - Type:
POST(API CALL) - API Endpoint: your Discord webhook URL (example provided in the YAML)
- API Payload:
content: "USDC Received on USDC Treasury Vault Smart Contract" - Retries Until Success:
5 - Execution Mode:
sequential
YAML: Use as-is in the Kwala dashboard
Paste this YAML into the Kwala dashboard, save & compile, then deploy.
Step 3: Deploy and test
- Save and compile the YAML workflow in Kwala.
- Deploy it and wait for status: claimed.
- In Remix:
- Mint USDC via
MintERC20USDC(if needed). - Approve the treasury contract to spend your USDC.
- Call
deposit(amount)onTreasuryAcceptUSDC.
- Mint USDC via
- After the deposit transaction completes, the contract emits
USDCAccepted, Kwala detects it and your Discord webhook receives the message:
USDC Received on USDC Treasury Vault Smart Contract
Conclusion
You’ve built a real-time stablecoin deposit alert using Kwala Workflows, a single YAML workflow that connects on-chainUSDCAccepted events to a Discord notification. No servers, no cron jobs, and no custom backend.
Kwala helps you connect on-chain events to off-chain systems quickly, automate DeFi treasury monitoring without operational overhead, and build event-driven Web3 infrastructure using YAML.
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
