API · v1 · stable
CODEMETA OSDeveloper Center
FR
Ouvrir la console
Entité · messages

Message Schema

ID du schéma
message
Collection
messages
Autorisations
  • Liremessage_view
  • Créermessage_create
  • Modifiermessage_edit
  • Supprimermessage_delete
Relations

Champs

Message Schema

messages4 autorisations

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

ticketIdstringfacultatif

Associated ticket ID

min. 1 caractères
entityIdstringfacultatif

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

min. 1 caractères
entityTypestringfacultatif

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

min. 1 caractères
contactPartyIdstringfacultatif

EMAIL on a company (entityType "party"): the contact person of that company the mail went to. Derived server-side from the recipients (message.hooks.ts) — a client value is ignored. Lets the mail appear in the person’s activity feed too. Additive and nullable: absent = no contact person known (no backfill).

nullable
isInternalbooleanfacultatif

Whether this is an internal note

customerVisiblebooleanfacultatif

EMAIL only: explicitly released to every customer-portal user who can see the parent record (mail composer switch "Intern" turned OFF). Without it a portal user sees an e-mail only when one of their own addresses is in from/to/cc/bcc (apps/api/src/lib/message-read-visibility.ts, rule 3). Staff only — customers cannot set it. Additive and nullable: absent = not released (no backfill).

nullable
isSystemGeneratedbooleanfacultatif

Die Notiz stammt von der Anwendung, nicht von einem Menschen: Statuswechsel-Begründung, Merge-Vermerk, Urlaubsübergabe, Eskalation, Regel-Aktion. Ohne dieses Feld ist eine System-Notiz von einem echten Kommentar NICHT unterscheidbar — beide sind INTERNAL_NOTE und beide tragen einen menschlichen `createdBy` (der Auslöser der Aktion). Der Aktivitäts-Zähler des Boards (`GET /tickets/activity`) blendet sie damit aus; ohne das meldete jeder Statuswechsel „neuer Kommentar". Additiv und nullable: fehlend = wie bisher behandelt (also als Kommentar). KEIN Backfill — der Zähler rechnet ohnehin nur ab dem Quittungsstempel, Altbestand fällt von selbst heraus.

nullable
messageTypestringobligatoire

Type of message

EMAILCOMMENTINTERNAL_NOTE
statusstringobligatoire

Current message status

DRAFTSENTSEND_FAILEDRECEIVEDSCHEDULED
sendAtdatetimefacultatif

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
directionstringfacultatif

Message direction

inboundoutbound
fromstringfacultatif

Sender email address

effectiveFromstringfacultatif

Feedback 01a17c77 — for an inbound mail an OWN employee forwarded into the support mailbox: the original author parsed from the forwarded header (`utils/forwarded-sender.ts`). `from` stays the real transport sender (the forwarder); replies go to this address (`replyAddressOf`). Additive — absent on old rows, which then reply to `from` as before.

nullable
effectiveFromNamestringfacultatif

Display name of `effectiveFrom`, when the forwarded header carried one.

nullable
forwardedBystringfacultatif

The own address the mail was forwarded from when `effectiveFrom` is set — shown next to the reply recipient so the hand-over stays visible.

nullable
forwardedRecipientConfirmationobjectfacultatif

M3 (VULN-2026-11-24-forwarded-author-reassigns-ticket-to-third-party): on an outbound mail, the recipients a person explicitly confirmed although they came only from a forwarded header (`effectiveFrom` of an inbound mail in the same thread). The first mail to such an address is refused with 409 `FORWARDED_RECIPIENT_UNCONFIRMED` until the client repeats it with `{ addresses }`. `confirmedBy`/`confirmedAt` are stamped by the server (`lib/forwarded-recipient-gate.ts`), never taken from the client.

nullable
emailAccountIdstringfacultatif

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
bookedAsTimeRecordIdstringfacultatif

Time record booked off this sent mail (ADR 0779) — the counterpart of `phone_calls.bookedAsTimeRecordId`. Written by the generic CRUD hook when a `time_record` with `sourceType: MESSAGE` / `sourceId: <this _id>` is created; a second click on the mail then opens that booking instead of creating a duplicate. Additive field — sanctioned by the OCTOJA contract note above; absent on old documents (read as "not booked", which is correct: no booking was ever made off a mail before).

nullable
tooneOffacultatif

Recipient email address(es)

cconeOffacultatif

CC email address(es)

bcconeOffacultatif

BCC email address(es)

attachmentsobject[]facultatif

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.

fileIdstringfacultatif
filenamestringfacultatif
mimeTypestringfacultatif
sizeBytesnumberfacultatif
sizenumberfacultatif
urlstringfacultatif
nullable
contentIdstringfacultatif
nullable
inlinebooleanfacultatif
nullable
exchangeInlinebooleanfacultatif
nullable
byteLengthnumberfacultatif
nullable
attachmentsSkippedobject[]facultatif

Attachments the mail provider REPORTED but the ingest could not take over (ADR 0519). They appear in no `files` row and in no `attachments[]` entry above — until 2026-08-17 they vanished without a trace and the message looked exactly like a mail that never had an attachment. The frontend renders an explicit hint from this list instead. `reason` is deliberately coarse and stable, never a raw provider error: 'no-bytes' — the provider delivered metadata but no bytes (Graph omits `contentBytes` from `$expand=attachments` from roughly 3 MB up, and the single-attachment refetch did not obtain them either); 'unsupported-type' — not a `#microsoft.graph.fileAttachment`, i.e. an `itemAttachment` (a mail forwarded as an attachment) or a `referenceAttachment` (OneDrive/SharePoint link); 'not-persisted' — the bytes WERE available but were deliberately (not yet) stored, currently the Outlook add-in path (`attachM365MessageToEntity`), which discards attachments by V1 decision. Omitted entirely when nothing was skipped; there is NO backfill, so an absent field means "nothing recorded", never "nothing was skipped".

