Fuul
  • INTRO
    • ⚑What is Fuul?
    • πŸ’ͺWhy use Fuul?
    • πŸ€”Use Cases
    • βš™οΈIntegration
    • πŸ”—Main Links
  • HOW IT WORKS
    • πŸ’ΈTypes of Rewards
    • βœ…Conversion Events
      • 1️⃣CLAMM LPs (e.g. Uniswap V3)
      • 2️⃣Constant LPs (e.g., Uniswap V2)
      • 3️⃣Lending & Borrowing
      • 4️⃣Staking
      • 5️⃣Token Holders
      • 6️⃣Custom Onchain Events
      • 7️⃣Custom Offchain Events
  • πŸ€‘Incentive Payouts
    • πŸ—ΏFixed Rewards
    • 🌊Variable Rewards
    • πŸ’°Pool Distribution
  • πŸ§‘β€πŸ€β€πŸ§‘Referrals
  • ♾️Attribution Methods
  • πŸ’²Budgets
  • ⚑Fuul Incentives Manager
  • πŸŽ–οΈLeaderboards
  • πŸ’»Incentives Hub
    • πŸ‘¨β€πŸ’»White-Label Implementation
    • πŸ‘No-Code
  • FOR DEVS
    • ⭐Getting started with Fuul Web SDK
    • βš™οΈSending Custom Events through the API
    • πŸ“„Tracking referrals in your app
    • πŸ‘¨β€πŸ’»API Key Management
    • πŸ› οΈBuilding your incentives hub in your app (white-label)
      • ℹ️Getting all incentives information
      • πŸ”—Creating affiliate links or codes
      • πŸ’―Getting Leaderboard Data
        • πŸͺ™Tokens
        • 🌟Points
      • πŸ™‹Getting Individual Rewards
        • πŸͺ™Tokens
        • 🌟Points
      • πŸ€™Claiming Onchain Rewards
    • πŸ”§Building widgets
    • πŸ“’Managing Audiences and Segments
      • πŸ‘€Getting User Audiences using Fuul SDK
      • πŸ‘₯Updating Audience Segments using Fuul API
    • ✈️Migration from older SDK versions
    • πŸ†˜Troubleshooting
  • PROTOCOL
    • ⛓️Smart Contracts
    • 🧡Subgraphs
  • Guides
    • ✏️Getting Started
      • Creating Your First Incentive Program
      • How to Add a Budget in Fuul
  • 🏁Creating Triggers & Conversions
    • Understanding Triggers Types
    • Creating an Event with CSV file
  • 🎨Program Incentive Page
    • Building no code landing pages
  • πŸ“ŠAnalytics
    • Understanding Sybil Detection
Powered by GitBook
On this page
  • Sending Individual events
  • Sending Batch Events
  1. FOR DEVS

Sending Custom Events through the API

This guide shows how to send trigger events through the API

PreviousGetting started with Fuul Web SDKNextTracking referrals in your app

Last updated 5 months ago

Fuul is designed to use onchain triggers, but projects can still have offchain conversions that they want to track or use to make payouts.

For security reasons, these events must be sent from the backend using the SEND: TRIGGER_EVENT API key.

If another type of key is used or if this is implemented on the frontend, the API key will be open to anyone who could maliciously perform conversion events.

Sending Individual events

Check out the of our API docs to learn how to send trigger events to Fuul

The idea of the args is to add parameters to the event. The values can be strings, numbers, or booleans. The keys can be any string, but the most common ones are standardized.

  • value: an object with the amount and currency for the value (volume) of the transaction. By default, this is the value that will be used to calculate the variable payout.

  • revenue: an object with the amount and currency for the revenue value for the project. By default, this will be used for dashboard analytics. You can also set up to calculate variable payouts from this value on the app.

  • transaction_hash: the transaction hash of the event. This can be used when for any reason projects are reporting onchain events

  • token_id: the token id (if any) implicated in the event

  • chain_id: the chain id in which the event ocurred if it's an onchain event

  • github_username: the user's github username. This will be considerated as the user that acted when sending a github related trigger.

  • discord_username: the user's discord username. This will be considerated as the user that acted when sending a discord related trigger.

Here is an example on how to send the value and revenue objects which are key for variable payouts.

"args": {
    	"value": {
		"amount": "1000000", // 1 USDC
		"currency": { 
		    "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
		    "chain_id": 1
		}
	},
	"revenue": {
		"amount": "100000", // 1 USDC
		"currency": { 
		    "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
		    "chain_id": 1
		}
}

It’s crucial to ensure that the value parameters are correctly formatted.

The amount parameter on the valueandrevenue objects should be provided in the smallest possible unit of the respective currency. For Ethereum-based tokens, this unit is usually WEI.

Incorrect formatting may lead to unintended and potentially inaccurate results

Here's an example of sending a POINTs event:

"args": {
    	"value": {
		"amount": "1000000",
		"currency": { 
		    "name": "POINT"
		}
	}
}

Sending Batch Events

To send batched events, you have to build an array of the event objects constructed as shown above.

Check out the docs to learn how to send trigger events in batch to Fuul

βš™οΈ
Send event section
Send batch event section of our API