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

Send Triggered Email

The Send Triggered Email method allows sending email messages to contacts that have been added to our system and saved to a list. The emails are sent from the domain where the list was created, and templates previously designed and saved within our system are used.

 

Request

POST
https://api.wooxy.com/v3/mailer/trigger

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

Body Example

                                        {
 "contactListId": "YOUR_CONTACT_LIST_ID",
 "contact": "user@example.com",
 "templateId": "YOUR_TEMPLATE_ID",
 "ignoreBlackList": false,
 "tags": [
    "triggerTag"
 ],
 "variables": [
    {
       "name": "newVariableName1",
       "value": "newVariableValue1"
    },
    {
       "name": "newVariableName2",
       "value": "YYYY-MM-DD"
    }
 ]
}
                                    

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.

templateId

required
string

The template you want to send. The template should be already created in your account on Templates page: https://app.wooxy.com/templates.

ignoreBlackList

optional
boolean false

By setting the filter to true, your message will bypass all unsubscribes and suppressions in all lists. IMPORTANTThat parameter is only available for the Enterprise Plan. Request the parameter activation from the support team via support@wooxy.com:

  • ignoreHard: By setting the filter to true, your message will bypass the bounce list. 
    The spam report and global unsubscribe lists will be checked and respected.
  • ignoreComplaint: By setting the filter to true, your message will bypass the spam report list. 
    The bounce and global unsubscribe lists will be checked and respected.
  • ignoreUnsubscribe: By setting the filter to true, your message will bypass the global unsubscribe list. 
    The spam report and bounce lists will be checked and respected.

tags

optional
array null

An array of string to tag the message with. Stats are accumulated using tags, though we only store the first 100 we see, so this should not be unique or change frequently. Tags should be 50 characters or less. Any tags starting with an underscore are reserved for internal use and will cause errors.

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,
   "messageId": "5d91513fd132d5f462796870"
}
                                    

Parameters

Title Type Description

result

boolean

The value indicates that the triggered message was successfully sent out:

  • true: The message was successfully sent out

messageId

string

The message unique identification number is in the Wooxy system. This ID number allows you to get all the statistics on each message sent.

Method Errors

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

“Argument contactListId must be a non-empty string”

“Argument contact must be a non-empty string”

“Argument templateId must be a non-empty string”

“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}”

“Payment required”

“Contact list with id {contactListId} not found”

“Template with id {templateId} not found”

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

“Contact {contact} is not active”

“Contact {contact} is not subscribed to email”

“Contact {contact} has not email address”

“Unable to create html and text versions form template”

“fail to publish message”

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

$body = json_encode([
  'contactListId' => 'YOUR_CONTACT_LIST_ID',
  'contact'       =>  'user@example.com',
  'templateId'    =>  'YOUR_TEMPLATE_ID',
  'tags'          =>  [
     'triggerTag'
  ],
     'variables'  => [
     [
       'name'     => 'newVariableName1',
       'value'    => 'newVariableValue1'
     ],
     [
       'name'     => 'newVariableName2',
       'value'    => 'YYYY-MM-DD'
     ]
  ],
 ]);

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