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

# Webhooks

> Wishlist events posted as signed JSON to your own URLs: topics, payloads, headers, signature verification and retries.

Loveful can POST wishlist events to your own HTTPS endpoints, for Zapier, Make or your own systems. Webhooks are available on every plan.

Set them up in **Loveful > Settings > Integrations > Webhooks**. Each store can have up to **5** endpoints, and each endpoint chooses which topics it receives.

## Topics

| Topic | In Loveful | Sent when |
| - | - | - |
| `wishlist.item_added` | Item saved | A signed-in shopper saves an item. |
| `wishlist.item_removed` | Item removed | A signed-in shopper removes an item. |
| `wishlist.shared` | Wishlist shared | A signed-in shopper shares their wishlist by link or email. |
| `wishlist.purchase` | Wishlist purchase | An order includes items that were on the customer's wishlist. |
| `wishlist.test` | Send test | You press **Send test** on an endpoint. Can't be subscribed to. |

> [!NOTE]
>
> Saves and removes by guests (shoppers who aren't signed in) are not sent to webhooks.

## Request

Every event is an HTTPS `POST` with a JSON body.

| Header | Value |
| - | - |
| `Content-Type` | `application/json` |
| `User-Agent` | `Loveful-Webhooks/1.0` |
| `X-Loveful-Signature` | The hex HMAC-SHA256 of the raw body. See [Verifying signatures](#verifying-signatures). |

### Envelope

Every topic shares one envelope:

**event** `string` *required*

The topic, for example `wishlist.item_added`.

**id** `string` *required*

A UUID for this event. Retries of the same delivery carry the same `id`, so use it to ignore duplicates.

**createdAt** `string` *required*

When the event was built, ISO 8601 in UTC.

**shop** `object` *required*

**properties**

**domain** `string`

The store's `myshopify.com` domain.

**data** `object` *required*

The topic's data, below.

### Product object

Used by `wishlist.item_added`, `wishlist.item_removed` and the items of `wishlist.purchase`. Only `variantId` is guaranteed: the other fields are included when Loveful has the variant's details synced.

| Field | Type | Description |
| - | - | - |
| `variantId` | number | Shopify's numeric variant id. |
| `productId` | number | Shopify's numeric product id. |
| `title` | string | The product's title. |
| `variantTitle` | string or null | The variant's title, `null` for a product with only the default variant. |
| `sku` | string or null | The variant's SKU. |
| `price` | number | The variant's price. |
| `currency` | string | The store's currency code. |
| `imageUrl` | string or null | The product or variant image. |
| `url` | string | `https://<shop domain>/products/<handle>?variant=<variantId>` |

### wishlist.item\_added and wishlist.item\_removed

| Field | Type | Description |
| - | - | - |
| `customer.id` | number | Shopify's numeric customer id. |
| `customer.email` | string or null | The customer's email, when Loveful can read it. |
| `wishlistItemCount` | number | Items on the wishlist after the change. |
| `product` | object or null | The [product](#product-object) saved or removed. |

```json wishlist.item_added theme={null}
{
  "event": "wishlist.item_added",
  "id": "5b0c8a52-3f1e-4f3b-9d7c-2a1e6f0c9b41",
  "createdAt": "2026-12-04T10:15:30.000Z",
  "shop": { "domain": "example.myshopify.com" },
  "data": {
    "customer": { "id": 7012345678901, "email": "sam@example.com" },
    "wishlistItemCount": 3,
    "product": {
      "variantId": 44012345678901,
      "productId": 8012345678901,
      "title": "Linen shirt",
      "variantTitle": "Medium / Blue",
      "sku": "LS-M-BLU",
      "price": 45,
      "currency": "GBP",
      "imageUrl": "https://cdn.shopify.com/s/files/1/0000/0001/files/linen-shirt.jpg",
      "url": "https://example.myshopify.com/products/linen-shirt?variant=44012345678901"
    }
  }
}
```

### wishlist.shared

| Field | Type | Description |
| - | - | - |
| `customer.id` | number | Shopify's numeric customer id. |
| `customer.email` | string or null | The customer's email, when Loveful can read it. |
| `wishlistItemCount` | number | Items on the shared wishlist. |
| `share.method` | string | `link` or `email`. |
| `share.url` | string or null | The share link. |

```json wishlist.shared theme={null}
{
  "event": "wishlist.shared",
  "id": "a4f7e1c2-8b3d-4e6f-9a0b-1c2d3e4f5a6b",
  "createdAt": "2026-12-04T10:20:00.000Z",
  "shop": { "domain": "example.myshopify.com" },
  "data": {
    "customer": { "id": 7012345678901, "email": "sam@example.com" },
    "wishlistItemCount": 3,
    "share": {
      "method": "link",
      "url": "https://example.com/pages/shared-wishlist?loveful_token=abc123"
    }
  }
}
```

### wishlist.purchase

Sent once per order: an order is never sent twice within 30 days.

| Field | Type | Description |
| - | - | - |
| `orderId` | number | Shopify's numeric order id. |
| `customer.email` | string or null | The order's email. |
| `currency` | string | The store's currency code. |
| `value` | number | The total of the wishlisted lines, rounded to 2 decimals. |
| `items` | array | One per wishlisted line: the [product](#product-object) fields plus `quantity` (number) and `lineAmount` (number). |

```json wishlist.purchase theme={null}
{
  "event": "wishlist.purchase",
  "id": "c3d2e1f0-1a2b-4c3d-8e9f-0a1b2c3d4e5f",
  "createdAt": "2026-12-04T11:02:41.000Z",
  "shop": { "domain": "example.myshopify.com" },
  "data": {
    "orderId": 6012345678901,
    "customer": { "email": "sam@example.com" },
    "currency": "GBP",
    "value": 90,
    "items": [
      {
        "variantId": 44012345678901,
        "productId": 8012345678901,
        "title": "Linen shirt",
        "variantTitle": "Medium / Blue",
        "sku": "LS-M-BLU",
        "price": 45,
        "currency": "GBP",
        "imageUrl": "https://cdn.shopify.com/s/files/1/0000/0001/files/linen-shirt.jpg",
        "url": "https://example.myshopify.com/products/linen-shirt?variant=44012345678901",
        "quantity": 2,
        "lineAmount": 90
      }
    ]
  }
}
```

### wishlist.test

```json wishlist.test theme={null}
{
  "event": "wishlist.test",
  "id": "0f1e2d3c-4b5a-4968-8776-655443322110",
  "createdAt": "2026-12-04T09:00:00.000Z",
  "shop": { "domain": "example.myshopify.com" },
  "data": { "message": "A test event from Loveful. Your endpoint is set up." }
}
```

## Verifying signatures

Each endpoint has its own signing secret, starting `whsec_`. It is shown once, when the endpoint is created. **Regenerate signing secret** makes a new one, shown once, and the old one stops working at once.

`X-Loveful-Signature` is the HMAC-SHA256 of the raw request body, keyed with the whole secret string (including `whsec_`), as lowercase hex. To verify:

1. Read the raw body as bytes, before any JSON parsing.
2. Compute the HMAC-SHA256 of it with your secret, as hex.
3. Compare it with the header using a constant-time comparison, and reject the request if they differ.

> [!WARNING]
>
> Sign the exact bytes you received. Parsing the JSON and serialising it again changes the body and the signature will not match.

```js Node (Express) theme={null}
import crypto from "node:crypto";
import express from "express";

const app = express();
const secret = process.env.LOVEFUL_WEBHOOK_SECRET; // whsec_...

const verify = (rawBody, signature) => {
  const expected = crypto.createHmac("sha256", secret).update(rawBody).digest("hex");
  const a = Buffer.from(expected, "utf8");
  const b = Buffer.from(String(signature ?? ""), "utf8");
  return a.length === b.length && crypto.timingSafeEqual(a, b);
};

app.post("/webhooks/loveful", express.raw({ type: "application/json" }), (req, res) => {
  if (!verify(req.body, req.get("X-Loveful-Signature"))) {
    return res.status(401).send("Invalid signature");
  }
  const event = JSON.parse(req.body.toString("utf8"));
  // Respond quickly, then do the work.
  res.sendStatus(200);
  handle(event);
});
```

```php PHP theme={null}
<?php
$secret = getenv('LOVEFUL_WEBHOOK_SECRET'); // whsec_...
$body = file_get_contents('php://input');
$signature = $_SERVER['HTTP_X_LOVEFUL_SIGNATURE'] ?? '';

$expected = hash_hmac('sha256', $body, $secret);

if (!hash_equals($expected, $signature)) {
    http_response_code(401);
    exit('Invalid signature');
}

$event = json_decode($body, true);
http_response_code(200);
// handle $event['event'] and $event['data']
```

The signature covers the body only, with no timestamp. To guard against replays, record each `id` you've handled and ignore repeats, and check `createdAt` is recent.

## Responding and retries

Return any `2xx` status to acknowledge an event. The response body is ignored.

* Each attempt times out after **10 seconds**.
* A delivery is tried up to **3 times** in all. It is retried after a timeout or network error, or a `408`, `425`, `429` or `5xx` response. Other `4xx` responses are not retried.
* Retries wait 0.5 seconds, then 1 second, or the time in a `Retry-After` header when the endpoint sends one.
* Redirects (`301`, `302`, `303`, `307`, `308`) are followed up to 3 times, each target checked by the same URL rules.

After the last attempt the event is dropped: there is no later redelivery. Each endpoint in Settings shows its last status, error and time, and **Send test** delivers a `wishlist.test` event with a real signature to check your endpoint.

## Endpoint URLs

* Must start with `https://`.
* Must be a public address: Loveful won't send to private or internal networks.
* The URL can't be changed after the endpoint is created. To use a different URL, add a new webhook, which gets its own secret. The topics can be changed at any time.


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