feat(msteams): add outbound sends and fix reply delivery

- Add sendMessageMSTeams for proactive messaging via CLI/gateway
- Wire msteams into outbound delivery, heartbeat targets, and gateway send
- Fix reply delivery to use SDK's getConversationReference() for proper
  bot info, avoiding "Activity Recipient undefined" errors
- Use proactive messaging for replies to post as top-level messages
  (not threaded) by omitting activityId from conversation reference
- Add lazy logger in send.ts to avoid test initialization issues
This commit is contained in:
Onur
2026-01-08 03:22:16 +03:00
committed by Peter Steinberger
parent 2c7d5c82f3
commit 269a3c4000
7 changed files with 340 additions and 33 deletions

View File

@@ -2,6 +2,7 @@ import { loadConfig } from "../../config/config.js";
import { sendMessageDiscord, sendPollDiscord } from "../../discord/index.js";
import { shouldLogVerbose } from "../../globals.js";
import { sendMessageIMessage } from "../../imessage/index.js";
import { sendMessageMSTeams } from "../../msteams/send.js";
import { sendMessageSignal } from "../../signal/index.js";
import { sendMessageSlack } from "../../slack/send.js";
import { sendMessageTelegram } from "../../telegram/send.js";
@@ -141,6 +142,26 @@ export const sendHandlers: GatewayRequestHandlers = {
payload,
});
respond(true, payload, undefined, { provider });
} else if (provider === "msteams") {
const cfg = loadConfig();
const result = await sendMessageMSTeams({
cfg,
to,
text: message,
mediaUrl: request.mediaUrl,
});
const payload = {
runId: idem,
messageId: result.messageId,
conversationId: result.conversationId,
provider,
};
context.dedupe.set(`send:${idem}`, {
ts: Date.now(),
ok: true,
payload,
});
respond(true, payload, undefined, { provider });
} else {
const cfg = loadConfig();
const targetAccountId =