fix: persist session origin metadata

This commit is contained in:
Peter Steinberger
2026-01-18 03:40:35 +00:00
parent dad69afc84
commit 0d9172d761
13 changed files with 102 additions and 23 deletions

View File

@@ -1,3 +1,4 @@
import type { MsgContext } from "../../../auto-reply/templating.js";
import type { getReplyFromConfig } from "../../../auto-reply/reply.js";
import type { loadConfig } from "../../../config/config.js";
import { logVerbose } from "../../../globals.js";
@@ -94,6 +95,22 @@ export function createWebOnMessageHandler(params: {
}
if (msg.chatType === "group") {
const metaCtx = {
From: msg.from,
To: msg.to,
SessionKey: route.sessionKey,
AccountId: route.accountId,
ChatType: msg.chatType,
ConversationLabel: conversationId,
GroupSubject: msg.groupSubject,
SenderName: msg.senderName,
SenderId: msg.senderJid?.trim() || msg.senderE164,
SenderE164: msg.senderE164,
Provider: "whatsapp",
Surface: "whatsapp",
OriginatingChannel: "whatsapp",
OriginatingTo: conversationId,
} satisfies MsgContext;
updateLastRouteInBackground({
cfg: params.cfg,
backgroundTasks: params.backgroundTasks,
@@ -102,6 +119,7 @@ export function createWebOnMessageHandler(params: {
channel: "whatsapp",
to: conversationId,
accountId: route.accountId,
ctx: metaCtx,
warn: params.replyLogger.warn.bind(params.replyLogger),
});