Skip to main content

Triggers

Triggers are ways to start a workflow. They can be scheduled, or they can be triggered by an event.

  1. On-chain Events emitted by any smart contract.
  2. State changes of a variable on-chain.
  3. Webhooks sent by your app to us.

You can add triggers by calling .addTrigger on the execute app by passing a trigger from below.

const myapp = await app.addTrigger(triggers.eth.onEvent("", ""));

Lets discuss the different types of triggers available in execute ( we're constantly adding more )

onWebhook

You can connect your webhook url with execute app and make the webhook act as a trigger for the app.

const x = await app.addTrigger(triggers.onWebhook("webhook url"));

onEvent

You can listen to events emitted by contracts by simply adding an onEvent execute trigger on the app.

const x = await app.addTrigger(
triggers.eth.onEvent("contractAddress", "eventName"),
);

onMethodCall

You can trigger actions when a certain method is called on a contract ( example _mint)

const x = await app.addTrigger(
triggers.eth.onMethodCall("contractAddress", "_mint"),
);