Get a message

SDK platic.conversations.messages.get()

Get one message of a conversation by the id that List messages returns. Use it to read a message again, for example to get fresh attachment URLs.

Example

const { data: message } = await platic.conversations.messages.get("8Yc2kQ1mZ0rTq4Lp7WvX", "msg_9a2Fp1", {
  fields: ["content", "attachments", "deliveryStatus"],
});

A message that does not exist, or that is a system event, throws NotFoundError with code MESSAGE_NOT_FOUND.

Path parameters

ParameterTypeDescriptionRequired
conversationIdstringThe conversation's id✓
messageIdstringThe message's id, as returned by List messages. On some older conversations it looks like legacy_12. The provider's message ID (WhatsApp, Meta…) is not accepted✓

Query parameters

ParameterTypeDescription
fieldsstringFields to return, comma-separated. Replaces the default fields; id is always returned
includestringRelations to resolve in included: agents, members
workspacestringThe workspace to read, for an API key that covers several. Other credentials always read their own workspace

The default fields, every other field and what sender means are the same as in List messages.

Response

{
  "status": "success",
  "data": {
    "id": "msg_9a2Fp1",
    "content": null,
    "attachments": [
      { "type": "image", "url": "https://files.example.com/receipt.jpg", "mimeType": "image/jpeg", "name": "receipt.jpg" }
    ],
    "deliveryStatus": "received"
  },
  "meta": {
    "fields": ["id", "content", "attachments", "deliveryStatus"],
    "include": [],
    "requestId": "req_7f3e"
  }
}

included appears only when you send include.

The email block

On an email message, ask for email in fields to get its envelope. The body of the email is content, as plain text; the block does not repeat it. On other messages the field is left out.

{
  "id": "msg_005",
  "contentType": "email",
  "content": "Thanks, can you send it as a PDF?",
  "email": {
    "subject": "Re: Your quote",
    "from": { "address": "ana@example.com", "name": "Ana" },
    "to": ["sales@acme.com"],
    "cc": [],
    "messageId": "<CAF1x2@mail.gmail.com>",
    "inReplyTo": "<a9b8c7@acme.com>",
    "threadId": "18c4f2a9e1b",
    "attachments": []
  }
}
FieldDescription
subjectSubject of that email
from{ address, name } of the sender. name can be null
toRecipients
ccCopies. [] if none
messageId, inReplyToEmail headers that link it to the previous one
threadIdThread ID in Gmail or Outlook, or null
attachments{ name, type, size, url } per attachment. Any of them can be null

Errors

Statusdetails.codeWhen it happens
400INVALID_REQUESTA query parameter is invalid. details.issues says which
400INVALID_FIELDA name in fields does not exist. details.allowed lists the accepted ones
400INVALID_INCLUDEA name in include does not exist. details.allowed lists the accepted ones
401UNAUTHENTICATEDThe credential is missing or invalid
403FORBIDDENThe credential has no access to conversations in this workspace
404CONVERSATION_NOT_FOUNDNo conversation has this id, or the credential cannot read it
404NOT_A_CONVERSATIONThe conversation ID belongs to a comment post you can read. details.href says where to read it
404MESSAGE_NOT_FOUNDNo visible message has this id in the conversation. System events and tool calls answer the same way

The general error format is in Errors.