List messages

SDK platic.conversations.messages.list()

Get one page of the messages of a conversation, newest first by default. Only what the contact and the brand wrote is listed: system events, tool calls and empty messages never appear.

Example

const page = await platic.conversations.messages.list("8Yc2kQ1mZ0rTq4Lp7WvX", {
  limit: 20,
  include: ["agents", "members"],
});
for (const message of page.data) console.log(message.sender?.type, message.content);

// The whole history, oldest first
for await (const message of platic.conversations.messages.iterate("8Yc2kQ1mZ0rTq4Lp7WvX", { sortDirection: "asc" })) {
  console.log(message.createdAt, message.content);
}

iterate follows nextPageToken until it is null; use list when you need each page's included.

Path parameters

ParameterTypeDescriptionRequired
conversationIdstringThe conversation's id. Never a phone number or the old V1 conversationId key✓

Query parameters

ParameterTypeDescription
fieldsstringFields to return, comma-separated. Replaces the default fields; id is always returned
includestringRelations to resolve once per page in included: agents, members
limitintegerMessages per page, from 1 to 100. Default: 20
pageTokenstringThe nextPageToken of the previous page
sortBystringcreatedAt, the only order. Default: createdAt
sortDirectionstringdesc (default) returns the latest messages first; asc starts from the first one
workspacestringThe workspace to read, for an API key that covers several. Other credentials always read their own workspace

Fields

Without fields, each message has:

id, createdAt, role, sender, contentType, content, attachments

fields replaces the defaults. An unknown field answers 400 INVALID_FIELD with the accepted names in details.allowed.

FieldTypeDescription
idstringID of the message in Platica. Always present. It is never the provider's ID
createdAtstring | nullWhen the message was created, ISO 8601 in UTC
rolestringuser (the contact) or assistant (the brand)
senderobjectWho wrote it. See Who wrote each message
contentTypestring | nulltext, image, audio, video, document, email or interactive. A message without text takes the type of its first attachment
contentstring | nullVisible text. On email, the plain text, never the HTML
attachmentsobject[]Files of the message, each once: { type, url, mimeType, name }. type is image, audio, video or document; mimeType and name can be null
directionstring | nullincoming (to the brand) or outgoing (from the brand)
deliveryStatusstring | nullDelivery state: queued, sent, delivered, received, failed…
updatedAtstring | nullLast change of the message, ISO 8601
providerMessageIdstring | nullID the provider (WhatsApp, Meta…) gave the message, when known
emailobjectOnly on email messages: subject, addresses and references. Left out on other messages. See the email block

Who wrote each message

role only says which side wrote: user is the contact and assistant is the brand. sender says who wrote it, based on what Platica recorded when the message was sent:

sender.typeWhosender.id
contactThe contactThe contact's ID (/v1/clients/{id}), or null
agentAn AI agentThe agent's ID
memberA person on your teamThe team member's ID
brandThe brand, when the author was not recordedNot present

role: "assistant" alone does not mean an agent wrote the message: a person on your team also writes as assistant.

With include=agents and include=members, included.agents and included.members give the name of each agent and team member that wrote on the page (members also carry email). A record that cannot be found keeps its ID with "resolved": false. An unknown relation answers 400 INVALID_INCLUDE.

Response

{
  "status": "success",
  "data": [
    {
      "id": "msg_9a2Fq7",
      "createdAt": "2026-11-30T18:00:00.000Z",
      "role": "assistant",
      "sender": { "type": "member", "id": "usr_ana" },
      "contentType": "text",
      "content": "The refund for order 1042 was approved.",
      "attachments": []
    },
    {
      "id": "msg_9a2Fp1",
      "createdAt": "2026-11-30T17:58:00.000Z",
      "role": "user",
      "sender": { "type": "contact", "id": "cl_3h7Jt9Q2" },
      "contentType": "image",
      "content": null,
      "attachments": [
        { "type": "image", "url": "https://files.example.com/receipt.jpg", "mimeType": "image/jpeg", "name": "receipt.jpg" }
      ]
    }
  ],
  "included": {
    "agents": [],
    "members": [{ "id": "usr_ana", "name": "Ana López", "email": "ana@acme.com", "resolved": true }]
  },
  "nextPageToken": "eyJ2IjoyLCJyIjoibWVzc2FnZXMifQ...",
  "pagination": { "limit": 20, "returnedCount": 2, "hasMore": true },
  "meta": {
    "fields": ["id", "createdAt", "role", "sender", "contentType", "content", "attachments"],
    "include": ["agents", "members"],
    "requestId": "req_7f3d",
    "history": "current"
  }
}
FieldDescription
dataThe messages of this page, in the requested order
includedAgents and team members that wrote on the page, only when you sent include
nextPageTokenToken of the next page; null on the last one
paginationlimit, returnedCount and hasMore (always the same as nextPageToken !== null)
meta.fields, meta.includeFields and relations applied
meta.historycurrent, or legacy for some older conversations whose history is stored the old way. Their message IDs look like legacy_12

Pagination

  • Messages are ordered by creation date, and by message ID when two share the same date. The order does not change between pages.
  • A page can be shorter than limit, or even empty, and still have a token: events and tool calls are skipped. Keep going until nextPageToken is null.
  • A token works only for the same conversation, workspace and sort order. Otherwise the API answers 400 INVALID_CURSOR. You can change limit, fields and include between pages.

Errors

Statusdetails.codeWhen it happens
400INVALID_REQUESTA query parameter is invalid, for example limit above 100. 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
400INVALID_CURSORThe pageToken belongs to another conversation, workspace or sort order. Start again without it
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 ID belongs to a comment post you can read. details.href says where to read it

The general error format is in Errors.