Wooxy API v.3.0

Send SMS

The Send SMS method allows you to send SMS messages to any contact and manually select the domain from which to send them.

Request

POST
https://api.wooxy.com/v3/sms/send

IMPORTANT: Do not send more than 10 concurrent API requests.

Body Example

                                        {
   "domain": "senderDomain.com",
   "phoneNumber": "+1555555555",
   "fromName": "SenderName",
   "text": "Hi, API Sms!",
   "tags": [
      "smsApiSend"
   ]
}
                                    

Parameters

Title Type Default Description

domain

required
string

The verified domain name is from your Wooxy account. This data is used to send you webhooks and generate reports.

phoneNumber

required
string

Addressee phone number.
IMPORTANT: should be valid E.164 phone number.

fromName

optional
string Sending phone number

Sender’s from name linked to sending phone number addressee will see in their phones. If not defined – default from name linked to sending phone number will be used.

text

required
string

SMS text you want to send.

tags

optional
array null

You can add custom tags to your messages to ease stats collections (mark templates, campaigns, etc). A single tag – must not start with an underscore.

Response

                                        {
   "result": true,
   "sms_id": "5d91513fd132d5f462796870"
}
                                    

Parameters

Title Type Description

sms_id

The SMS unique identification number in the Wooxy system.

result

The value indicates that the SMS was successfully sent:

  • true: SMS was successfully sent

Method Errors

                                        {
   "result": false,
   "errors": [
      "Error description text"
   ]
}
                                    
Error

“Argument domain must be a non-empty string”

“Argument phoneNumber must be a non-empty string”

“{phoneNumber} is not a valid E.164 phone number”

“Argument text must be a non-empty string”

“Argument fromName must be a non-empty string”

“Argument fromName must contain 11 and less A-Z, a-z, 0-9 symbols and spaces or be a valid phoneNumber”

“Argument tags must be an array”

“Tag name must be a non-empty string”

“Tags should be 50 characters or less”

“Any tags starting with an underscore are reserved for internal use and will cause errors”

“SMS service is not activated for account {accountName}”

“Insufficient balance. You need at least {cost} to send this message”

“Phone number {phoneNumber} is blacklisted”

“Domain {domain} not found in your account”

“Publishing error”

“Invalid authorization token!”

“Internal server error”

“Bad Request”

“no matches found for access token {accessToken}”

“user {id} not enabled”

“no data found for key {userId}”

“access token check failed for key\/secret $key\/$accessToken”

“Argument {argument} required”

Code Examples

PHP
                $accessToken = "YOUR_API_KEY";
$url         = 'https://api.wooxy.com/v3/sms/send';

$body = json_encode([
   'domain'      => 'senderDomain.com',
   'phoneNumber' => '+1555555555',
   'fromName'    => 'senderName',
   'text'        => 'Hi, API SMS!',
   'tags'        => [
      'smsApiSend',
   ],
]);

/**
* Request Example
*/
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
//curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_INFILESIZE, null);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Access-Token: $accessToken",
'Content-Type: application/json',
'Content-Length: ' . strlen($body),
]);

$result = curl_exec($ch);
if ($result === false) {
   echo 'cURL error:' . curl_error($ch) . PHP_EOL;
} else {
   echo strval($result) . PHP_EOL;
}
curl_close($ch);