omni-notify-mcp 1.3.22 → 1.3.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,6 @@
1
+ export async function telegramSendErrorHint(r) {
2
+ if (r.status === 401) {
3
+ return "the bot token is invalid or has been revoked — open @BotFather, check the bot behind this token (or create a new one), and update it in the settings UI";
4
+ }
5
+ return r.text();
6
+ }
package/dist/ui/server.js CHANGED
@@ -13,6 +13,7 @@ import nodemailer from "nodemailer";
13
13
  import { PinpointSMSVoiceV2Client, SendTextMessageCommand, DescribePhoneNumbersCommand, DescribeVerifiedDestinationNumbersCommand } from "@aws-sdk/client-pinpoint-sms-voice-v2";
14
14
  import { tmpdir } from "os";
15
15
  import { sendWithRouting, idleReading, formatIdleReading, describePriorityRouting } from "./messaging/notificationEngine.js";
16
+ import { telegramSendErrorHint } from "./messaging/telegramError.js";
16
17
  import { z } from "zod";
17
18
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
18
19
  import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
@@ -554,7 +555,7 @@ app.post("/api/test/telegram", async (_req, res) => {
554
555
  if (r.ok)
555
556
  sent++;
556
557
  else
557
- errors.push(`${chatId}: ${r.status} ${await r.text()}`);
558
+ errors.push(`${chatId}: ${await telegramSendErrorHint(r)}`);
558
559
  }
559
560
  catch (err) {
560
561
  errors.push(`${chatId}: ${err instanceof Error ? err.message : String(err)}`);
@@ -1510,10 +1511,11 @@ async function sendNotification(message, priority, client) {
1510
1511
  headers: { "Content-Type": "application/json" },
1511
1512
  body: JSON.stringify(body),
1512
1513
  });
1513
- if (r.ok)
1514
+ if (r.ok) {
1514
1515
  sent++;
1515
- else
1516
- errors.push(`${chatId}: ${await r.text()}`);
1516
+ continue;
1517
+ }
1518
+ errors.push(`${chatId}: ${await telegramSendErrorHint(r)}`);
1517
1519
  }
1518
1520
  if (sent === 0 && errors.length)
1519
1521
  throw new Error(errors.join("; "));
@@ -2835,6 +2837,10 @@ function createMcpServer(clientId, sessionTag) {
2835
2837
  ? `\n\nReply with: @${sessionTag} <your answer>`
2836
2838
  : `\n\nReply to this message with your answer.`;
2837
2839
  for (const chatId of cfg.telegram.chatIds) {
2840
+ // A non-2xx Telegram response does NOT reject this fetch — only a
2841
+ // network-level failure does — so this used to silently do nothing
2842
+ // on e.g. a revoked token: no error, no log line, just a question
2843
+ // the user never saw and no clue why. Story #443: check r.ok too.
2838
2844
  await fetch(`https://api.telegram.org/bot${cfg.telegram.token}/sendMessage`, {
2839
2845
  method: "POST",
2840
2846
  headers: { "Content-Type": "application/json" },
@@ -2842,7 +2848,10 @@ function createMcpServer(clientId, sessionTag) {
2842
2848
  chat_id: chatId,
2843
2849
  text: `${askPrefix} ${question}${replyHint}`,
2844
2850
  }),
2845
- }).catch((err) => log("→", "ask:telegram", `ERROR: ${err}`, clientId));
2851
+ })
2852
+ .then(async (r) => { if (!r.ok)
2853
+ log("→", "ask:telegram", `ERROR: ${chatId}: ${await telegramSendErrorHint(r)}`, clientId); })
2854
+ .catch((err) => log("→", "ask:telegram", `ERROR: ${chatId}: ${err}`, clientId));
2846
2855
  }
2847
2856
  }
2848
2857
  const email = cfg.email ?? {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omni-notify-mcp",
3
- "version": "1.3.22",
3
+ "version": "1.3.23",
4
4
  "description": "Reach your AI agents from anywhere — and let them reach you. Every notification channel is set up in one config UI with one-click server launch: desktop, Telegram, Slack, SMS, email, ntfy. Agents then notify you when long work finishes or a decision is needed, ask you a question and wait for your answer, and receive and reply to the messages you send them — with Do Not Disturb and idle detection deciding what actually gets through.",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",