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.ktTypeScript:hbf-core-api/src/datamodel/user.ts
Fields
| Field | Type | Required | Indexed | Notes |
|---|---|---|---|---|
id | String | yes | PK | MongoDB document ID |
handle | String | yes | yes (unique) | Platform-specific user identifier |
email | String | no | ||
fullName | String | no | ||
telephoneNumber | String | no | ||
country | String | no | ||
language | String | no | ||
discriminator | String | no | For identifying identical users across platforms | |
customData | BasicDBObject | no | Customer-specific fields | |
blackboard | Blackboard (BasicDBObject) | no | Runtime state/data storage | |
tenant | Tenant | yes | yes | @DBRef lazy |
activeAt | Date | no | Last activity timestamp | |
createdAt | Date | yes | yes | @CreatedDate |
updatedAt | Date | yes | @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
- Equality:
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 |
|---|---|---|
| Subscriber | Subscriber | Aligned. TS omits country, activeAt, createdAt, updatedAt. TS has tenant as optional |
| (not in Kotlin) | SubscriberForm | TS 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>) |