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
curl "https://api.platic.ai/v2/conversations/$CONVERSATION_ID/messages/$MESSAGE_ID?fields=content,attachments,deliveryStatus" \
-H "Authorization: Bearer $PLATIC_API_KEY" 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
| Parameter | Type | Description | Required |
|---|---|---|---|
conversationId | string | The conversation's id | ✓ |
messageId | string | The 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
| Parameter | Type | Description |
|---|---|---|
fields | string | Fields to return, comma-separated. Replaces the default fields; id is always returned |
include | string | Relations to resolve in included: agents, members |
workspace | string | The 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": []
}
} | Field | Description |
|---|---|
subject | Subject of that email |
from | { address, name } of the sender. name can be null |
to | Recipients |
cc | Copies. [] if none |
messageId, inReplyTo | Email headers that link it to the previous one |
threadId | Thread ID in Gmail or Outlook, or null |
attachments | { name, type, size, url } per attachment. Any of them can be null |
Errors
| Status | details.code | When it happens |
|---|---|---|
400 | INVALID_REQUEST | A query parameter is invalid. details.issues says which |
400 | INVALID_FIELD | A name in fields does not exist. details.allowed lists the accepted ones |
400 | INVALID_INCLUDE | A name in include does not exist. details.allowed lists the accepted ones |
401 | UNAUTHENTICATED | The credential is missing or invalid |
403 | FORBIDDEN | The credential has no access to conversations in this workspace |
404 | CONVERSATION_NOT_FOUND | No conversation has this id, or the credential cannot read it |
404 | NOT_A_CONVERSATION | The conversation ID belongs to a comment post you can read. details.href says where to read it |
404 | MESSAGE_NOT_FOUND | No visible message has this id in the conversation. System events and tool calls answer the same way |
The general error format is in Errors.