GoliathDevelopersGet an API key
Reference/Conversationsgenerated from the gateway manifest

getTextThreadMessages

The messages of ONE text conversation, with full bodies, newest first by default.

POST/api/v1/callREADreadruns as the key's owner
View as Markdown

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.

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>"
    }
  }'
import { GoliathClient } from '@goliath-data/sdk'

const goliath = new GoliathClient({
  apiKey: process.env.GOLIATH_API_KEY!,
  baseUrl: 'https://server.goliathdata.com',
})

const result = await goliath.conversations.getTextThreadMessages({
  contactPhoneNumber: '<String>'
})
const res = await fetch('https://server.goliathdata.com/api/v1/call', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.GOLIATH_API_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    operationId: 'getTextThreadMessages',
    variables: {
      contactPhoneNumber: '<String>'
    }
  }),
})
const { data, errors } = await res.json()

limit is clamped to 100.

Variables

The example sends only what the schema requires. Some operations also need one of several optional variables (one filter or another, say); the description above says which.

contactPhoneNumberString!required
conversationIdID
phoneLineIdID
userIdID
limitInt

Default 50.

offsetInt

Default 0.

sortSortDirection

Default DESC.

ASCDESC

Response

What comes back under data: a list shows as one entry, and a value as its type.

response shape
{
  "data": {
    "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
              }
            }
          ]
        }
      ]
    }
  }
}

Errors

Behaviour

A read. It rejects an Idempotency-Key header with 400 bad_request.