# Review Response SLA Breach Audit (`practical_ai_lab_jp/pal-maps-service-recovery-sla-audit`) Actor

Measure unresolved negative reviews and response-time SLA breaches per location from your own de-identified export.

- **URL**: https://apify.com/practical_ai_lab_jp/pal-maps-service-recovery-sla-audit.md
- **Developed by:** [Practical AI Lab](https://apify.com/practical_ai_lab_jp) (community)
- **Categories:** Lead generation, SEO tools
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $20.00 / 1,000 location auditeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Review Response SLA Breach Audit

Measure how many negative reviews in your multi-location portfolio were answered late or are still unanswered, against the response time you agreed to deliver. The Actor works only on an export you supply. It does not scrape Google Maps or any other site, does not post replies, and never contacts reviewers.

### What it answers

- Which locations breach the agreed response SLA, and how often?
- How many negative reviews are still unresolved past the SLA right now?
- How long do answered reviews take (median and P90 hours) per location?
- Which breaches are critical (elapsed time above a multiple of the SLA)?

### Input

Copy the prefilled sample in the Actor input, or supply your own `reviews` array:

```json
{
  "reviews": [
    {"locationId": "store-north", "reviewId": "r001", "rating": 1,
     "reviewTimestamp": "2026-03-01T09:00:00Z", "responseTimestamp": "2026-03-02T09:00:00Z"},
    {"locationId": "store-north", "reviewId": "r003", "rating": 1,
     "reviewTimestamp": "2026-03-05T12:00:00Z"}
  ],
  "asOf": "2026-03-10T00:00:00Z",
  "responseSlaHours": 48,
  "locationSlaHours": {"store-south": 24},
  "minSampleSize": 3
}
```

Each review needs `locationId`, `reviewId`, `rating` (1-5) and `reviewTimestamp`; `responseTimestamp` is empty for unanswered reviews. IDs must be de-identified codes (letters, digits, `_ . : -`, up to 64 characters). Records with names, emails or free text in the ID fields are rejected, and all other fields are ignored, so review text and reviewer details are never read.

Options: default SLA hours, per-location SLA overrides, scope (negative only or all ratings), highest rating counted as negative, critical multiplier, minimum sample size, attention breach percentage, breach row cap and review cap. Set `asOf` for reproducible results; otherwise the run time is used.

### Output

The dataset contains three record types:

- `portfolio` - one row of totals, rejected/duplicate counts, truncation flag and caveats.
- `location` - per-location counts, breach rate, median and P90 response hours, oldest unresolved age and a flag: `attention`, `within_target`, `low_sample` or `no_in_scope_reviews`.
- `review` - breached reviews (late or unresolved) with hours over SLA and severity, largest overrun first, capped by `maxBreachRows`.

A summary and samples of rejected records are also stored in the key-value store record `OUTPUT`.

### Pricing and billing behavior

The code emits one `location-audited` event per audited location, only after results are stored. Runs that fail input validation or produce no valid location are not charged. No payable plan is configured in this project; any pricing must be set and verified separately.

### Limitations and caveats

- **Sample size:** a location with a handful of negative reviews can show a 50% or 100% breach rate from one case. Locations below `minSampleSize` (default 10) are flagged `low_sample`; treat them as anecdotes.
- **Data quality:** results are only as good as the export. If your source omits responses or records them late, they appear as unresolved or late.
- **Calendar hours:** business hours, time zones of opening times and holidays are not modelled; timestamps without a zone are treated as UTC.
- **Scope:** only the first response timestamp is used; edited or repeated replies, review text and sentiment are not analyzed.
- **Capacity:** up to 50,000 reviews per run, and results are not verified against any platform.
- It does not establish causes, customer outcomes or revenue impact.

### Local tests

Offline unit tests are in `tests/` and use only the standard library for the analysis module (`python -m unittest discover -s tests`).

# Actor input Schema

## `reviews` (type: `array`):

Array of objects with locationId, reviewId (de-identified codes, no names or emails), rating (1-5), reviewTimestamp, and optional responseTimestamp (ISO 8601). Other fields are ignored.

## `asOf` (type: `string`):

ISO 8601 time used to measure how long unanswered reviews have been open. Leave empty to use the current time; set it for reproducible results.

## `responseSlaHours` (type: `integer`):

Agreed maximum hours between a review and the first response.

## `locationSlaHours` (type: `object`):

Optional map of locationId to SLA hours, for locations with a different agreement.

## `scope` (type: `string`):

Audit only negative reviews, or every review regardless of rating.

## `negativeRatingMax` (type: `integer`):

Reviews at or below this star rating are negative.

## `escalationMultiplier` (type: `integer`):

A breach becomes critical when elapsed time exceeds the SLA times this value.

## `minSampleSize` (type: `integer`):

Locations below this count are flagged low_sample. The default is 10; the sample input uses 3 to demonstrate attention flags.

## `attentionBreachPercent` (type: `integer`):

Locations with at least this breach percentage, and enough sample, are flagged attention.

## `maxBreachRows` (type: `integer`):

Cap on per-review breach rows in the dataset (largest overrun first). Set 0 for summaries only.

## `maxReviews` (type: `integer`):

Records beyond this count are ignored and reported as truncation.

## Actor input object example

```json
{
  "reviews": [
    {
      "locationId": "store-north",
      "reviewId": "r001",
      "rating": 1,
      "reviewTimestamp": "2026-03-01T09:00:00Z",
      "responseTimestamp": "2026-03-02T09:00:00Z"
    },
    {
      "locationId": "store-north",
      "reviewId": "r002",
      "rating": 2,
      "reviewTimestamp": "2026-03-01T10:00:00Z",
      "responseTimestamp": "2026-03-04T10:00:00Z"
    },
    {
      "locationId": "store-north",
      "reviewId": "r003",
      "rating": 1,
      "reviewTimestamp": "2026-03-05T12:00:00Z"
    },
    {
      "locationId": "store-north",
      "reviewId": "r004",
      "rating": 5,
      "reviewTimestamp": "2026-03-06T12:00:00Z"
    },
    {
      "locationId": "store-south",
      "reviewId": "r101",
      "rating": 2,
      "reviewTimestamp": "2026-03-02T08:00:00Z",
      "responseTimestamp": "2026-03-02T20:00:00Z"
    },
    {
      "locationId": "store-south",
      "reviewId": "r102",
      "rating": 1,
      "reviewTimestamp": "2026-03-09T08:00:00Z"
    },
    {
      "locationId": "store-south",
      "reviewId": "r103",
      "rating": 1,
      "reviewTimestamp": "2026-03-03T08:00:00Z"
    }
  ],
  "asOf": "2026-03-10T00:00:00Z",
  "responseSlaHours": 48,
  "locationSlaHours": {
    "store-south": 24
  },
  "scope": "negativeOnly",
  "negativeRatingMax": 2,
  "escalationMultiplier": 2,
  "minSampleSize": 3,
  "attentionBreachPercent": 25,
  "maxBreachRows": 500,
  "maxReviews": 20000
}
```

# Actor output Schema

## `results` (type: `string`):

Download rows from the latest run in JSON/CSV.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "reviews": [
        {
            "locationId": "store-north",
            "reviewId": "r001",
            "rating": 1,
            "reviewTimestamp": "2026-03-01T09:00:00Z",
            "responseTimestamp": "2026-03-02T09:00:00Z"
        },
        {
            "locationId": "store-north",
            "reviewId": "r002",
            "rating": 2,
            "reviewTimestamp": "2026-03-01T10:00:00Z",
            "responseTimestamp": "2026-03-04T10:00:00Z"
        },
        {
            "locationId": "store-north",
            "reviewId": "r003",
            "rating": 1,
            "reviewTimestamp": "2026-03-05T12:00:00Z"
        },
        {
            "locationId": "store-north",
            "reviewId": "r004",
            "rating": 5,
            "reviewTimestamp": "2026-03-06T12:00:00Z"
        },
        {
            "locationId": "store-south",
            "reviewId": "r101",
            "rating": 2,
            "reviewTimestamp": "2026-03-02T08:00:00Z",
            "responseTimestamp": "2026-03-02T20:00:00Z"
        },
        {
            "locationId": "store-south",
            "reviewId": "r102",
            "rating": 1,
            "reviewTimestamp": "2026-03-09T08:00:00Z"
        },
        {
            "locationId": "store-south",
            "reviewId": "r103",
            "rating": 1,
            "reviewTimestamp": "2026-03-03T08:00:00Z"
        }
    ],
    "asOf": "2026-03-10T00:00:00Z",
    "locationSlaHours": {
        "store-south": 24
    },
    "minSampleSize": 3
};

