Skip to content

Sending SMS

Client::sendSms() accepts either an associative array or an SmsRequest instance. At least one mobile number or contact group is required.

$response = $client->sendSms([
'fromLabel' => 'MYBRAND',
'toMobileNumber' => ['306912345678', '306987654321'],
'toGroup' => ['Customers', 'Promotions'],
'smsBody' => 'Your order has been dispatched.',
'clientRequestId' => 'order-9543212',
'callbackWhenProcessedFlag' => true,
'simulateSendFlag' => false,
'concatFlag' => true,
]);

Arrays of phone numbers or group names are normalized into semicolon-separated strings. String values may already use semicolons or commas as supported by the API.

Field Type Required Description
fromLabel string Yes Registered sender label
smsBody string Yes Message body, up to 1,000 characters
toMobileNumber string|string[]|null One destination required One or more international-format mobile numbers
toGroup string|string[]|null One destination required One or more account contact-group names
clientRequestId string|null No Your own correlation identifier
callbackWhenProcessedFlag bool|null No Request delivery callbacks
simulateSendFlag bool|null No Validate and simulate without sending
concatFlag bool|null No Allow concatenated SMS parts
scheduledAt DateTimeInterface|string|null No Future ISO-8601 delivery time
if ($response->isSuccess()) {
echo $response->getUsername();
echo $response->getSmsServerRequestId();
echo $response->getClientRequestId();
}

The response object is immutable and also implements ArrayAccess and JsonSerializable for read-only access to the raw API response.