Skip to main content
In this guide, we’ll build a Slide-to-Earn bounty automation using Kwala Workflows, a YAML-driven, serverless Web3 automation platform. With Kwala, you can seamlessly connect on-chain events to on-chain or off-chain actions such as contract calls, Telegram notifications, or API integrations, without deploying your own backend or cron jobs. Here you’ll learn how to automate reward/bounty payouts for users who perform a “slide action” on a React frontend, using Kwala to monitor the event and trigger automatic payments and Telegram confirmations.

Objective

Build a workflow that:
  • TRIGGER: Detects a SlidePerformed(address) event emitted by the SlideBounty smart 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.
This setup removes centralized servers and gives you a trustless, transparent, and fully automated reward distribution mechanism.

Step 1: Smart contract setup

Deploy the contract below to handle slide actions and bounty payouts. File name: SlideBounty.sol
Deployed contract address: 0x5EE16Ac7BEBde8F38C99DbEFBBEA4fC5653fC34C Network: Polygon Amoy Testnet (Chain ID: 80002)
After deployment, fund the contract with test POL so it can pay bounties. You can view it on Amoy Polygonscan.

Step 2: Setting up the Telegram bot

Before creating the automation, configure a Telegram bot:
  1. Open Telegram and search @BotFather.
  2. Run /newbot to create a bot and get your bot token, for example, 8290848596:AAHll2dz1Me9CET3ztEwJm2uUaQQSMLNpUE.
  3. Use @userinfobot to get your chat ID, for example, 1238754794.
  4. Test your bot token with a POST to: https://api.telegram.org/bot<YOUR_BOT_TOKEN>/sendMessage Example body:
If the test succeeds, your bot is ready.

Step 3: Frontend (React UI)

This React component provides a slide UI that calls performSlide() on the contract and emits the SlidePerformed event. File Name: SlideTrigger.jsx
package.json
App.jsx

Step 4: Kwala workflow setup

Now configure the Kwala workflow to react to SlidePerformed events and run the payout and notification actions.
  1. Navigate to Kwala Dashboard
  2. Select Create New Workflow
  3. Set Workflow Name: BountyPayouts
Trigger configuration
  • 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:00 IST
  • Action Status Notification URL: http://localhost:3000/
Actions Action 1 — PayBounty
  • Action Type: CALL (smartcontract)
  • Target Contract: 0x5EE16Ac7BEBde8F38C99DbEFBBEA4fC5653fC34C
  • Target Function: function payoutLast()
  • Chain ID: 80002
  • Retries Until Success: 2
Action 2 — Telegramreceipt
  • Type: POST (API CALL)
  • API Endpoint: https://api.telegram.org/bot<YOUR_BOT_TOKEN>/sendMessage
  • API Payload:
  • Retries Until Success: 2
Execution Mode: 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

  1. Create and deploy the workflow in the Kwala Dashboard with the YAML above.
  2. Wait for the workflow status to show Claimed or Active.
  3. Run your React app and perform a slide (performSlide()).
  4. Kwala should detect the event, call payoutLast(), and then send the Telegram message.
  5. Verify BountyPaid events 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 SlidePerformed events.
  • 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