Errors
Check the HTTP status and the response body. Validation errors generally use the NestJS response format:
{
"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
| Status | Typical cause | Action |
|---|---|---|
400 | Invalid fields, audience, menu, schedule, or balance | Read the message and correct the request |
401 | Missing, invalid, or expired credentials | Check the endpoint's required credential |
403 | Account or operation not permitted | Check account activation and permissions |
404 | Missing resource or a resource outside your account | Check the ID and ownership |
409 | Stale menu version, campaign state conflict, or changed retry payload | Reload current state before resubmitting |
413 | Payload too large | Reduce request size |
429 | Request limit exceeded | Slow down; observe retry headers when present |
500–504 | Temporary service or connection failure | Inspect the outcome before retrying a chargeable action |
JavaScript SDK errors
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.