Skip to content

Commit

Permalink
feat(docs): reshape agent bot notifications guide to make it generic
Browse files Browse the repository at this point in the history
  • Loading branch information
fassko committed Jan 20, 2025
1 parent f86998f commit 4200a79
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 24 deletions.
59 changes: 59 additions & 0 deletions docs/fassets/guides/7-agent-bot-notifications.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
sidebar_position: 7
slug: agent-bot-notifications
title: Agent Bot Notifications
description: Learn how to set up agent bot notifications for FAssets.
tags: [intermediate, fassets, bitcoin, dogecoin]
authors: [fassko]
keywords: [fassets, xrp, btc, doge flare-network, flare-network]
---

The agent bot can send notifications to a Telegram bot or API endpoint.
It helps monitor the health of the agent and the network.

## Agent Bot Notifications Configuration

1. Add the following configuration to the `apiNotifierConfigs` list in the `config.json` file:

```json
{
"apiKey": "API_KEY",
"apiUrl": "NOTIFICATIONS_API_URL",
"level": "danger"
}
```

2. The `apiKey` is sent in the header under `x-apikey`.
The `level` field specifies the minimum level of alerts to send.
If the `level` field is omitted, the bot will default it to `danger`.

3. The `apiUrl` field specifies the URL to send the notifications to.
The bot will send the notifications as POST requests to the `/api/agent/botAlert` endpoint.

4. The agent bot can send notifications as POST requests to the endpoint `apiUrl/api/agent/botAlert` with the following body:

```typescript
PostAlert = {
bot_type: string,
address: string,
level: string,
title: string,
description: string,
};
```

## Telegram Notifications Alert Configuration

1. Get the API key from the [FAssets Telegram Bot](http://t.me/FlareFAssetsSongbirdBot) by sending `/events` and selecting `Subscribe to Events`.
2. Add the following configuration to the `apiNotifierConfigs` list in the `config.json` file, replacing `API_KEY` with the key obtained from the bot.

```json
{
"apiKey": "API_KEY",
"apiUrl": "https://fasset-tg-bot-songbird.flare.network",
"level": "danger"
}
```

Notifications will only be sent out for `danger` and `critical` levels, regardless of the configured level.
This is enforced by the Telegram bot, which ignores other events to prevent unnecessary HTTP requests.
24 changes: 0 additions & 24 deletions docs/fassets/guides/7-telegram-bot-notifications.mdx

This file was deleted.

0 comments on commit 4200a79

Please sign in to comment.