Skip to main content

ChatSessionMessage

A single message within a ChatSession. Embedded in ChatSession.messages, not a standalone MongoDB document. Source: hbf-core/src/main/java/gr/helvia/hbf/core/domain/ChatSessionMessage.kt TypeScript: hbf-core-api/src/datamodel/chat_session.ts

Fields

FieldTypeRequiredNotes
idStringnoUnique message identifier, set by hbf-bot
responseToIdStringnoID of the HBFEvent this bot response corresponds to
subscriberHandleStringnoHandle of the subscriber who sent this message
subscriberNameStringnoSubscriber's display name
subscriberEmailStringnoSubscriber's email
messageStringnoThe message text
tagsSet<String>noMessage-level tags
intentNameStringnoTriggered intent name
conversationNodeStringnoTriggered conversation node ID
typeChatSessionMessageTypenoDefault: TEXT
categoryChatSessionMessageCategorynoDefault: COMMON
dateDatenoTimestamp (stored as unix in TS)
isUserInteractionBooleannoWhether message was sent by a user
liveChatEventTypeLiveChatEventTypenoType of live chat event, if applicable
liveChatSenderLiveChatSendernoEND_USER or AGENT, for live chat messages
liveChatConversationIdStringnoLive chat conversation ID
languageStringnoLanguage used in this message

Enums

ChatSessionMessageType

ValueDescription
TEXTText message (default)
POSTBACKPostback from button click
ATTACHMENTFile or media attachment
TRIGGERSystem-generated trigger message

ChatSessionMessageCategory

ValueDescription
COMMONStandard message (default)
FEEDBACKUser feedback message
FALLBACKFallback/missed question
LIVE_CHATLive chat message
BACKBack navigation message

LiveChatEventType

See chat-session.md.

LiveChatSender

See chat-session.md.

Live Chat Message Patterns

DataCollector in hbf-bot writes messages during live chat with specific patterns. See docs/architecture/flows/live-chat.md for the full data flow.

LIVE_CHAT Category Messages

These represent live chat lifecycle events and message exchanges. Key field patterns:

liveChatEventTypeliveChatSendersubscriberHandlesubscriberNamesubscriberEmailisUserInteraction
LIVECHAT_INITIALIZEDEND_USERend-user DirectLine handleend-user name-false
LIVECHAT_REQUESTEDEND_USERend-user DirectLine handleend-user name-true
LIVECHAT_REQUEST_ACCEPTEDAGENTagent LCM participant IDagent full nameagent emailtrue
LIVECHAT_MESSAGE_EXCHANGEDAGENTagent LCM participant IDagent full nameagent emailtrue
LIVECHAT_MESSAGE_EXCHANGEDEND_USERend-user DirectLine handleend-user name-true
LIVECHAT_TERMINATEDAGENTagent LCM participant IDagent full nameagent emailtrue

COMMON Category Messages During Live Chat

Bot-generated messages (system announcements, redirect prompts) use category COMMON even when they occur during a live chat session:

  • "Great! I am forwarding your live-chat request." (handover confirmation)
  • "Live-chat started" / "Live-chat ended" (system markers)
  • Post-redirect messages (e.g., "Do you like chatbots?") after live chat terminates

These have subscriberName: "bot", no liveChatSender, and isUserInteraction: false.

messageCount vs messages.length

messageCount on the ChatSession does not equal messages.length. It counts a subset of messages (typically user-interaction-relevant messages). Expect messageCount < messages.length.

Relationships

  • Embedded in: ChatSession.messages (composition)
  • References: Subscriber (via subscriberHandle), ConversationNode (via conversationNode)

TypeScript Mapping

hbf-core (Kotlin)hbf-core-api (TypeScript)Notes
ChatSessionMessageChatSessionMessageDTOTS uses DTO suffix for read, ChatSessionMessageForm for write
ChatSessionMessageTypeChatSessionMessageTypeAligned
ChatSessionMessageCategoryChatSessionMessageCategoryAligned
date (Date)date (number)TS uses unix timestamp
tags (Set<String>)tags (string[] or null)TS allows null
language (String)language (LanguageCodes or null)TS uses enum type

ChatSessionMessageDTO (TypeScript read model)

FieldTypeNotes
idstring or null
responseToIdstring or nullOptional
typeChatSessionMessageTypeRequired in DTO
categoryChatSessionMessageCategoryRequired in DTO
isUserInteractionboolean or null
subscriberHandlestring or null
subscriberNamestringRequired in DTO
subscriberEmailstring or null
messagestring
tagsstring[] or null
intentNamestring or null
conversationNodestring or null
datenumberUnix timestamp
liveChatEventTypeLiveChatEventType or null
liveChatSenderLiveChatSender or null
liveChatConversationIdstringOptional
languageLanguageCodes or null

ChatSessionMessageForm (TypeScript write model)

FieldTypeNotes
idstringOptional
responseToIdstring or nullOptional
typeChatSessionMessageTypeOptional
categoryChatSessionMessageCategoryOptional
isUserInteractionbooleanOptional
subscriberHandlestringOptional
subscriberNamestringOptional
subscriberEmailstringOptional
messagestringRequired
intentNamestringOptional
conversationNodestringOptional
datenumberRequired
liveChatEventTypeLiveChatEventTypeOptional
liveChatSenderLiveChatSenderOptional
liveChatConversationIdstringOptional
languageLanguageCodesOptional