Webhooks

A shop can ask Tienda to call a URL when something happens, for example when an order is paid. Each call is signed, so the receiver can check it came from the shop. This page is about outgoing webhooks. (Tienda also receives webhooks from payment gateways and the mail server; those are on their own pages.)

The manual has the screens: Integrations, Webhooks.

Endpoints

A shop administrator makes endpoints under Settings, Webhooks, or over the API (/api/v1/webhooks/endpoints, administrators only, module Core). An endpoint has:

FieldMeaning
urlMust start with http:// or https://. Use https.
eventsThe events it wants (a list).
activeSwitch it off without deleting it.
descriptionFree text.
secretMade by Tienda, 64 hexadecimal characters. Shown to administrators.

GET /api/v1/webhooks/endpoints/supported_events lists the events. POST /api/v1/webhooks/endpoints/:id/test queues a test.ping call.

Events

EventWhen
order.created, order.updatedAn order is created or changed.
order.paidA payment is recorded and the order is then paid in full.
order.fulfilledThe last open fulfilment of the order is completed.
order.fulfillment_updatedA fulfilment of the order changes.
contact.created, contact.updatedA CRM contact is created or changed.
product.created, product.updated, product.destroyedA product is created, changed or deleted.

A call goes only to endpoints of the same shop that are active and have chosen the event. There are no events for other records yet.

The call

Tienda sends a POST with a JSON body and three headers:

HeaderValue
Content-Typeapplication/json
X-Webhook-EventThe event name, such as order.paid.
X-Webhook-SignatureThe HMAC-SHA256 of the raw body, with the endpoint's secret as key, written as lowercase hexadecimal.

The body has id, type and attributes. attributes is the record as the database holds it, without updated_at. Which fields it has follows the record's columns and can change between releases; it includes internal numbers such as the shop's own id, and money as strings. Example for an order (made-up values, shortened):

{
  "id": 1001,
  "type": "order",
  "attributes": {
    "id": 1001,
    "number": 5001,
    "channel": "register",
    "order_date": "2026-11-10T09:30:00.000Z",
    "currency": "USD",
    "persisted_total": "24.50",
    "discount": "0.0",
    "customer_id": 301,
    "created_at": "2026-11-10T09:30:00.000Z"
  }
}

The test.ping call has a different body: {"message": "Test webhook", "timestamp": "..."}.

Verify the signature

Compute the HMAC of the body exactly as you received it (before you parse it) and compare in constant time.

expected = OpenSSL::HMAC.hexdigest("SHA256", secret, request.raw_post)
ok = ActiveSupport::SecurityUtils.secure_compare(expected, request.headers["X-Webhook-Signature"].to_s)
expected = hmac.new(secret.encode(), body, hashlib.sha256).hexdigest()
ok = hmac.compare_digest(expected, signature_header)

The call has no timestamp in the signature, so it cannot protect against a call being sent again. Make your handler safe to run twice: the same record id and event can arrive more than once.

Delivery, retries and the log

  • Answer with any 2xx status to say it worked. Anything else counts as a failure. Tienda does not follow your answer's body.
  • A failed call (a non-2xx answer, or no answer) is tried again, up to five attempts in all, with longer waits between attempts. The waits are not set by the shop.
  • Each attempt is written to the delivery log as its own row: event, payload, response code, the first 1000 characters of the answer (or the error text), time, duration. GET /api/v1/webhooks/endpoints/:id/deliveries returns the latest 50, with a status of success, failed or pending.
  • POST /api/v1/webhooks/endpoints/:id/deliveries/:delivery_id/retry sends a logged call again.
  • There is no timeout setting for the receiver, and no automatic switching off of an endpoint that keeps failing. Not available yet.
  • A call is sent from a background job a moment after the change, not inside the request that made it. The order of calls is not guaranteed.