fix(outbound): guard optional delivery fields

This commit is contained in:
Peter Steinberger
2026-01-07 02:19:09 +00:00
parent 59502552ae
commit 3fedd0d1d5

View File

@@ -56,10 +56,18 @@ export function buildOutboundDeliveryJson(params: {
mediaUrl: params.mediaUrl ?? null,
};
if (result?.chatId !== undefined) payload.chatId = result.chatId;
if (result?.channelId !== undefined) payload.channelId = result.channelId;
if (result?.timestamp !== undefined) payload.timestamp = result.timestamp;
if (result?.toJid !== undefined) payload.toJid = result.toJid;
if (result && "chatId" in result && result.chatId !== undefined) {
payload.chatId = result.chatId;
}
if (result && "channelId" in result && result.channelId !== undefined) {
payload.channelId = result.channelId;
}
if (result && "timestamp" in result && result.timestamp !== undefined) {
payload.timestamp = result.timestamp;
}
if (result && "toJid" in result && result.toJid !== undefined) {
payload.toJid = result.toJid;
}
return payload;
}