Webhooks

Prev Next

Webhooks let an external system receive product catalog changes from Mapp as they happen, without repeatedly polling the API. When an event you subscribed to occurs, Mapp sends an HTTP request to a URL you control.


How webhooks work

Webhooks are outbound only: Mapp sends data to your endpoint. A webhook event notifies you that something changed. It does not carry the full resource.

The flow is:

  1. You register a callback URL and subscribe to one or more event types.

  2. When a subscribed event occurs, Mapp sends the event as a signed HTTP POST to your URL.

  3. The event contains identifiers for the changed resource, not the full resource.

  4. Your system verifies the signature and uses the identifiers to fetch the current data from the product catalog API.


Authentication

Webhooks use the same authentication as the other Mapp APIs. You generate a client ID and client secret, exchange them for a bearer token, and send that token on every request to the webhooks management API. See Authentication for details.

Your company and workspace are resolved from the token, so you do not pass them in the request.


Subscribe to events

You create a subscription by sending your callback URL and the event types you want to the webhooks management API.

  • The callback URL must use HTTPS.

  • To use your own secret, send it in the secret field. Otherwise Mapp generates one. The secret signs every event (see Verify event signatures). It is returned only when the subscription is created or the secret is rotated, so store it securely.

  • When you create a subscription or change its URL, Mapp sends a signed webhook.url.verification event to the callback URL. Your endpoint must accept it with a 2xx status, otherwise the request fails.

Subscriptions are managed at the company level. A subscription applies to all product catalogs in your company, even though the token is issued for a single workspace.

POST https://api.mapp.com/api/webhooks-management/webhooks
{
  "url": "https://example.com/webhook",
  "event_types": ["variant.added", "variant.updated"]
}

The management API also lets you list, update, pause and delete subscriptions, test the callback URL, and rotate the secret. For all endpoints and parameters, see the webhook-service specification.


Verify event signatures

Every event is signed so you can confirm it came from Mapp. Mapp signs each event with HMAC-SHA256 using your subscription secret and sends two headers:

X-Webhook-Signature: t=1706362526,v1=<hex_signature>
X-Webhook-Timestamp: 1706362526

To verify an event:

  1. Read the timestamp and the v1 signature from the headers.

  2. Reject the request if the timestamp differs from the current time by more than 5 minutes in either direction. This limits replay attacks.

  3. Build the signed payload as timestamp + "." + raw_request_body, using the unmodified request body.

  4. Compute HMAC_SHA256(secret, signed_payload) and hex-encode it.

  5. Compare the result with the v1 value. If they match, the event is authentic.

Always verify against the raw request body exactly as received, before parsing it.


Event types

The following product catalog events are available:

  • variant.added: A variant is added, or missing data is added to an existing variant.

  • variant.updated: A variant is partially updated with the provided fields, or created if it did not exist.

  • variant.upserted: A variant is created or fully replaced.

  • variant.deleted: A variant is deleted.

  • variant.processing.failed: A variant could not be stored because of a validation or system error. The payload includes the reason.


Event payload

Every event shares a common envelope. The data object holds the fields specific to the event type.

{
  "id": "87d61ed2-2b0f-44bd-9c77-c7f3f0ed05b5",
  "event_type": "variant.added",
  "api_version": "2026-01-01",
  "created_at": "2026-01-27T14:45:00Z",
  "company_id": 100,
  "event_id": "evt_123456",
  "data": {
    "variant_id": "DRESS-5892-BLK-36",
    "product_id": "DRESS-5892",
    "catalog_id": 123,
    "catalog_type": "SOURCE"
  }
}

Key fields:

  • id: The delivery ID. It is unique per event and stays the same if a delivery is retried. Use it to avoid processing the same event twice.

  • event_id: References the original action that caused the event.

  • created_at: When the event occurred (ISO 8601, UTC). Use it to apply events in the correct order.

  • data.catalog_type: Either SOURCE or ENRICHED.

For variant.processing.failed, data also contains an error object with a code and message.


Delivery and retries

Your endpoint acknowledges an event by returning a 2xx status. A delivery is treated as failed on a 4xx or 5xx response, a connection error, or a timeout (connection timeout 5 seconds, response timeout 15 seconds).

Mapp retries a failed delivery up to three attempts in total, waiting 1 second before the second attempt and 2 seconds before the third. If all three fail, the delivery is dropped.

Each subscription has a status:

  • active: Healthy. Events are delivered.

  • failing: Recent deliveries failed. Events are still attempted.

  • paused: You disabled the subscription.

  • archived: The system disabled the subscription after persistent failures.

If a subscription keeps failing (by default, 100 consecutive failures or 48 hours of continuous failure), the system archives it and stops delivering. To reactivate it, fix your endpoint and set the status back to active through the management API.

While a subscription is paused or archived, events are not delivered and not stored for later, so they are lost.

Because deliveries can be repeated or arrive out of order, deduplicate on id and order by created_at.


Fetch the updated resource

A webhook event identifies what changed but does not include the full variant. To get the current data, call the product catalog API with the identifiers from the event:

GET /api/product-catalog/v1/catalogs/{catalog_id}/variants?variantId={variant_id}

URL-encode the variant ID if it contains special characters.

Deleted variants cannot be fetched. Use variant.deleted to remove the variant on your side.


Best practices

  • Verify the signature of every event before processing it.

  • Respond with 2xx quickly and process the event asynchronously, so you stay within the response timeout.

  • Deduplicate on the event id, because an event can be delivered more than once.

  • Keep your endpoint reachable to avoid the subscription being archived.