# sendText

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.

- Call: `POST https://server.goliathdata.com/api/v1/call` with `{ "operationId": "sendText", "variables": {...} }`
- Scope: `WRITE`
- Type: mutation
- Idempotency: honors `Idempotency-Key` (24 h)
- Rate-limited: no

## Variables

- `toPhoneNumber`: `String!` (required)
- `message`: `String!` (required)
- `fromPhoneLineId`: `ID`

## Response (data, an example)

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

## Example

```bash
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>"
    }
  }'
```
