Add Source
The Add Source method allows you to add the contact source.
Request
IMPORTANT: Do not send more than 10 concurrent API requests.
Body Example
{
"name": "SourceName",
"customerSourceId": "mySourceID",
"cac": {
"value": 2.05,
"currency": "EUR"
}
}
Parameters
| Title | Type | Default | Description |
|---|---|---|---|
|
name required
|
string |
Name of your contact source |
|
|
customerSourceId optional
|
string |
Unique customerSourceId that is already registered in your system. |
|
|
cac optional
|
object | null |
An object that contains comprehensive data regarding the cost of acquiring customers comprises the value and currency. |
|
cac.value required
|
float |
CAC value in |
|
|
cac.currency required
|
string |
(EUR, USD) |
Response
{
"result":true,
"sourceId":"5d915c22d132d5f45a4e38b8"
}
Parameters
| Title | Type | Description |
|---|---|---|
|
result |
boolean |
The value indicates that the source was successfully added to your account:
|
|
sourceId |
string |
A unique source ID assigned in the Wooxy system is used to match the specific “Add source.” It will be sent by Wooxy after the request is processed. |
Method Errors
{
"result": false,
"errors": [
"Error description text"
]
}
| Error |
|---|
|
“Argument ‘name’ must be a non-empty string with max length 150 chars” |
|
“Argument ‘customerSourceId’ must be an alphanumeric string with max length 40 chars” |
|
“Argument CAC must be an array with value and currency fields” |
|
“CAC value must be a positive float” |
|
“CAC currency {currency} not allowed. USD, EUR are.” |
|
“Contact source with this parameters is already registered” |
|
“Invalid authorization token!” |
|
“Internal server error” |
|
“Bad Request” |
|
“no matches found for access token” |
|
“access token check failed for key\/secret $key\/$accessToken” |
|
“Argument {argument} required” |
Code Examples
$accessToken = "YOUR_API_KEY";
$url = "https://api.wooxy.com/v3/contact-source/add";
$body = json_encode([
'name' => 'SourceName',
'customerSourceId' => 'mySourceID',
'cac' => [
'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);