Wooxy API v.3.0

Add Contact To Viber Black List

The Add Contact To Viber Black List method allows you to add a phone number to the Viber blacklist.

Request

POST
https://api.wooxy.com/v3/viber/blacklist/add

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

Body Example

                                        {
   "records": [
      {
         "phoneNumber": "+15555555",
         "rejectType" : "invalid",
         "rawLog" : "Text to describe reason for adding to Black List"
      }
   ]
}
                                    

Parameters

Title Type Default Description

records

required
array

Array of objects. Each object will be processed and saved. In case of duplicated objects, duplicates will be ignored and no errors will be returned.

records.phoneNumber

required
string

IMPORTANT: should be valid E.164 phone number.

records.rejectType

required
string

One of the available reasons for placing the phone number on the Viber Black List:

  • Spam: Used to indicate that the user complained or asked to unsubscribe;
  • Invalid: Used to indicate that the phone number is invalid or non-existent.

records.rawLog

optional
string

Optional text description of the reason for placing the contact in suppression list. Up to 1024 symbols.

Response

                                        {
   "result":true
}
                                    

Parameters

Title Type Description

result

boolean

The value indicates that the phone number was successfully added to the account Phone Black List:

  • true: The phone number was successfully added.

Method Errors

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

“Maximum count of phoneNumbers per transaction is 100, current {n}”

“{phoneNumber} is not a valid E.164 phone number”

“Argument {argument} required”

“each phone in phoneNumbers must be a string”

“{phoneNumbers} must be an array with valid E.164 phone numbers”

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

Code Examples

PHP
                $accessToken = "YOUR_API_KEY";
$url = 'https://api.wooxy.com/v3/viber/blacklist/add';

$body = json_encode([
   "records" => [
       [
           'phoneNumber' => "+15555555",
           'rejectType' => "spam",
           'rawLog' => "Text to describe reason for adding to Black List"
       ],
       [
           'phoneNumber' => "+15555555",
           'rejectType' => "invalid"
       ],
   ],
]);

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