Skip to content

Errors ​

Check the HTTP status and the response body. Validation errors generally use the NestJS response format:

json
{
  "statusCode": 400,
  "message": ["property webhookUrl should not exist"],
  "error": "Bad Request"
}

message may be a string or an array. Messaging operations can also return 200 with success: false, partial sending counts, or an error string. Do not rely on a universal nested error.code format.

HTTP statuses ​

StatusTypical causeAction
400Invalid fields, audience, menu, schedule, or balanceRead the message and correct the request
401Missing, invalid, or expired credentialsCheck the endpoint's required credential
403Account or operation not permittedCheck account activation and permissions
404Missing resource or a resource outside your accountCheck the ID and ownership
409Stale menu version, campaign state conflict, or changed retry payloadReload current state before resubmitting
413Payload too largeReduce request size
429Request limit exceededSlow down; observe retry headers when present
500–504Temporary service or connection failureInspect the outcome before retrying a chargeable action

JavaScript SDK errors ​

js
import { GalatextError } from 'galatext-api';

try {
  const result = await client.sms.send('254712345678', 'Your order is ready.', 'YOURBRAND');
  if (!result.success) {
    console.error(result.error, result.totalSent, result.totalFailed);
  }
} catch (error) {
  if (error instanceof GalatextError) {
    console.error(error.status, error.code, error.message);
  } else {
    throw error;
  }
}

The SDK uses API_ERROR when an HTTP error has no explicit code, TIMEOUT for an aborted request, and NETWORK_ERROR for network failures. Missing credentials fail locally with MISSING_API_KEY or MISSING_ACCESS_TOKEN. Invalid input normalization can return INVALID_RECIPIENT or MISSING_RECIPIENTS; invalid timeout configuration returns INVALID_TIMEOUT.

The SDK returns successful HTTP response bodies unchanged, including business-level failures. It does not retry automatically. Reuse the same requestId for identical campaign creation or WhatsApp submissions. For direct SMS and airtime, inspect history after an uncertain result before sending again.

Powered by Galatext Software