// Run the Actor and wait for it to finish
const run = await client.actor("practical_ai_lab_jp/pal-maps-service-recovery-sla-audit").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "reviews": [
        {
            "locationId": "store-north",
            "reviewId": "r001",
            "rating": 1,
            "reviewTimestamp": "2026-03-01T09:00:00Z",
            "responseTimestamp": "2026-03-02T09:00:00Z",
        },
        {
            "locationId": "store-north",
            "reviewId": "r002",
            "rating": 2,
            "reviewTimestamp": "2026-03-01T10:00:00Z",
            "responseTimestamp": "2026-03-04T10:00:00Z",
        },
        {
            "locationId": "store-north",
            "reviewId": "r003",
            "rating": 1,
            "reviewTimestamp": "2026-03-05T12:00:00Z",
        },
        {
            "locationId": "store-north",
            "reviewId": "r004",
            "rating": 5,
            "reviewTimestamp": "2026-03-06T12:00:00Z",
        },
        {
            "locationId": "store-south",
            "reviewId": "r101",
            "rating": 2,
            "reviewTimestamp": "2026-03-02T08:00:00Z",
            "responseTimestamp": "2026-03-02T20:00:00Z",
        },
        {
            "locationId": "store-south",
            "reviewId": "r102",
            "rating": 1,
            "reviewTimestamp": "2026-03-09T08:00:00Z",
        },
        {
            "locationId": "store-south",
            "reviewId": "r103",
            "rating": 1,
            "reviewTimestamp": "2026-03-03T08:00:00Z",
        },
    ],
    "asOf": "2026-03-10T00:00:00Z",
    "locationSlaHours": { "store-south": 24 },
    "minSampleSize": 3,
}

