|
| 1 | +--- |
| 2 | +sidebar_position: 7 |
| 3 | +slug: agent-bot-notifications |
| 4 | +title: Agent Bot Notifications |
| 5 | +description: Learn how to set up agent bot notifications for FAssets. |
| 6 | +tags: [intermediate, fassets, bitcoin, dogecoin] |
| 7 | +authors: [fassko] |
| 8 | +keywords: [fassets, xrp, btc, doge flare-network, flare-network] |
| 9 | +--- |
| 10 | + |
| 11 | +The agent bot can send notifications to a Telegram bot or API endpoint. |
| 12 | +It helps monitor the health of the agent and the network. |
| 13 | + |
| 14 | +## Agent Bot Notifications Configuration |
| 15 | + |
| 16 | +1. Add the following configuration to the `apiNotifierConfigs` list in the `config.json` file: |
| 17 | + |
| 18 | + ```json |
| 19 | + { |
| 20 | + "apiKey": "API_KEY", |
| 21 | + "apiUrl": "NOTIFICATIONS_API_URL", |
| 22 | + "level": "danger" |
| 23 | + } |
| 24 | + ``` |
| 25 | + |
| 26 | +2. The `apiKey` is sent in the header under `x-apikey`. |
| 27 | + The `level` field specifies the minimum level of alerts to send. |
| 28 | + If the `level` field is omitted, the bot will default it to `danger`. |
| 29 | + |
| 30 | +3. The `apiUrl` field specifies the URL to send the notifications to. |
| 31 | + The bot will send the notifications as POST requests to the `/api/agent/botAlert` endpoint. |
| 32 | + |
| 33 | +4. The agent bot can send notifications as POST requests to the endpoint `apiUrl/api/agent/botAlert` with the following body: |
| 34 | + |
| 35 | + ```typescript |
| 36 | + PostAlert = { |
| 37 | + bot_type: string, |
| 38 | + address: string, |
| 39 | + level: string, |
| 40 | + title: string, |
| 41 | + description: string, |
| 42 | + }; |
| 43 | + ``` |
| 44 | + |
| 45 | +## Telegram Notifications Alert Configuration |
| 46 | + |
| 47 | +1. Get the API key from the [FAssets Telegram Bot](http://t.me/FlareFAssetsSongbirdBot) by sending `/events` and selecting `Subscribe to Events`. |
| 48 | +2. Add the following configuration to the `apiNotifierConfigs` list in the `config.json` file, replacing `API_KEY` with the key obtained from the bot. |
| 49 | + |
| 50 | + ```json |
| 51 | + { |
| 52 | + "apiKey": "API_KEY", |
| 53 | + "apiUrl": "https://fasset-tg-bot-songbird.flare.network", |
| 54 | + "level": "danger" |
| 55 | + } |
| 56 | + ``` |
| 57 | + |
| 58 | + Notifications will only be sent out for `danger` and `critical` levels, regardless of the configured level. |
| 59 | + This is enforced by the Telegram bot, which ignores other events to prevent unnecessary HTTP requests. |
0 commit comments