filenamestringfacultatif
mimeTypestringfacultatif
sizenumberfacultatif
reasonstringfacultatif
no-bytesunsupported-typenot-persisted
subjectstringfacultatif

Message subject

max. 1000 caractères
bodystringfacultatif

Plain text body

bodyI18nKeystringfacultatif

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

nullable
bodyI18nParamsobjectfacultatif

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

nullable
htmlBodystringfacultatif

HTML body

nullable
aiSummarystringfacultatif

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
aiSummaryAttemptedAtdatetimefacultatif

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
systemMailKindstringfacultatif

Marks a message written by the platform itself, e.g. 'ticket_created_confirmation'. Absent/null on every human-authored message. Server-managed (protected field).

lecture seulenullable
systemMailSkipReasonstringfacultatif

For a system mail that was deliberately NOT sent although the tenant enabled it (e.g. 'no_recipient', 'rate_limited', 'sender_own_mailbox', 'not_enqueued', 'sender_unverified', 'tenant_rate_limited', 'sender_auth_failed'; legacy rows: 'email_without_customer', no longer written since ADR 1125): the typed reason. Such rows carry status SEND_FAILED so the failure surfaces; the UI labels them "nicht gesendet" instead of "fehlgeschlagen".

lecture seulenullable
isAutoReplybooleanfacultatif

Automated acknowledgement (Eingangsbestätigung, dispatch auto-reply). Excluded from SLA first-response detection (worker ticket-first-response.ts) and from ticket-exchange outbound (a Jira peer never sees an auto-ack as a comment). Written by the worker/system paths only — until 2026-08-17 the dispatch responder set it without a schema entry.

lecture seulenullable
statusChangedAtdatetimefacultatif

When `status` last changed. Written by the transition path and the system-mail record; fallback timestamp for `resolveMessageSendFailure()`.

nullable
sentAtdatetimefacultatif

When the message was sent

nullable
sendErrorobjectfacultatif

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".

lecture seulenullable
sendAttemptsnumberfacultatif

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.

lecture seule
lastSendAttemptAtdatetimefacultatif

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

lecture seulenullable
sendInProgressbooleanfacultatif

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.

lecture seule
sendStartedAtdatetimefacultatif

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

lecture seulenullable
inlineImagesobjectfacultatif

Outcome of embedding the pasted `/files/` images of an outbound mail as cid parts: `embedded` count and the `skipped` images (fileId + reason) that stayed a dead link for the recipient. Written by the send path only (protected field).

lecture seulenullable
receivedAtdatetimefacultatif

When the message was received

nullable
emailMessageIdstringfacultatif

Email Message-ID from the provider

nullable
emailDocIdstringfacultatif

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
extMessageIdstringfacultatif

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

nullable
authorNamestringfacultatif

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
sourcestringfacultatif

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
sourceRefobjectfacultatif

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).

systemstringfacultatif
idstringfacultatif
inReplyTostringfacultatif

In-Reply-To header for threading

nullable
referencesstring[]facultatif

References header for threading

skipSignaturebooleanfacultatif

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.

skipDefaultCcbooleanfacultatif

Set by composers that already resolved the Standard-CC contacts of the customer (party_relationship.isDefaultCc) and showed them as editable chips, so the DRAFT→SENT transition hook does not re-add an address the sender deliberately removed. Messages created outside a composer (ticket comment mail, closing mail, automations) leave it unset and get the Standard-CC injected server-side.

reactionsobject[]facultatif

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.

lecture seule
emojistringobligatoire

Native Unicode emoji character

1–32 caractères
userIdstringobligatoire

Internal users._id of the reactor

min. 1 caractères
createdAtdatetimefacultatif

When the reaction was added

lecture seule
pinnedAtdatetimefacultatif

Angeheftet im Verlauf des Elternobjekts (ADR 0991): wichtige Notizen großer Tickets stehen in einer Leiste über dem Verlauf, statt zwischen hunderten Einträgen unterzugehen. Gesetzt/gelöscht ausschließlich über POST /messages/:id/pin (mit History-Zeile), nie per generischem PATCH (protectedFields). Fehlend oder null = nicht angeheftet — kein Backfill.

lecture seulenullable
pinnedBystringfacultatif

`users._id` der Person, die die Nachricht angeheftet hat (ADR 0991). Der Ticket-Zeitstrahl löst daraus `pinnedByName` auf; null, solange nicht angeheftet.

lecture seulenullable

Endpoints standard

Cette ressource suit le contrat CRUD générique de la plateforme. Lisez les conventions pour la pagination, l'idempotence, le verrouillage optimiste et l'audit. Les endpoints principaux :

  • GET /api/v1/messages — Liste, paginée et filtrable
  • GET /api/v1/messages/<id> — Une entité
  • POST /api/v1/messages — Créer
  • PATCH /api/v1/messages/<id> — Mise à jour partielle
  • DELETE /api/v1/messages/<id> — Suppression logique
  • GET /api/v1/messages/<id>/timeline — Audit et activités

Recherche