Management API Reference

Notifications

Get notified about events happening in Openfort or on-chain.

Why use notifications?#

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 a notification#

Notification objects are the core of the notification system. They define the name of the notification 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"

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.
  • Developer account balance trigger: Check for the balance of a developer account and compare it to a threshold. This is useful when you're using a developer account itself is paying for the gas fees of the transactions it puts on-chain.

There can be more than one notification trigger per notification.

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 notification.

There are 3 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 notification.

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'