Add Telegram avatar proxy and realtime CRM websocket updates

This commit is contained in:
Ruslan Bakiev
2026-02-23 08:09:53 +07:00
parent f81a0fde55
commit 0f1028b0fa
5 changed files with 412 additions and 4 deletions

View File

@@ -72,6 +72,12 @@ type ContactProfile = {
avatarUrl: string | null;
};
function toTelegramAvatarProxyUrl(externalContactId: string) {
const id = String(externalContactId ?? "").trim();
if (!/^\d+$/.test(id)) return null;
return `/api/omni/telegram/avatar/${id}`;
}
function buildContactProfile(
normalized: OmniInboundEnvelopeV1["payloadNormalized"],
externalContactId: string,
@@ -99,7 +105,7 @@ function buildContactProfile(
return {
displayName,
avatarUrl: asString(normalized.contactAvatarUrl),
avatarUrl: asString(normalized.contactAvatarUrl) ?? toTelegramAvatarProxyUrl(externalContactId),
};
}