Use this file to discover all available pages before exploring further.
Your compose tasks can be triggered by several different mechanisms. Triggers are configured in your manifest file for each task.
Each task can have multiple triggers (one of each type), so triggers are configured as an array. Below is an overview of all the supported trigger types: cron, http, and onchain_event.
For locally testing tasks you can use the callTask CLI command. This works regardless of what trigger types a task has configured (and even for tasks with no triggers at all).
import { TaskContext } from "compose";type Payload = { foo: string;};export async function main({ collection }: TaskContext, payload: Payload) { // the task will be called with the payload sent from the CLI callTask command console.log(payload.foo);}
Tasks can be triggered by onchain events. The payload delivered to the task is the raw encoded log. Compose provides helpers for decoding the event in your task code — see Contracts for more details on decoding.
Onchain event triggers only fire when your app is deployed to the cloud. They do not fire during local development.
To test a task with an onchain trigger locally, use callTask with a sample event payload:
Here’s an example in which we decode the event with a contract class we’ve generated with goldsky compose codegen, see Contracts for more info.
import { TaskContext, OnchainEvent } from "compose";// the payload for an onchain triggered task will always be our built in OnchainEvent interfaceexport async function main({ evm }: TaskContext, payload: OnchainEvent) { // we can decode the event with our ABI generated contract class // the type of this decodedEvent will be a union of all events that the ABI specifies, allowing you to conditionally process based on the eventName const decodedEvent = evm.contracts.MyNFT.decodeEventLog(payload); if (decodedEvent.eventName === "Transfer") { // in this code block typescript will know the decodedEvent is of type TransferEventDecoded // this pattern is useful when your trigger supports multiple event types console.log("Transfer event:", decodedEvent.args); } // alternative would be to cast, this is useful if your trigger is configured for a single event type const castEvent = evm.contracts.MyNFT.decodeEventLog<TransferEventDecoded>(payload);}
The network slug in snake_case (e.g. base_sepolia, ethereum_mainnet). See Chains for the full list.
contract
string
Yes
The contract address (0x followed by 40 hex characters).
events
string[]
No
Specific event signatures (human-readable, not encoded) to match — e.g. "Transfer(address,address,uint256)". If omitted, all logs from the contract are delivered.
dataset_version
string
No
Override the dataset version for chains that don’t use 1.0.0 (e.g., megaeth_testnet_v2). If not specified, the server auto-detects the correct version.
Onchain-triggered tasks honor the task’s retry_config. When a task throws (or otherwise fails), Compose retries it up to max_attempts with the configured backoff. If every attempt fails, that event is dropped and the pipeline advances to the next one — it is not replayed.This means an unhandled exception in an onchain-triggered task only stalls delivery for the duration of your retry window, not indefinitely. If you want a failure to be visible without consuming retries, catch the error in your task and return normally — the run is recorded as successful and the pipeline moves on.
Tasks can be triggered by HTTP requests. This is often used to kick off compose tasks from your application logic. HTTP triggers accept any JSON payload you want for dynamic execution.
The minimum RBAC role required to call the endpoint (only applies when authentication is "auth_token"). Defaults to "Viewer" (any team member).
ip_whitelist
string[]
No
Restrict access to specific IPs. Supports IPv4, IPv6, and CIDR notation (e.g. ["192.168.1.0/24", "10.0.0.1"]).
Authenticated triggers require a Goldsky API token when the app is deployed, but can be called without auth when testing locally. Unauthenticated triggers can be called without auth both locally and when deployed.