Feedback

This method can be applied on your server-side, in order to get the approved comments and grades from the feedback triggers, newest first. Only the feedback you approved in your account is returned; pending or rejected feedback is not included.

To get only the number of approved feedback entries and their average score, use the Feedback summary method.

Method: GET

URL: https://api.retargeting.app/v1/email-campaigns/json-feedback

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.
u text True Your customer ID can be found in your account Settings -> Integration -> Customer ID, third field
t int Optional Unix timestamp in seconds (Example: 1793508459) in order to fetch only the feedback added at or after this moment. It must be an integer between 0 and 253402300799.
limit int Optional Maximum number of feedback entries to return, between 1 and 500. The most recent entries are returned. Without it, all the approved feedback is returned.
with_comment int (1/0) Optional 1 in order to fetch only the feedback that has a written comment (entries with only a score are skipped). Default 0. It is applied before limit, so limit=10&with_comment=1 returns the 10 most recent feedback entries with a comment.

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.

Response details

  • The feedback entries are returned newest first (ordered by added_on).
  • The feedback entries whose order no longer exists are skipped.
  • Scores are on a 1–10 scale, both for the feedback and for the product reviews.
  • product_reviews contains the product reviews from the same order, pending or approved (rejected reviews are not included). Reviews for products deleted from your catalog are skipped.
  • The feedback comment can be null or an empty string, unless you use with_comment=1.
  • Dates are returned in ISO 8601 format, in UTC (Example: 2026-11-16T14:35:16.730000Z).

Recommendations

  • Call the API only from your server. Your REST API Key must never be exposed in the JavaScript code that runs in the browser.
  • Cache the results (for example for 1 hour) instead of calling the API on every page view.
  • For a “4.9/5 from 1234 reviews” block with a carousel of the latest reviews, use Feedback summary for the average score and the number of reviews, and this method with limit=10&with_comment=1 for the carousel.
  • If you sync the feedback incrementally using the t parameter:
    • deduplicate the entries by id;
    • use the maximum added_on you received (converted to a Unix timestamp) as the next t, not the last entry of the list, because the list is ordered newest first;
    • run a full sync periodically, because feedback approved later and comments added after the score do not change added_on.

Example

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

   $apiURL = "https://api.retargeting.app/v1/email-campaigns/json-feedback";
   $apiKey = "REST_KEY";
   $customerId = "CUSTOMER_ID";

   $client = new GuzzleHttp\Client();

   $feedbackData = [
       "k" => $apiKey,
       "u" => $customerId,
       "limit" => 10,
       "with_comment" => 1
   ];

   $statusRequest = $client->request("GET", $apiURL, ["query" => $feedbackData]);

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

[
    {
        "order": {
            "ordno": "27047",
            "date": "2021-05-04T19:57:50.483000Z"
        },
        "score": 10,
        "comment": "Great products",
        "added_on": "2021-05-20T14:25:27.112000Z",
        "id": "6afb15248dabad8eff26cf24",
        "product_reviews": [
            {
                "realid": "2183",
                "added_on": "2022-03-20T11:45:32.904000Z",
                "score": 9,
                "comment": "Perfect match for my summer outfits"
            }
        ]
    },
    {
        ...
    }
]

Multiple product reviews found:

[
    {
        "order": {
            "ordno": "27047",
            "date": "2021-05-04T19:57:50.483000Z"
        },
        "score": 10,
        "comment": "Great products",
        "added_on": "2021-05-20T14:25:27.112000Z",
        "id": "6afb15248dabad8eff26cf24",
        "product_reviews": [
            {
                "realid": "2183",
                "added_on": "2022-03-20T11:45:32.904000Z",
                "score": 9,
                "comment": "Perfect match for my summer outfits"
            },
            {
                "realid": "2182",
                "added_on": "2022-03-20T11:47:32.217000Z",
                "score": 7,
                "comment": "Very comfortable"
            }
        ]
    },
    {
        ...
    }
]

Product reviews can have score or comment returned as null (either one, but NEVER both):

[
    {
        "order": {
            "ordno": "27047",
            "date": "2021-05-04T19:57:50.483000Z"
        },
        "score": 10,
        "comment": "Great products",
        "added_on": "2021-05-20T14:25:27.112000Z",
        "id": "6afb15248dabad8eff26cf24",
        "product_reviews": [
            {
                "realid": "2183",
                "added_on": "2022-03-20T11:45:32.904000Z",
                "score": null,
                "comment": "Perfect match for my summer outfits"
            },
            {
                "realid": "2182",
                "added_on": "2022-03-20T11:47:32.217000Z",
                "score": 7,
                "comment": null
            }
        ]
    },
    {
        ...
    }
]

If no product reviews are found:

[
    {
        "order": {
            "ordno": "27047",
            "date": "2021-05-04T19:57:50.483000Z"
        },
        "score": 10,
        "comment": "Great products",
        "added_on": "2021-05-20T14:25:27.112000Z",
        "id": "6afb15248dabad8eff26cf24",
        "product_reviews": []
    },
    {
        ...
    }
]

If the API call fails, the response will be returned with the HTTP status 200 and "status": "error", as seen below:

When the customer id parameter is not provided:

{
    "status": "error",
    "error": "No customer id provided!"
}
                    

When the rest key parameter is not provided:

{
    "status": "error",
    "error": "No rest key provided!"
}
                    

When the rest key parameter is invalid:

{
    "status": "error",
    "error": "Incorrect rest key!"
}
                    

When the customer id parameter is invalid:

{
    "status": "error",
    "error": "No customer found with the provided id!"
}
                    

When the account is not active:

{
    "status": "error",
    "error": "Your account is not active!"
}
                    

When the t parameter is invalid:

{
    "status": "error",
    "error": "Invalid t parameter! It must be a Unix timestamp in seconds (e.g. 1700000000)."
}
                    

When the limit parameter is invalid:

{
    "status": "error",
    "error": "Invalid limit parameter! It must be an integer between 1 and 500."
}
                    

When the with_comment parameter is invalid:

{
    "status": "error",
    "error": "Invalid with_comment parameter! Use 1 or 0."
}
                    

Unexpected server errors are returned with the HTTP status 500 and a generic response, not in the format above.