Add embeddable chat widget for websites

Reuses the existing portal-token/SSE mechanism (customers.portalToken,
/api/portal/events) for anonymous widget visitors instead of building a
parallel auth system. Public API: session bootstrap + messages endpoint,
both scoped by a non-secret siteKey with optional origin allowlist.
Embeddable script (public/widget.js) is a small self-contained vanilla JS
file: floating button + iframe kept mounted for a live SSE connection,
with a postMessage bridge for the unread badge. Admin UI at
Settings -> Виджет manages sites and shows the embed snippet.

Also generalized recordTelegramInboundMessage -> recordChatInboundMessage
(channel param) since Telegram and the widget need the identical
find-or-create-open-ticket heuristic.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QcXH24ky6zjk2UyK5oZUPH
This commit is contained in:
ogrechkoandClaude Sonnet 5 committed 2026-07-26 13:34:08 +00:00
1 parent 59e6c32d79
commit 4efce5f307
19 files changed
+1267 -14

No files matched your search

+7
View File
@@ -15,6 +15,13 @@
"when": 1785070407727,
"tag": "0001_mushy_purple_man",
"breakpoints": true
},
{
"idx": 2,
"version": "6",
"when": 1785072485453,
"tag": "0002_broad_stellaris",
"breakpoints": true
}
]
}