API · v1 · stabil
CODEMETA OSDeveloper Center
Konsole öffnen
Entity · messages

Message Schema

Schema-ID
message
Collection
messages
Permissions
  • Lesenmessage_view
  • Anlegenmessage_create
  • Ändernmessage_edit
  • Löschenmessage_delete
Beziehungen

Felder

Message Schema

messages4 Permissions

Schema for validating message entities (email, comment, internal note)

ticketIdstringoptional

Associated ticket ID

min 1 Zeichen
entityIdstringoptional

Generic entity ID this message belongs to (for non-ticket entities)

min 1 Zeichen
entityTypestringoptional

Entity type this message belongs to (e.g. sales_order, purchase_order)

min 1 Zeichen
isInternalbooleanoptional

Whether this is an internal note

messageTypestringerforderlich

Type of message

EMAILCOMMENTINTERNAL_NOTE
statusstringerforderlich

Current message status

DRAFTSENTSEND_FAILEDRECEIVEDSCHEDULED
sendAtdatetimeoptional

For SCHEDULED outbound messages (WP-U6, ADR 0324): the ISO timestamp at which the delayed send job should run. Null/absent for all other messages.

nullable
directionstringoptional

Message direction

inboundoutbound
fromstringoptional

Sender email address

emailAccountIdstringoptional

Sender mailbox (`email_accounts._id`) for outbound EMAIL messages. Set by composers that offer an account selection; the DRAFT→SENT transition hook sends through exactly this account (and fails visibly when it is unavailable) instead of falling back to an arbitrary tenant mailbox. On send the hook stamps the account that was ACTUALLY used, so older messages / comment-path messages without a selection carry the resolved one. Additive field — sanctioned by the OCTOJA contract note above; absent on old documents.

nullable
tooneOfoptional

Recipient email address(es)

cconeOfoptional

CC email address(es)

bcconeOfoptional

BCC email address(es)

attachmentsobject[]optional

File attachments referenced by file ID (resolved on send). Inbound EMAIL copies additionally carry `size`/`contentId`/`inline` (ADR 0306): `contentId` maps an inline image's `cid:` reference to its persisted email attachment for render-time resolution.

fileIdstringoptional
filenamestringoptional
mimeTypestringoptional
sizeBytesnumberoptional
sizenumberoptional
urlstringoptional
nullable
contentIdstringoptional
nullable
inlinebooleanoptional
nullable
subjectstringoptional

Message subject

max 1000 Zeichen
bodystringoptional

Plain text body

bodyI18nKeystringoptional

i18n key the client resolves INSTEAD of `body` for system-generated notes. `body` remains the English fallback.

nullable
bodyI18nParamsobjectoptional

Interpolation values for `bodyI18nKey` (e.g. { ticketNumber: "T-2026-00042" }).

nullable
htmlBodystringoptional

HTML body

nullable
aiSummarystringoptional

AI-generated 2-3 sentence summary of an inbound EMAIL (signatures/quotes stripped). Populated best-effort when AI is active for the tenant; null otherwise. Used as the ticket/activity timeline preview instead of the raw body.

nullable
aiSummaryAttemptedAtdatetimeoptional

Set by the worker when a lazy on-open summarization ran for an imported message (TANSS migration) — even when the LLM returned nothing (AI off, body too short). Prevents the feed trigger from re-enqueuing the same message on every load. Live-ingested emails do not carry this field.

nullable
sentAtdatetimeoptional

When the message was sent

nullable
sendErrorobjectoptional

Why the last outbound send attempt failed. Written when an async send hook throws; cleared when a later attempt succeeds. Absent on messages that failed before EM-012 — treat as "cause unknown", never as "no error".

read-onlynullable
sendAttemptsnumberoptional

How many send attempts this message has had (initial send + resends). Absent on pre-EM-012 documents — read as 1, since reaching SEND_FAILED implies one attempt.

read-only
lastSendAttemptAtdatetimeoptional

Start of the most recent send attempt, successful or not.

read-onlynullable
sendInProgressbooleanoptional

Time-boxed in-flight lock for the resend endpoint, mirroring the inbound conversion lock (ADR 0231): set before the provider call, cleared after it. A stale lock (older than the lock window) is ignored, so a crashed API process cannot strand a message as permanently un-resendable.

read-only
sendStartedAtdatetimeoptional

When the in-flight lock was taken — basis for the lock expiry.

read-onlynullable
receivedAtdatetimeoptional

When the message was received

nullable
emailMessageIdstringoptional

Email Message-ID from the provider

nullable
emailDocIdstringoptional

For inbound EMAIL copies: the `email_messages._id` this message was created from (ADR 0306). The web app uses it together with the attachments' contentId to resolve inline `cid:` images via GET /email-inbox/:id/attachments/:fileId/content.

nullable
extMessageIdstringoptional

External message ID for sync deduplication (e.g., TANSS history item ID)

nullable
authorNamestringoptional

Denormalized display name of the original author, written by the TANSS mirror (ADR 0443). Mirrored rows carry the sync actor as createdBy (never the source author) and many source authors have no Codemeta user at all (ex-employees, system entries) — feeds and the timeline enrichment use a present authorName as-is instead of resolving createdBy. Locally created messages leave it unset and resolve via createdBy.

nullable
sourcestringoptional

Origin system marker (e.g. 'TANSS'). Set by the migration import and the live mirror (ADR 0443); together with entity-config externalMaster it makes the message a read-only mirror. Locally created messages carry no source.

nullable
sourceRefobjectoptional

External identity for sync dedup, e.g. {system:'tanss', id:'ticketComment:123'} — the subtype prefix keeps comment and mail id sequences disjoint (they collide bare).

systemstringoptional
idstringoptional
inReplyTostringoptional

In-Reply-To header for threading

nullable
referencesstring[]optional

References header for threading

skipSignaturebooleanoptional

Set by composers (e.g. the inbox EmailComposeDialog) that already embed the author's signature into htmlBody client-side, so the DRAFT→SENT transition hook (transition.service.ts sendEmailHook) does not append a second one.

reactionsobject[]optional

Emoji reactions (Teams-style). Managed exclusively via POST /:resource/:id/reactions — never set directly via create/update (the field is protected). Absent/missing = no reactions.

read-only
emojistringerforderlich

Native Unicode emoji character

1–32 Zeichen
userIdstringerforderlich

Internal users._id of the reactor

min 1 Zeichen
createdAtdatetimeoptional

When the reaction was added

read-only

Standard-Endpoints

Diese Resource folgt dem generischen CRUD-Vertrag der Plattform. Lesen Sie die Konventionen für Pagination, Idempotenz, Optimistic Locking und Audit. Die wichtigsten Endpoints:

  • GET /api/v1/messages — Liste, paginiert + filterbar
  • GET /api/v1/messages/<id> — Einzelne Entity
  • POST /api/v1/messages — Anlegen
  • PATCH /api/v1/messages/<id> — Teil-Update
  • DELETE /api/v1/messages/<id> — Soft-Delete
  • GET /api/v1/messages/<id>/timeline — Audit + Aktivitäten

Suche