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

Create Event

The Create Event method allows you to create a custom event.

Request

POST
/v3/custom-event/create

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

Body Example

                                        {
  "name": "YOUR_EVENT_NAME",
  "description": "YOUR_CUSTOM_DESCRIPTION",
  "isConversion": true,
  "cost": {
              "value": 2.05, 
              "currency": "EUR"
           }
}
                                    

Parameters

Title Type Default Description

name

required
string

Unique  EventName for registering in Wooxy system.

description

optional
string

Description note about your events.

isConversion

optional
boolean false

If you want existing events to be taken into account in advanced analytics, mark the parameter as true or false  if not.

cost

optional
object null

Value and currency of your registered event.

cost.value

required
float

value in 'ENUM_STRING' format correspondingly.

cost.currency

required
string

(EUR, USD)
WARNING: Please use only latin uppercase format. No numbers or other symbols allowed.

Response

                                        {
 "result":true,
 "id":"5d915c22d132d5f45a4e38b8"
}
                                    

Parameters

Title Type Description

result

boolean

The value indicates that the event was successfully added to your account:

  • true: Event was successfully registered.

id

string

A unique event ID assigned in the Wooxy system is used to match the specific “Add event.” It will be sent by Wooxy after the request is processed.

Method Errors

                                        {
   "result":false,
   "errors":[
      "Custom event with this parameter is already registered"
   ]
}
                                    
Error

“Argument ‘name’ must be a non-empty alphanumeric string with a max length of 40 chars”

“Argument ‘description’ must be a non-empty string with max length 1000 chars”

“Argument ‘isConversion’ must be a boolean”

“Argument ‘cost’ must be an array with value and currency fields”

“Cost value must be a positive float”

“Cost currency {currency} not allowed. USD, EUR are.”

“Custom event with this parameter is already registered”

“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/custom-event/create';
$body = json_encode([
    'name'         => 'YOUR_EVENT_NAME', 
    'description'  => 'YOUR_CUSTOM_DESCRIPTION', 
    'isConversion' => true, 
    'cost'         => [    
        'value'    => 0.05,
        'currency' => 'USD',
    ],
]);
/**
 * 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);