From 4200a79982f848f9116ed72d63e2175e18ad76d0 Mon Sep 17 00:00:00 2001 From: Kristaps Grinbergs Date: Mon, 20 Jan 2025 17:08:33 +0200 Subject: [PATCH 1/5] feat(docs): reshape agent bot notifications guide to make it generic --- .../guides/7-agent-bot-notifications.mdx | 59 +++++++++++++++++++ .../guides/7-telegram-bot-notifications.mdx | 24 -------- 2 files changed, 59 insertions(+), 24 deletions(-) create mode 100644 docs/fassets/guides/7-agent-bot-notifications.mdx delete mode 100644 docs/fassets/guides/7-telegram-bot-notifications.mdx diff --git a/docs/fassets/guides/7-agent-bot-notifications.mdx b/docs/fassets/guides/7-agent-bot-notifications.mdx new file mode 100644 index 00000000..c6a5602d --- /dev/null +++ b/docs/fassets/guides/7-agent-bot-notifications.mdx @@ -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. diff --git a/docs/fassets/guides/7-telegram-bot-notifications.mdx b/docs/fassets/guides/7-telegram-bot-notifications.mdx deleted file mode 100644 index 11ac1c6f..00000000 --- a/docs/fassets/guides/7-telegram-bot-notifications.mdx +++ /dev/null @@ -1,24 +0,0 @@ ---- -sidebar_position: 7 -slug: telegram-bot-notifications -title: Telegram Bot Notifications -description: Set up a Telegram bot to receive notifications -tags: [intermediate, fassets, bitcoin, dogecoin] -authors: [fassko] -keywords: [fassets, xrp, btc, doge flare-network, flare-network] ---- - -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" - } - ``` - -:::info -Please note that 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. -::: From 444afb0b68b0f00352506a74788271dda77b66fb Mon Sep 17 00:00:00 2001 From: Kristaps Grinbergs Date: Mon, 20 Jan 2025 17:10:37 +0200 Subject: [PATCH 2/5] fix(docs): clarify default alert level in agent bot notifications guide --- docs/fassets/guides/7-agent-bot-notifications.mdx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/fassets/guides/7-agent-bot-notifications.mdx b/docs/fassets/guides/7-agent-bot-notifications.mdx index c6a5602d..528da7a1 100644 --- a/docs/fassets/guides/7-agent-bot-notifications.mdx +++ b/docs/fassets/guides/7-agent-bot-notifications.mdx @@ -23,6 +23,8 @@ It helps monitor the health of the agent and the network. } ``` + If the level field is ommited inside configuration, the bot will default it to `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`. From 369f041e93fc00c038d3d516fbbce24c48acaa0c Mon Sep 17 00:00:00 2001 From: Kristaps Grinbergs Date: Mon, 20 Jan 2025 17:14:06 +0200 Subject: [PATCH 3/5] fix(docs): correct typo in agent bot notifications guide --- docs/fassets/guides/7-agent-bot-notifications.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/fassets/guides/7-agent-bot-notifications.mdx b/docs/fassets/guides/7-agent-bot-notifications.mdx index 528da7a1..f71559d2 100644 --- a/docs/fassets/guides/7-agent-bot-notifications.mdx +++ b/docs/fassets/guides/7-agent-bot-notifications.mdx @@ -23,7 +23,7 @@ It helps monitor the health of the agent and the network. } ``` - If the level field is ommited inside configuration, the bot will default it to `danger`. + If the level field is omitted inside configuration, the bot will default it to `danger`. 2. The `apiKey` is sent in the header under `x-apikey`. The `level` field specifies the minimum level of alerts to send. From e98215cfd42074cc3e8ce4ba5003d5ce9a0634ca Mon Sep 17 00:00:00 2001 From: Kristaps Grinbergs Date: Mon, 20 Jan 2025 19:49:07 +0200 Subject: [PATCH 4/5] fix(docs): update agent bot notifications guide for clarity and accuracy --- docs/fassets/guides/7-agent-bot-notifications.mdx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/docs/fassets/guides/7-agent-bot-notifications.mdx b/docs/fassets/guides/7-agent-bot-notifications.mdx index f71559d2..c0e48f0f 100644 --- a/docs/fassets/guides/7-agent-bot-notifications.mdx +++ b/docs/fassets/guides/7-agent-bot-notifications.mdx @@ -17,21 +17,22 @@ It helps monitor the health of the agent and the network. ```json { - "apiKey": "API_KEY", "apiUrl": "NOTIFICATIONS_API_URL", + "apiKey": "API_KEY", + "level": "danger" } ``` If the level field is omitted inside configuration, the bot will default it to `danger`. -2. The `apiKey` is sent in the header under `x-apikey`. +2. 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. + +3. 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 @@ -44,7 +45,7 @@ It helps monitor the health of the agent and the network. }; ``` -## Telegram Notifications Alert Configuration +## Flare Hosted 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. @@ -58,4 +59,4 @@ It helps monitor the health of the agent and the network. ``` 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. + This is enforced by the Telegram bot, which delivers priority messages due to heavy load. From 21814e3ebfb267b28478331c19b0e94cdeef2670 Mon Sep 17 00:00:00 2001 From: Kristaps Grinbergs Date: Tue, 21 Jan 2025 09:58:43 +0200 Subject: [PATCH 5/5] fix(docs): remove redundant line in agent bot notifications guide --- docs/fassets/guides/7-agent-bot-notifications.mdx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/fassets/guides/7-agent-bot-notifications.mdx b/docs/fassets/guides/7-agent-bot-notifications.mdx index c0e48f0f..5b7dc7ef 100644 --- a/docs/fassets/guides/7-agent-bot-notifications.mdx +++ b/docs/fassets/guides/7-agent-bot-notifications.mdx @@ -19,7 +19,6 @@ It helps monitor the health of the agent and the network. { "apiUrl": "NOTIFICATIONS_API_URL", "apiKey": "API_KEY", - "level": "danger" } ``` @@ -52,8 +51,8 @@ It helps monitor the health of the agent and the network. ```json { - "apiKey": "API_KEY", "apiUrl": "https://fasset-tg-bot-songbird.flare.network", + "apiKey": "API_KEY", "level": "danger" } ```