# Run the Actor and wait for it to finish
run = client.actor("practical_ai_lab_jp/pal-maps-service-recovery-sla-audit").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "reviews": [
    {
      "locationId": "store-north",
      "reviewId": "r001",
      "rating": 1,
      "reviewTimestamp": "2026-03-01T09:00:00Z",
      "responseTimestamp": "2026-03-02T09:00:00Z"
    },
    {
      "locationId": "store-north",
      "reviewId": "r002",
      "rating": 2,
      "reviewTimestamp": "2026-03-01T10:00:00Z",
      "responseTimestamp": "2026-03-04T10:00:00Z"
    },
    {
      "locationId": "store-north",
      "reviewId": "r003",
      "rating": 1,
      "reviewTimestamp": "2026-03-05T12:00:00Z"
    },
    {
      "locationId": "store-north",
      "reviewId": "r004",
      "rating": 5,
      "reviewTimestamp": "2026-03-06T12:00:00Z"
    },
    {
      "locationId": "store-south",
      "reviewId": "r101",
      "rating": 2,
      "reviewTimestamp": "2026-03-02T08:00:00Z",
      "responseTimestamp": "2026-03-02T20:00:00Z"
    },
    {
      "locationId": "store-south",
      "reviewId": "r102",
      "rating": 1,
      "reviewTimestamp": "2026-03-09T08:00:00Z"
    },
    {
      "locationId": "store-south",
      "reviewId": "r103",
      "rating": 1,
      "reviewTimestamp": "2026-03-03T08:00:00Z"
    }
  ],
  "asOf": "2026-03-10T00:00:00Z",
  "locationSlaHours": {
    "store-south": 24
  },
  "minSampleSize": 3
}' |
apify call practical_ai_lab_jp/pal-maps-service-recovery-sla-audit --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,practical_ai_lab_jp/pal-maps-service-recovery-sla-audit"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/9NhFFsQsfiATmcoxA/builds/Zdu13RClHkQhcldsF/openapi.json
