Objective
Build a workflow that:- TRIGGER: Detects a
SlidePerformed(address)event emitted by theSlideBountysmart contract on Polygon Amoy testnet. - ACTION 1: Automatically calls
payoutLast()to pay out the reward/bounty to the last participant. - ACTION 2: Sends a Telegram message confirming the reward distribution.
Step 1: Smart contract setup
Deploy the contract below to handle slide actions and bounty payouts. File name:SlideBounty.sol
0x5EE16Ac7BEBde8F38C99DbEFBBEA4fC5653fC34C
Network: Polygon Amoy Testnet (Chain ID: 80002)
Step 2: Setting up the Telegram bot
Before creating the automation, configure a Telegram bot:- Open Telegram and search @BotFather.
-
Run
/newbotto create a bot and get your bot token, for example,8290848596:AAHll2dz1Me9CET3ztEwJm2uUaQQSMLNpUE. -
Use @userinfobot to get your chat ID, for example,
1238754794. -
Test your bot token with a POST to:
https://api.telegram.org/bot<YOUR_BOT_TOKEN>/sendMessageExample body:
Step 3: Frontend (React UI)
This React component provides a slide UI that callsperformSlide() on the contract and emits the SlidePerformed event.
File Name: SlideTrigger.jsx
Step 4: Kwala workflow setup
Now configure the Kwala workflow to react toSlidePerformed events and run the payout and notification actions.
- Navigate to Kwala Dashboard
- Select Create New Workflow
- Set Workflow Name:
BountyPayouts
- Execute After:
event - Repeat Every:
event - Trigger Source Contract:
0x5EE16Ac7BEBde8F38C99DbEFBBEA4fC5653fC34C - Trigger Chain ID:
80002 - Trigger Event Name:
SlidePerformed(address) - Expires In: An expiration date such as,
24-10-2025 16:00IST - Action Status Notification URL:
http://localhost:3000/
- Action Type:
CALL (smartcontract) - Target Contract:
0x5EE16Ac7BEBde8F38C99DbEFBBEA4fC5653fC34C - Target Function:
function payoutLast() - Chain ID:
80002 - Retries Until Success:
2
-
Type:
POST (API CALL) -
API Endpoint:
https://api.telegram.org/bot<YOUR_BOT_TOKEN>/sendMessage -
API Payload:
-
Retries Until Success:
2
Sequential (PayBounty runs first, then Telegramreceipt)
Final YAML configuration
Paste this YAML into Kwala (keeps the same structure and values used above):Step 5: Deploy and test
- Create and deploy the workflow in the Kwala Dashboard with the YAML above.
- Wait for the workflow status to show Claimed or Active.
-
Run your React app and perform a slide (
performSlide()). -
Kwala should detect the event, call
payoutLast(), and then send the Telegram message. -
Verify
BountyPaidevents on Amoy Polygonscan and check Telegram for the success message:“Congratulats, You got 0.01 POL Bounty from Slide to Earn Reward”
Step 6: Monitor workflow execution
In the Kwala Dashboard → Workflows → Logs, you can inspect:- Event Triggers — confirm
SlidePerformedevents. - Action Executions — verify
payoutLast()calls and Telegram posts. - Retries & Failures — debug any failed attempts or delivery issues.
Conclusion
With a smart contract, a lightweight React frontend, and a simple YAML workflow, you’ve built a Slide-to-Earn automated bounty payout system using Kwala Workflows. This use case demonstrates how Kwala enables event-driven Web3 automations, connecting on-chain triggers to contract interactions and off-chain notifications, all without a centralized backend. You can extend this architecture to power real-time on-chain rewards, gaming and engagement token drops, and community participation payouts.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
