How to Set Up A Forta Alert Notification Using Defender

OpenZeppelin Defender Sentinels come in two types. Whereas Contract Sentinels are best for monitoring transactions based on attributes for a given contract address, Forta Bots offer a broader and more complex range of possibilities for monitoring one or more contracts.

Using the Forta Explorer, you can easily receive alerts via email, Slack, or Discord by connecting your wallet address and selecting a given bot.

Defender gives you the opportunity to fine-tune Forta Alerts, group related ones together, and manage them along with other smart contract functionality via the Defender dashboard.

Create A Forta Sentinel

Once logged in to Defender, navigate to Sentinel and select Create Sentinel.

Under Sentinel Type, select Forta.

Give your Sentinel a descriptive name. This name will be included in whatever alert notifications you choose to set up in the later steps.

You can leave the network selection to All Networks or if you would like to specify only a single network to receive notifications for, select the network name from the dropdown.

A given Sentinel can be set up to monitor a single address or multiple addresses. If the address has already been saved and named using Admin, simply select the address name from the dropdown list. Otherwise, paste the contract address in the field.

Specify the Forta Agent

New Forta bots are being added ongoingly by members of the community. You can browse curated bots grouped based on category by visiting the excellent Forta documentation and selecting Threat Detection Kits.

Once there, you can select the appropriate category from the list. For curated bots based on NFT security, select NFT Threat Detection Kit.

Select the specific agent bot: NFT Sleep Minting Detection Bot Details

Select Stats URL then copy the Bot ID.

Back in Defender, paste the Bot ID in the Monitored Agent IDs section. To select more than one, simply separate each Bot ID with a comma. Selecting multiple bots can allow you to easily group alert notifications for a variety of related conditions.

Under Alert Conditions, select the severity level you would like the alert to be triggered for. You can check out any previous alerts that have been fired for the bot you specified under the Alerts section of Forta Explorer.

Forta attempts to run each bot on multiple scanners. If alert timing is critical, leaving the Minimum Scanner Confirmations at 1 will cause it to trigger as soon as the first alert is received. If the validity of the alert is more critical than speed, consider setting the minimum confirmations to a higher number so that a given alert requires the consensus of multiple scanners.

Specifying an Alert ID will cause the alert to fire in the event of a match between both the Agent (Bot) ID and the selected Alert ID. See Forta Matching Rules for more details.

The final section is for Autotasks. If you would like the firing of this Sentinel to be further filtered based on a bit of custom logic, this is where to specify the Autotask that accomplishes that.

Select Next.

On the next screen, you will see the options for where you would like the notifications to be sent.

You are also able to customize the notification body if, for example, you would like the alert to be shorter or include more descriptive information, hyperlinks, or specific elements based on dynamic content.

If you are monitoring a condition that is likely to fire more frequently than you would like to deal with, you can throttle the notifications so that an alert only fires after a given number of matches occur in the specified span of time. You can also supply a timeout that prevents notifications from being sent more frequently than the interval you specify (in seconds).

That's it! That's all it takes to integrate a Forta Alert notification with Defender Sentinel.

3 Likes