Skip to main content

Subscriber

An end-user of a bot, identified by a platform-specific handle. Stores blackboard state and custom data. Collection: subscribers | DB: MongoDB Source: hbf-core/src/main/java/gr/helvia/hbf/core/domain/Subscriber.kt TypeScript: hbf-core-api/src/datamodel/user.ts

Fields

FieldTypeRequiredIndexedNotes
idStringyesPKMongoDB document ID
handleStringyesyes (unique)Platform-specific user identifier
emailStringno
fullNameStringno
telephoneNumberStringno
countryStringno
languageStringno
discriminatorStringnoFor identifying identical users across platforms
customDataBasicDBObjectnoCustomer-specific fields
blackboardBlackboard (BasicDBObject)noRuntime state/data storage
tenantTenantyesyes@DBRef lazy
activeAtDatenoLast activity timestamp
createdAtDateyesyes@CreatedDate
updatedAtDateyes@LastModifiedDate

Blackboard

The Blackboard is a key-value store (BasicDBObject) used for persisting data between conversation nodes. It supports:

  • Path-based access (e.g., foo.bar.baz)
  • Query language (LIQE syntax):
    • Equality: foo.bar:baz
    • Comparison: foo.bar:>4, foo.bar:>=5, foo.bar:<10
    • Boolean operators: OR, AND, NOT
    • DNF (Disjunctive Normal Form) evaluation

TypeScript Blackboard interface provides methods: setValue, updateValue, incrementValue, getValue, deleteValue, hasChanged, trimArray, hasIn, toJSON.

Relationships

  • Belongs to: Tenant (via @DBRef)
  • Referenced by: ChatSession (via subscriberHandle string)
  • Referenced by: Survey (via subscriber string ID)
  • Can be in: Group (via subscribers set of IDs)
  • Targeted by: Broadcast (via Group membership)

TypeScript Mapping

hbf-core (Kotlin)hbf-core-api (TypeScript)Notes
SubscriberSubscriberAligned. TS omits country, activeAt, createdAt, updatedAt. TS has tenant as optional
(not in Kotlin)SubscriberFormTS write model with tenantId string
Blackboard (BasicDBObject)Blackboard (interface)TS defines method signatures. Kotlin uses BasicDBObject with utility functions
customData (BasicDBObject)customData (Record<string, string>)TS restricts to string values
blackboard (BasicDBObject)blackboard (Record<string, any>)