feat(msteams): wire up proactive messaging in routeReply for queued replies

This commit is contained in:
Onur
2026-01-08 10:49:12 +03:00
committed by Peter Steinberger
parent 04b1eb57eb
commit d6256a388e

View File

@@ -10,6 +10,7 @@
import type { ClawdbotConfig } from "../../config/config.js";
import { sendMessageDiscord } from "../../discord/send.js";
import { sendMessageIMessage } from "../../imessage/send.js";
import { sendMessageMSTeams } from "../../msteams/send.js";
import { sendMessageSignal } from "../../signal/send.js";
import { sendMessageSlack } from "../../slack/send.js";
import { sendMessageTelegram } from "../../telegram/send.js";
@@ -54,7 +55,8 @@ export type RouteReplyResult = {
export async function routeReply(
params: RouteReplyParams,
): Promise<RouteReplyResult> {
const { payload, channel, to, accountId, threadId, abortSignal } = params;
const { payload, channel, to, accountId, threadId, cfg, abortSignal } =
params;
// Debug: `pnpm test src/auto-reply/reply/route-reply.test.ts`
const text = payload.text ?? "";
@@ -146,11 +148,13 @@ export async function routeReply(
}
case "msteams": {
// TODO: Implement proactive messaging for MS Teams
return {
ok: false,
error: `MS Teams routing not yet supported for queued replies`,
};
const result = await sendMessageMSTeams({
cfg,
to,
text,
mediaUrl,
});
return { ok: true, messageId: result.messageId };
}
default: {
@@ -203,7 +207,8 @@ export function isRoutableChannel(
| "discord"
| "signal"
| "imessage"
| "whatsapp" {
| "whatsapp"
| "msteams" {
if (!channel) return false;
return [
"telegram",
@@ -212,5 +217,6 @@ export function isRoutableChannel(
"signal",
"imessage",
"whatsapp",
"msteams",
].includes(channel);
}