Management API Reference

Dashboard

Events

Get notified about events happening in Openfort and onchain.

Why use events?#

When building Openfort integrations, you might want your applications to receive events as they occur in your Openfort accounts, so that your backend systems can execute actions accordingly.

You can configure notifications via the API to be notified about events that happen in your Openfort account or on-chain.

By default, Openfort will send a notification to the specified subscriptions every 24 hours.

Create an event#

Notification objects are the core of the event system. They define the name of the event and encapsulate both the trigger and subscriptions.

command-line

_10
curl https://api.openfort.xyz/v1/notifications/ \
_10
-H "Authorization: Bearer $YOUR_SECRET_KEY" \
_10
-d "name=Low balance"

You can also configure events directly from your dashboard.

Create a trigger#

Triggers define the condition that will trigger the notification.

There are 3 available triggers:

  • Project balance trigger: Define a threshold balance of credits in your project. This is useful to control you can continue to sponsor gas fees for your users.
  • Contract balance trigger: Check for the returned parameter of a contract call and compare it to a threshold. This is useful to control the deposited amount in a paymaster contract.
  • Backend wallet balance trigger: Check for the balance of a backend wallet and compare it to a threshold. This is useful when you're using a backend wallet itself is paying for the gas fees of the transactions it puts onchain.

There can be more than one notification trigger per event.

command-line

_10
curl https://api.openfort.xyz/v1/notification_triggers \
_10
-u "$YOUR_SECRET_KEY:" \
_10
-d 'notification=not_e0b84653-1741-4a3d-9e91-2b0fd2942f60' \
_10
-d 'type=project_balance_trigger' \
_10
-d 'threshold=1000000000'

Create a subscription#

Subscriptions define the method and target of the event.

There are 2 available subscription methods:

  • Email: Send an email to the specified target.
  • Webhook: Send a POST request to the specified target. To learn more about receiving webhooks, check out the webhooks guide and the types notification.developer_account.balance, notification.contract.balance or notification.project.balance.

There can be more than one notification subscription per event.

command-line

_10
curl https://api.openfort.xyz/v1/notification_subscriptions \
_10
-u "$YOUR_SECRET_KEY:" \
_10
-d 'notification=not_e0b84653-1741-4a3d-9e91-2b0fd2942f60' \
_10
-d 'method=Email' \
_10
-d 'target=jaume@openfort.xyz'