News! SmartSender.io becomes Wooxy. Read a post from the CEO Arrow
Wooxy API v.3.0

Send Triggered SMS

The Send Triggered SMS method allows SMS messages to be sent to contacts added to our system and saved to a list. The SMS messages are sent from the domain on which the list was created.

Request

POST
/v3/sms/trigger

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

Body Example

                                        {
   "contactListId":"YOUR_CONTACT_LIST_ID",
   "contact":"+155555555",
   "fromName":"SenderName",
   "text":"Hi, {{name}}! Your phone: {{phoneNumber}} Var1: {{newVariableName}}",
   "tags":[
      "smsApiTrigger"
   ],
   "variables":[
      {
         "name":"newVariableName",
         "value":"newVariableValue"
      }
   ]
}
                                    

Parameters

Title Type Default Description

contactListId

required
string

ID of the contact list to which the contact belongs.   
The list should be already created in your account on Lists page:   
https://app.wooxy.com/email-list.

contact

required
string

The 'email' address, 'userId' or 'phoneNumber' of the recipient stored in corresponding contactList.

fromName

optional
string contactList "From name"

Sender “From Name” linked to sending phone number that recipients will see on their phones. If not defined – default “From Name” linked to contactList 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.

variables

optional
array null

You can add an associative array of custom variables which will be placed in your template which we host.
Please, take in account variables usage priorities is case of conflicting variables:

  • First Priority: Variable from API request;
  • Second Priority: Variable from the Content Custom Variables;
  • Third Priority: Variable from the selected list.

variables.name

required
string

Variable name in lowerCamelCase format.
WARNING: Please use only latin lowerCamelCase format. No numbers or other symbols allowed.

variables.value

required
string

Variable value in 'ENUM_STRING' or 'ENUM_DATE' format correspondingly.

Response

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

Parameters

Title Type Description

sms_id

string

The SMS unique identification number in the Wooxy system.

result

boolean

The value indicates that the SMS was successfully sent:

  • true: SMS was successfully sent.

Method Errors

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

“Argument contactListId must be a non-empty string”

“Argument contact must be a non-empty string”

“Argument contact must be a valid email address or E.164 phone number. {contact} given”

“Argument text must be a non-empty string”

“Argument froName 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”

“Argument variables must be an array of arrays with \”name\” and \”value\” fields”

“Name of variable must be a string”

“Name of variable can not be empty”

“Variable \”{name}\” is reserved and can not be added as custom variable”

“Invalid name of variable {name}”

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

“Contact list {contactListId} not found”

“Contact {contact} is not active“

“Contact {contact} not found in list {contactListId}”

“Contact {contact} is not subscribed to SMS”

“Contact {contact} has not phone number”

“Contact phone number {phoneNumber} is blacklisted”

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

“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/trigger';

$body = json_encode([
    'contactListId' => 'YOUR_CONTACT_LIST_ID',
    'contact'       => '+155555555',
    //    'contact' => 'user@example.com',
    //    'contact' => 'userId',
    'fromName'      => 'senderName',
    'text'          => 'Hi, {{name}}! Your phone: {{phoneNumber}} Var1: {{newVariableName}}',
    'tags'          => [
        'smsApiTrigger',
    ],
    'variables'     => [
        [
            'name'  => 'newVariableName',
            'value' => 'newVariableValue'
        ],
    ],
]);

/**
 * 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);