# getTextThreadMessages

The messages of ONE text conversation, with full bodies, newest first by default. Use it to read what was said after listInboxThreads surfaced a MESSAGE row (it carries only the latest). Identify the thread by `contactPhoneNumber` (required, E.164: the row's contactE164PhoneNumber) and, when you have it, `conversationId` (the MESSAGE row's id), which resolves the thread exactly. Without a conversationId a contact reachable on several org lines resolves to one of them arbitrarily; pass `phoneLineId` to pin the line instead. Page with limit/offset (default 50, max 100); a full page means more may remain. Each message carries message (the body), direction, status, createdAt (UTC; quote createdAtLocal), from/toPhoneNumber, errorCode/errorMessage when a send failed, and `author`: who sent it, a person or an AI employee; `fromSuggestion`: sent from an AI employee's card. `author` is null on every INBOUND message: the words are the contact's. Returns an EMPTY LIST, never an error, when no conversation on that number is visible to the key owner: and "no such conversation" and "that conversation is a teammate's, and you may not read teammates" are deliberately indistinguishable, so an empty result is not proof the contact never texted. listContactTextThreads lists a contact's lines. MMS media is not returned.

- Call: `POST https://server.goliathdata.com/api/v1/call` with `{ "operationId": "getTextThreadMessages", "variables": {...} }`
- Scope: `READ`
- Type: query
- Idempotency: a read; rejects `Idempotency-Key`
- Rate-limited: no
- Result cap: `limit` is clamped to 100, without an error

## Variables

- `contactPhoneNumber`: `String!` (required)
- `conversationId`: `ID`
- `phoneLineId`: `ID`
- `userId`: `ID`
- `limit`: `Int` (default `50`)
- `offset`: `Int` (default `0`)
- `sort`: `SortDirection` (default `DESC`, one of `ASC`, `DESC`)

## Response (data, an example)

```json
{
  "inboxQuery": {
    "getInboxMessages": [
      {
        "id": "<ID>",
        "contactE164PhoneNumber": "…",
        "phoneLineId": "…",
        "seen": true,
        "potentialContacts": [
          {
            "id": "<ID>",
            "name": "…"
          }
        ],
        "messages": [
          {
            "id": "<ID>",
            "message": "…",
            "direction": "INBOUND",
            "status": "PENDING",
            "createdAt": "2026-01-01T00:00:00.000Z",
            "createdAtLocal": "…",
            "fromPhoneNumber": "…",
            "toPhoneNumber": "…",
            "errorCode": "…",
            "errorMessage": "…",
            "author": {
              "kind": "USER",
              "id": "<ID>",
              "name": "…"
            },
            "workflowAutomationName": "…",
            "agentName": "…",
            "fromSuggestion": {
              "agentName": "…",
              "edited": true
            }
          }
        ]
      }
    ]
  }
}
```

## Example

```bash
curl https://server.goliathdata.com/api/v1/call \
  -H "Authorization: Bearer $GOLIATH_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "operationId": "getTextThreadMessages",
    "variables": {
      "contactPhoneNumber": "<String>"
    }
  }'
```
