⚙ī¸Sending Custom Events through the API

This guide shows how to send trigger events through the API

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

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",
		"currency": { 
		    "name": "USDC",
		    "chain_id": 1
		}
	},
	"revenue": {
		"amount": "100000",
		"currency": { 
		    "name": "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"
		}
	}
}

Accepted currencies list

These are the accepted currencies:

  • ETH

  • USDC

  • USDT

  • DAI

  • BTC

  • MATIC (Polygon)

  • OP

  • ARB

  • LINK

  • POINT (if the event amount is points)

Sending Batch Events

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

Check out the Send batch event section of our API docs to learn how to send trigger events in batch to Fuul

Last updated