Wooxy API v.3.0

Send Batch Triggered Email

The Send Batch Triggered Email method lets you send a saved template to up to 100 contacts in your Contact List with a single request. The emails are sent from the domain linked to your Contact List.

IMPORTANT: In a single request, you can send communications to no more than 100 contacts at once.

Request

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

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

Body Example

                                        {
            "contactListId": "YOUR_CONTACT_LIST_ID",
            "templateId": "YOUR_TEMPLATE_ID",
            "contacts": [
                {
                    "contact": "testcontact@domain.co",
                    "variables": [
                        {
                            "name": "contactVar",
                            "value": "contactVarValue"
                        }
                    ]
                },
                {
                    "contact": "testcontact+1@domain.co"
                },
                {
                    "contact": "testcontact+2@domain.co"
                }
            ],
            "variables": [
                {
                    "name": "templateVar",
                    "value": "templateVarValue"
                }
            ],
            "tag": [
                "YOUR_BATCH_TAGS",
            ],
            "ignoreHard": false,
            "ignoreComplaint": false,
            "ignoreUnsubscribe": false,
            "ignoreBlackList": false,
        }
                                    

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.

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.

contacts

required
array

An array of objects that includes the contacts to which the messages will be sent, as well as an array of objects with unique variables for each contact.

contacts.contact

required
string

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

contacts.variables

optional
array

An array of unique variables for each contact. 

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.

Important! Variables passed to the contact have the highest priority when used in the template.

contacts.variables.name

required
string

The name of the contact's unique variable.

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

contacts.variables.value

required
string|integer|boolean

The value of the contact's unique variable.

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

variables

optional
array

An array of common variables that will be applied to the sending for each individual recipient.

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

The name of the variable that will be applied in the template for each contact.

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

variables.value

required
string|integer|boolean

The value of the variable that will be applied in the template for each contact.

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

tags

optional
array

An array of strings that can be used to tag a message. Statistics are accumulated using tags, and the number of tags available depends on the plan. All tags you want to use must be created in advance on the platform in the tags section. Tags should be 50 characters or less. Any tags starting with an underscore are reserved for internal use and will cause errors.

ignoreHard

optional
boolean

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. IMPORTANTThat parameter is only available for the Enterprise Plan. Request the parameter activation from the support team via support@wooxy.com:

ignoreComplaint

optional
boolean

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. IMPORTANTThat parameter is only available for the Enterprise Plan. Request the parameter activation from the support team via support@wooxy.com:

ignoreUnsubscribe

optional
boolean

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. IMPORTANTThat parameter is only available for the Enterprise Plan. Request the parameter activation from the support team via support@wooxy.com:

ignoreBlackList

optional
boolean

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:

Response

                                        {
  "result": true,
  "success": {
    "testcontact@domain.co": "Message ID",
    "testcontact+1@domain.co": "Message ID",
    "testcontact+2@domain.co": "Message ID"
  },
  "failed": {
    "testcontact+3@domain.co": "Error description"
  }
}
                                    

Parameters

Title Type Description

result

boolean

Indicated that the query was successful or not:

  • true: The value indicates that the query was successful.
  • false: The value indicates that the query wasn't successful.

success

object

An object containing all successful email sends, including the contacts to whom the emails were sent and the messageId of each send.

success.email

string

The email of the contact to whom the successful send was made.

success[messageId]

string

The Message ID of a successful send to a specific contact.

failed

object

An object with failed email sends, including the contact email that could not receive the communication and the reason why the send was unsuccessful.

failed.email

string

The email of the contact to whom the communication could not be sent.

failed[error]

string

The error that prevented the sending to a specific contact.

Method Errors

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

"Argument contactListId must be a string"

"Argument contactListId must be a non-empty string"

"Contact list with id {contactListId} not found"

"Each contact must contain contact field"

"Argument contacts must be an array of objects"

"Amount of contacts must be less or equal 100"

"No contacts to handle"

"Duplicated as {contact}",

"Contact not found"

"Contact is not active"

"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}"

"Argument templateId must be a non-empty string"

"Template with id {templateId} not found"

"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"

"Tag %s is not registered in account tags"

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

"variable \"{name}\" is reserved and can not be added as custom variable"

"Argument ignoreHard must be a boolean"

"You are not allowed to use ignoreHard option"

"Argument ignoreComplaint must be a boolean"

"You are not allowed to use ignoreComplaint option"

"Argument ignoreUnsubscribe must be a boolean"

"You are not allowed to use ignoreUnsubscribe option"

"Argument ignoreBlackList must be a boolean"

"You are not allowed to use ignoreBlackList option"

"Payment required"

"Fail to publish message"

"No contacts to handle"

"Domain {domainId} not found"

"Contact is not subscribed to email"

"Twig syntax error: {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/mailer/contacts-batch';

$body = json_encode([
    "contactListId" => "YOUR_CONTACT_LIST_ID",
    "templateId" => "YOUR_TEMPLATE_ID",
    "contacts" => [
        [
            "contact" => "testcontact@domain.co",
            "variables" => [
                [
                    "name" => "contactVar",
                    "value" => "contactVarValue"
                ],
            ]
        ],
        [
            "contact" => "testcontact+1@domain.co"
        ],
        [
            "contact" => "testcontact+2@domain.co"
        ]
    ],
    "variables" => [
        [
            "name" => "templateVar",
            "value" => "templateVarValue"
        ]
    ],
    "tag" => [
        "YOUR_BATCH_TAGS"
    ],
    "ignoreHard" => false,
    "ignoreComplaint" => false,
    "ignoreUnsubscribe" => false,
    "ignoreBlackList" => false
]);

$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_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);