Data Box - Technical Reference¶
Entities¶
1. DataBoxAccount¶
Represents a connection to an ISDS account.
* Scope: Administration
* Key Fields:
* login (Varchar): ISDS Login.
* password (Password): Encrypted password.
* dev (Boolean): Toggles between Production and Test environment endpoints.
* users (Link): Users authorized to use this account.
2. DataBoxMessage¶
Represents a single message (sent or received).
* Key Fields:
* dmId (Varchar): Unique ISDS Message ID.
* status (Enum): Draft, Sending, Sent, Delivered, Received.
* from (Varchar): Sender ID (ISDS ID).
* to (Varchar): Recipient ID.
* attachments (Link): Linked Attachment entities (files).
* dataBoxAccountId (Link): The account used for this message.
Service Architecture¶
Core Logic: Espo\Modules\DataBox\Tools\DataBox\Service¶
This service handles all interactions with the Czech Data Box API.
Methods¶
-
checkDataBox(string $id, int $daysBack = 90)- Orchestrator for synchronization. Calls
checkDataBoxReceivedandcheckDataBoxSent. - $id: ID of the
DataBoxAccount. - $daysBack: How far back to check for messages (default 90 days).
- Orchestrator for synchronization. Calls
-
createMessage(tRecord $messageRecord, ...)- Input:
tRecordobject (fromDefr\CzechDataBoxlibrary). - Process:
- Extracts metadata (Sender, Recipient, Annotation).
- Fetches attachments via
getReceivedDataMessageAttachmentsRaw. - Decodes base64 content and creates CRM
Attachmententities. - Creates
DataBoxMessageentity. - Calls
applyFilters()(custom logic hooks). - Calls
noteDataBoxMessageReceived()to update the Activity Stream.
- Input:
-
send(DataBoxMessage $message, User $user)- Process:
- Validates user permissions for the
DataBoxAccount. - Constructs
DataMessageobject. - Calls
api->sendDataMessage(). - Updates status to
Sent. - Adds "Sent" note to the Activity Stream.
- Validates user permissions for the
- Process:
-
noteDataBoxMessageReceived/Sent- Creates a
Noteentity linked to the parent record (e.g., Account, Contact). - Uses
DefaultParentFinderto determine which entity to link to (based on ISDS ID matching).
- Creates a
Integration Library¶
The module relies on the dfr/czech-data-box PHP library (wrapped in Espo\Modules\DataBox\Tools\CzechDataBox\DataBox).
- Namespace:
Defr\CzechDataBox\Api - Key Classes:
tRecord: Represents a message record.DataMessage: Represents the payload for sending.