GoliathDevelopersGet an API key
Reference/Communicationsgenerated from the gateway manifest

sendText

Send an SMS to a phone number.

POST/api/v1/callWRITEidempotent · 24 hruns as the key's owner
View as Markdown

Send an SMS to a phone number (E.164, e.g. +13235550100; an unparseable number is rejected up front with INVALID_PHONE_NUMBER) as the key owner. NEEDS THE ORGANIZATION'S SEND CONSENT ATTESTATION: until an org admin attests once that every contact the organization messages through the API consented (setSendConsentAttestation; read it with getSendConsentAttestation), this is refused with 403 send_consent_not_attested, and while the org has paused everything it is refused with 403 outbound_paused. Runs the checks the app's composer runs: opt-out and Do-Not-Contact guard, A2P active-campaign gate, send throttles and daily caps, find-or-create contact from the number, and conversation + activity logging. A 200 response is NOT delivery: check status: FAILED or SKIPPED means the message never reached the contact (errorCode/errorMessage say why) even though the row is returned without a GraphQL error. Omit fromPhoneLineId to use your assigned line; sending from another user's assigned line requires the VIEW_ALL_PHONES capability (org-shared bulk lines are usable by any org member without it; another organization's line is never usable). Call listCommunicationChannels first and pick a line whose canSendSms is true.

curl https://server.goliathdata.com/api/v1/call \
  -H "Authorization: Bearer $GOLIATH_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "operationId": "sendText",
    "variables": {
      "toPhoneNumber": "<String>",
      "message": "<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.communications.sendText(
  {
    toPhoneNumber: '<String>',
    message: '<String>'
  },
  { idempotencyKey: crypto.randomUUID() },
)
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',
    'Idempotency-Key': crypto.randomUUID(),
  },
  body: JSON.stringify({
    operationId: 'sendText',
    variables: {
      toPhoneNumber: '<String>',
      message: '<String>'
    }
  }),
})
const { data, errors } = await res.json()

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.

toPhoneNumberString!required
messageString!required
fromPhoneLineIdID

Response

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

response shape
{
  "data": {
    "smsMutation": {
      "sendSms": {
        "id": "<ID>",
        "message": "…",
        "status": "PENDING",
        "errorCode": "…",
        "errorMessage": "…",
        "fromPhoneNumber": "…",
        "toPhoneNumber": "…",
        "createdAt": "2026-01-01T00:00:00.000Z"
      }
    }
  }
}

Errors

Idempotency

Send an Idempotency-Key of 1 to 255 characters. A finished request retried with the same key replays its stored response, marked Idempotency-Replayed: true; one still in flight returns 409 idempotency_conflict. Keys expire after 24 hours. Write without fear →