> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stackfront.digital/llms.txt
> Use this file to discover all available pages before exploring further.

# Judge.me reviews

Stackfront syncs your published Judge.me product reviews and serves them to the
mobile app as a typed, cache-first payload. Reviews are read-only: the app
displays them, it never submits or moderates them.

## What you get

* Average rating and total published review count per product.
* A 1–5 star distribution with zero-filled buckets.
* Newest-first published reviews with title, body, author name, verified-purchase
  flag, up to six photo thumbnails, and the original review date.
* HTML stripped and reviewer email addresses removed before anything is stored.

## Requirements

* Stackfront **Growth** plan or higher (integration reads are plan-gated).
* Judge.me installed on the same Shopify store.
* A Judge.me **Private API token**.

Judge.me plan support is governed by Judge.me: the provider uses their REST API.
Free-plan API access has not been verified, so if your token is rejected, confirm
with Judge.me that your plan exposes API tokens.

## Connect

1. In Judge.me, open **Settings → Integrations**.
2. Click **View API tokens**.
3. Copy the **Private API token**.
4. In Stackfront, open **Integrations → Judge.me → Connect** and paste the token.

Stackfront validates the token against your shop domain, encrypts it, and
starts the first sync in the background. The token is never returned to the
browser and never appears in the SDK.

## SDK usage

```tsx theme={null}
import {
  useConfig,
  useProductReviews,
} from '@stackfront/react-native-shopify';

function Reviews({ productId }: { productId: string }) {
  const { config } = useConfig();
  const enabled = config?.integrations?.judgeme?.connected === true;

  const { data, loading, error } = useProductReviews(productId, { enabled });

  if (!enabled || (!loading && !data)) return null;
  if (loading) return null;
  if (error) return <Text>Reviews are unavailable right now.</Text>;

  return (
    <ReviewList
      reviews={data.reviews}
      average={data.aggregates.averageRating}
      total={data.aggregates.totalCount}
    />
  );
}
```

### Hook API

```ts theme={null}
function useProductReviews(
  productId: string,
  options?: { enabled?: boolean }
): {
  data: ProductReviews | null;
  loading: boolean;
  error: Error | null;
  refetch: () => Promise<void>;
}
```

* `productId` accepts a Storefront GID (`gid://shopify/Product/123`) or a bare
  numeric id.
* `data` is `null` while loading, when Judge.me is not connected (`422`), when
  no cache exists yet (`503`), and when the cached payload cannot be parsed.
* Only `500`-class and network failures reach `error`.
* Cached by the SDK's default `staleTime` (60 seconds) with one retry; no polling.

### Helpers

```ts theme={null}
import {
  toShopifyProductId,   // "gid://shopify/Product/123" → "123"
  parseProductReviews,  // safe parse, never throws
  ratingDistribution,   // counts ordered 5 → 1
} from '@stackfront/react-native-shopify';
```

## Payload reference

`GET /api/v1/sdk/integrations/judgeme/product_reviews?entityId=<numeric id>`
returns the cached payload inside `data` as a JSON string:

```json theme={null}
{
  "source": "judgeme",
  "productId": "8123456789012",
  "reviews": [
    {
      "externalId": "987654321",
      "rating": 5,
      "title": "Exactly as described",
      "body": "Arrived in two days and the fabric is great.",
      "authorName": "Jane D.",
      "isVerifiedPurchase": true,
      "mediaUrls": ["https://judgeme.imgix.net/.../image.jpg?w=200"],
      "createdAt": "2026-10-01T12:00:00+00:00"
    }
  ],
  "aggregates": {
    "averageRating": 4.67,
    "totalCount": 3,
    "distribution": { "1": 0, "2": 0, "3": 0, "4": 1, "5": 2 }
  }
}
```

`distribution` always has keys `"1"`–`"5"`. `averageRating` is rounded to two
decimals and is `0` when there are no reviews. `totalCount` counts the published
reviews in `reviews`.

## What is synced

* Published product reviews only: `curated = "ok"` and not hidden.
* Product reviews only; shop-level and store reviews are not included.
* No reviewer email, IP address, or other PII.
* Titles capped at 200 characters, bodies at 4,000, both HTML-stripped.
* Up to 5,000 reviews per sync (50 pages × 100), newest first.
* Every 60 minutes, plus **Sync now** in the dashboard.

If a sync hits the 5,000-review cap it is marked truncated, and older cache rows
are kept rather than pruned.

## Limitations

* No review submission, voting, or moderation from the app.
* No translation of review text.
* No real-time updates: new reviews appear after the next sync.
* The product must exist in the synced Judge.me review set to have data; a
  product with no published reviews renders nothing.

## Troubleshooting

| Symptom | Cause and fix |
| - | - |
| "Judge.me rejected that API token." | The token is wrong or revoked. Copy the Private API token again from **Settings → Integrations → View API tokens**. |
| "That token belongs to a different Judge.me store." | The token was copied from another shop's Judge.me admin. Use this store's token. |
| "Judge.me couldn't find a store for this domain." | Judge.me is not installed on this Shopify store, or the domain does not match. |
| "Judge.me is rate-limiting requests right now." | Wait a minute and retry. Scheduled syncs also back off and retry. |
| Connected but the app shows nothing. | The first sync may still be running, or the product has no published reviews. Check the last-sync status in the dashboard, then **Sync now**. |
| A product shows fewer reviews than Judge.me. | Hidden, spam, and unpublished reviews are excluded by design. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.