Add Subscriber

This method can be applied on your server-side, when a visitor requests his email to be subscribed.

Method: GET

URL: https://api.retargeting.app/v1/subscriber-register

Function parameters

Field Type Required Description
k number or text True The REST API Key can be found into your account Settings -> Integration -> REST API Key, second field.
email email True The buyer's e-mail address
name text False Full name. Minimum 4 characters
phone text False Phone number. Minimum 9 characters

The phone number is automatically considered confirmed if it's present in the request.

Your account status must be in one of the states: PAID, PAYMENT ERROR or ACCOUNT SUSPENDED.

If your account is Inactive or Closed the API call will not work.

The API call will respond with JSON format.

Example

   <?php
   require_once "vendor/autoload.php";

   $apiURL = "https://api.retargeting.app/v1/";
   $apiKey = "MyAPI_REST_Key";

   $client = new GuzzleHttp\Client();

   $registerData = [
       "k" => $apiKey,
       "email" => "email@example.com",
       "phone" => "0712345678",
       "name" => "John Dave"
   ];

   $registerRequest = $client->request("GET", $apiURL . "subscriber-register", ["query" => $registerData]);

If the API call succeeds, then the response will be as seen below:

{
    status: "success",
    data: null
}

The imported subscribers will have the source label details in Settings -> Subscribers -> Subscriber.

If the API call fails, then the response will be similar to the ones below:

{
    status: "error",
    message: "Subscriber already exists!"
}

OR

{
    status: "error",
    message: "Another subscriber has this phone number!"
}

OR

{
    status: "fail",
    data: {
        validator: {
            phone: [
                    "The phone must be at least 9 characters"
            ]
        }
    }
}
If you want client-side registration, you can use the setEmail function