Webhooks
Instead of asking the API what changed, let the store tell your app. When an order is placed, paid, shipped or refunded, or a product, stock level or customer changes, Weftstore sends a signed POST to your URL with the resource as JSON.
Subscribing#
A subscription is a topic and a URL, and belongs to an app. Add one on the app's page in the admin (Apps, then the app, then Webhooks), or with the app's own token through the webhooks endpoints. An App Store app subscribes through the API, once for each store that installs it, with the token it got from OAuth. An app can subscribe to a topic when it has read access to its resource, for example read_orders for orders/create; if the store takes that access away, the subscription is removed too.
An app can send one topic to several addresses. Each is its own subscription, and they are sent in parallel. The same topic at the same address twice is refused with a 422 (address: ["for this topic has already been taken"]), so list the subscriptions before you create one.
URLs must start with https:// and can't point at private, loopback or link-local addresses. Plain http, and local addresses such as http://127.0.0.1:4200/webhooks, are accepted only on development servers. On a hosted Weftstore, use a tunnel such as ngrok or Cloudflare Tunnel and its https address while you build: Run it on your machine shows how.
curl -X POST "https://store.weftgrid.com/api/admin/2026-10/webhooks.json" \
-H "X-Storeloom-Access-Token: $STORELOOM_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "webhook": { "topic": "orders/paid", "address": "https://erp.example.com/hooks/storeloom" } }'Topics#
The body is the resource as the Admin API returns it, at the moment of the event: an order webhook carries the same fields as GET /orders/{id}.json. Deletions send only the id.
| Topic | Sent when | Needs | Payload |
|---|---|---|---|
orders/create | An order is placed (checkout, draft order or API). | read_orders | order |
orders/updated | Anything on an order changes. | read_orders | order |
orders/paid | An order is paid in full. | read_orders | order |
orders/cancelled | An order is cancelled. | read_orders | order |
orders/fulfilled | Every item on an order is fulfilled. | read_orders | order |
orders/partially_fulfilled | Some items on an order are fulfilled. | read_orders | order |
orders/edited | Items are added to or removed from an order after it was placed. | read_orders | order edit |
orders/paid_by_bank_transfer | An order is paid in full by bank or wallet transfer, matched automatically or by staff. It also sends orders/paid. | read_orders | order |
orders/risk_analyzed | An order's risk is scored: a new cash on delivery order, or staff check it again. | read_orders | order risk |
orders/tags_added | Tags are added to an order, by staff, an app or a workflow. | read_orders | tags change |
orders/tags_removed | Tags are taken off an order. | read_orders | tags change |
cod/confirmed | A customer confirms a cash on delivery order: a WhatsApp button, an SMS reply, the order status page, a call staff recorded, or the advance payment. | read_orders | cod verification |
cod/declined | A customer answers the cash on delivery confirmation by cancelling the order. | read_orders | cod verification |
cod/no_response | A customer didn't answer the cash on delivery confirmation in time, and the store's rule ran: cancel, call, or mark and ship. | read_orders | cod verification |
cod/delivery_refused | A cash on delivery parcel comes back: refused, or returning after a failed delivery. | read_orders | cod refusal |
fulfillments/create | A fulfillment is created. | read_orders | fulfillment |
fulfillments/update | A fulfillment's tracking or status changes. | read_orders | fulfillment |
fulfillment_events/create | A shipment's tracking status changes (a courier update, or added by staff). | read_orders | fulfillment event |
fulfillments/delivered | A shipment is marked delivered, by the courier's tracking or by staff. It also sends fulfillment_events/create. | read_orders | fulfillment event |
refunds/create | A refund is issued. | read_orders | refund |
returns/request | A customer asks to return items. | read_returns | return |
returns/approve | A return is approved (or created by staff). | read_returns | return |
returns/decline | A return request is declined. | read_returns | return |
returns/update | A return changes: items received, tracking added, restocked. | read_returns | return |
returns/close | A return is closed (refunded or settled). | read_returns | return |
returns/cancel | A return is cancelled. | read_returns | return |
order_transactions/create | A payment or refund transaction is recorded. | read_orders | transaction |
bank_receipts/matched | A payment alert from a bank or wallet is matched to a waiting order automatically, and the order is marked paid. | read_orders | bank receipt |
bank_receipts/unmatched | A payment alert fits no waiting order (or several), so staff need to match it by hand. | read_orders | bank receipt |
courier_settlements/imported | A courier's cash on delivery payment is imported, from its payment sheet or its API. | read_orders | courier settlement |
couriers/cod_overdue | A delivered cash on delivery parcel is still unpaid by the courier after the days it usually takes. Sent once per parcel. | read_orders | cod overdue |
checkouts/create | A buyer starts checkout and enters their email. | read_orders | checkout |
checkouts/abandoned | A buyer leaves checkout without ordering. Sent about 10 minutes after their last change, once per checkout. | read_orders | checkout |
draft_orders/create | A draft order is created. | read_draft_orders | draft order |
draft_orders/update | A draft order changes or is completed. | read_draft_orders | draft order |
draft_orders/delete | A draft order is deleted. | read_draft_orders | { "id": "…" } |
products/create | A product is created. | read_products | product |
products/update | A product or its variants change. | read_products | product |
products/delete | A product is deleted. | read_products | { "id": "…" } |
products/status_changed | A product becomes active, draft or archived. | read_products | product status |
products/tags_added | Tags are added to a product, by staff, an app, an import or a workflow. | read_products | tags change |
products/tags_removed | Tags are taken off a product. | read_products | tags change |
products/added_to_collection | A product joins a collection: picked by hand, or because an automated collection's conditions match it now. | read_products | collection membership |
products/removed_from_collection | A product leaves a collection, by hand or because it no longer matches an automated collection's conditions. | read_products | collection membership |
reviews/created | A customer, an app or staff add a product review in Loom Reviews, published or waiting for approval. Reviews brought in from a CSV import don't send it. | read_reviews | review |
reviews/published | A review goes live on the storefront: published automatically, or approved by staff or an app. | read_reviews | review |
search/no_results | The first time each day that shoppers search the storefront for words that find nothing (Loom Search & Discovery). | read_products | search |
collections/create | A collection is created. | read_products | collection |
collections/update | A collection changes. | read_products | collection |
collections/delete | A collection is deleted. | read_products | { "id": "…" } |
inventory_levels/update | A variant's stock changes for any reason, at any location. | read_inventory | inventory level |
locations/create | A location is added. | read_locations | location |
locations/update | A location changes, or is deactivated. | read_locations | location |
locations/delete | A location is deleted. | read_locations | { "id": "…" } |
customers/create | A customer is created. | read_customers | customer |
customers/update | A customer changes. | read_customers | customer |
customers/delete | A customer is deleted. | read_customers | { "id": "…" } |
customers/tags_added | Tags are added to a customer, by staff, an app, an import or a workflow. | read_customers | tags change |
customers/tags_removed | Tags are taken off a customer. | read_customers | tags change |
customers/subscribed | A customer agrees to get marketing emails: the newsletter form, checkout, their account, staff, an app or an import. | read_customers | consent |
customers/unsubscribed | A customer stops getting marketing emails: the unsubscribe link, their account, staff or an app. | read_customers | consent |
customers/text_subscribed | A customer agrees to get offers by WhatsApp and SMS: the box at checkout, the unsubscribe page, or staff. | read_customers | consent |
customers/text_unsubscribed | A customer leaves WhatsApp and SMS offers: a STOP reply, the unsubscribe page, or staff. | read_customers | consent |
messages/received | A customer sends the store a WhatsApp or SMS message. STOP replies and answers to a cash on delivery confirmation don't send it. | read_customers | message |
discounts/create | A discount is created. | read_discounts | discount |
discounts/update | A discount changes. | read_discounts | discount |
discounts/delete | A discount is deleted. | read_discounts | { "id": "…" } |
gift_cards/create | A gift card is issued. | read_gift_cards | gift card |
gift_cards/update | A gift card's balance or status changes. | read_gift_cards | gift card |
markets/create | A market is added. | read_markets | market |
markets/update | A market's countries, currency, prices or status change. | read_markets | market |
markets/delete | A market is deleted. | read_markets | { "id": "…" } |
themes/create | A theme is added (from the theme library, a copy or an upload). | read_themes | theme |
themes/update | A theme's settings, templates or files change. | read_themes | theme |
themes/publish | A theme is published and shoppers start seeing it. | read_themes | theme |
themes/delete | A theme is deleted. | read_themes | { "id": "…" } |
metaobjects/create | A metaobject entry is created. | read_metaobjects | metaobject |
metaobjects/update | A metaobject entry changes (its fields, handle or status). | read_metaobjects | metaobject |
metaobjects/delete | A metaobject entry is deleted (alone or with its definition). | read_metaobjects | { "id": "…" } |
shop/update | Store settings change. | Any app | shop |
app/uninstalled | The app is deleted from the store. | Any app | shop |
app_subscriptions/update | The merchant approves, declines or cancels one of the app's charges, or it expires. | Any app | app subscription |
checkouts/create sends the cart when the buyer first enters their email at checkout (or when a Storefront API app saves it):
{
"id": "cm2cart0001",
"token": "pB1u0n2Qk1lY3m9sXy7Z0aVvQ3cS4dE5",
"email": "[email protected]",
"currency": "USD",
"line_items": [
{
"variant_id": "cm2vari0001",
"product_id": "cm2prod0001",
"title": "Linen shirt",
"variant_title": "Sand / M",
"quantity": 2
}
],
"discount_code": null,
"created_at": "2026-10-23T09:12:00.000Z",
"updated_at": "2026-10-23T09:20:00.000Z"
}Events from Weftstore's own features#
Cash on delivery, bank transfers, courier payments, reviews, messages, customer consent, tags, collections, abandoned checkouts and search send webhooks too. Subscribe the way you do for any topic in the table above: the app needs the access in its Needs column, and the signature, headers and retries are the same.
These payloads are small on purpose: ids, names and what changed, not the whole order or customer. Read the record from the Admin API when you need more. Ids are strings, times are ISO 8601, and money is a decimal string next to its currency. A section says so when its payload carries personal data.
X-Storeloom-Event-Id is new for each event and the same for every app told about it, so keep the ones you have handled and skip repeats. A retry of a delivery keeps its id.
Three topics send a payload described elsewhere. orders/paid_by_bank_transfer sends the order, as orders/paid does, and fulfillments/delivered sends the tracking update, as fulfillment_events/create does. Each is sent in addition to the topic it comes from, and only when the order was paid by bank transfer or the update says delivered. checkouts/abandoned sends the checkout, as checkouts/create does, about 10 minutes after the buyer's last change.
The Send test button on a custom app's webhook sends the store's latest matching record in these shapes. A store with none gets an example marked "test": true.
Order risk#
The score Weftstore gives an order and the reasons behind it, as staff see them on the order. Sent each time the risk is scored: for a new cash on delivery order, and when staff check it again.
Sent by orders/risk_analyzed (needs read_orders).
| Field | Type | What it holds |
|---|---|---|
id | string | The order's id. |
name | string | The order's name, as the store shows it. |
risk_level | string | low, medium or high. Always high when the buyer is on the store's blocklist as high risk. |
risk_score | number | 0 to 100. The higher, the riskier. |
reasons | array of objects | What raised or lowered the score, biggest first. code is one of refused_deliveries, blocklist_flag, invalid_phone, phone_other_names, vague_address, repeat_orders, shared_network, over_cod_limit, large_order, throwaway_email, first_order and good_history. text is for people and can change. |
occurred_at | string | When the risk was scored (ISO 8601). |
{
"id": "cm2ordr0001",
"name": "#1042",
"risk_level": "high",
"risk_score": 72,
"reasons": [
{
"code": "refused_deliveries",
"points": 25,
"text": "1 earlier cash on delivery parcel came back (refused or returned)"
},
{
"code": "first_order",
"points": 5,
"text": "First order from this buyer"
}
],
"occurred_at": "2026-10-30T09:15:00.000Z"
}Tags changed#
Which tags were added to or taken off an order, a customer or a product, and the tags it has now. The Admin API shows tags as one comma-separated string; here both are lists.
Sent by orders/tags_added and orders/tags_removed (needs read_orders); products/tags_added and products/tags_removed (needs read_products); customers/tags_added and customers/tags_removed (needs read_customers).
| Field | Type | What it holds |
|---|---|---|
id | string | The order's, the customer's or the product's id. |
name | string | The order's name, as the store shows it.Only with orders/tags_added and orders/tags_removed. |
title | string | The product's title.Only with products/tags_added and products/tags_removed. |
tags | array of strings | The tags that were added (tags_added) or taken off (tags_removed). |
current_tags | array of strings | All the tags it has now. |
occurred_at | string | When the tags changed (ISO 8601). |
{
"id": "cm2ordr0001",
"name": "#1042",
"tags": [
"vip"
],
"current_tags": [
"vip",
"wholesale"
],
"occurred_at": "2026-10-30T09:15:00.000Z"
}{
"id": "cm2prod0001",
"title": "Linen shirt",
"tags": [
"vip"
],
"current_tags": [
"vip",
"wholesale"
],
"occurred_at": "2026-10-30T09:15:00.000Z"
}{
"id": "cm2cust0001",
"tags": [
"vip"
],
"current_tags": [
"vip",
"wholesale"
],
"occurred_at": "2026-10-30T09:15:00.000Z"
}Cash on delivery confirmation#
How a customer answered the store's confirmation of a cash on delivery order, or that nobody answered and the store's rule ran.
Sent by cod/confirmed, cod/declined and cod/no_response (needs read_orders).
| Field | Type | What it holds |
|---|---|---|
id | string | The order's id. |
name | string | The order's name, as the store shows it. |
verification_status | string | confirmed, declined or no_response. |
channel | string | How the customer answered: whatsapp, sms, call (a call staff recorded), status_page (the order status page), staff (staff recorded it) or advance (they paid the advance).Only with cod/confirmed and cod/declined. |
cancelled | boolean | Whether the order was cancelled automatically. When false it waits for staff.Only with cod/declined. |
rule | string | What the store's rule did: cancel the order, call (leave it for staff to call) or mark (mark it as not confirmed and let it ship).Only with cod/no_response. |
after | string | What ran out: time (the hours the store waits) or calls (the calls staff tried).Only with cod/no_response. |
occurred_at | string | When the customer answered, or the rule ran (ISO 8601). |
{
"id": "cm2ordr0001",
"name": "#1042",
"verification_status": "confirmed",
"channel": "whatsapp",
"occurred_at": "2026-10-30T09:15:00.000Z"
}{
"id": "cm2ordr0001",
"name": "#1042",
"verification_status": "declined",
"channel": "whatsapp",
"cancelled": true,
"occurred_at": "2026-10-30T09:15:00.000Z"
}{
"id": "cm2ordr0001",
"name": "#1042",
"verification_status": "no_response",
"rule": "call",
"after": "time",
"occurred_at": "2026-10-30T09:15:00.000Z"
}Cash on delivery parcel refused#
A cash on delivery parcel that comes back: the courier brings it back, or it is returning after a failed delivery. Sent once per order, however many of its parcels come back.
Sent by cod/delivery_refused (needs read_orders).
| Field | Type | What it holds |
|---|---|---|
id | string | The order's id. |
name | string | The order's name, as the store shows it. |
fulfillment_id | string | The parcel's fulfillment. |
courier | string or null | The courier's id (postex, leopards, tcs…) when the parcel was booked through its API. |
tracking_number | string or null | The parcel's tracking number. |
shipment_status | string or null | returned, or returning after a failed delivery. |
refused_count | number | How many cash on delivery orders of this buyer (the same phone or email) have come back, this one included. |
blocked | boolean | Whether this one put the buyer on the store's blocklist. |
occurred_at | string | When the parcel started to count as refused (ISO 8601). |
{
"id": "cm2ordr0001",
"name": "#1042",
"fulfillment_id": "cm2fulf0001",
"courier": "postex",
"tracking_number": "PX-30415528",
"shipment_status": "returned",
"refused_count": 2,
"blocked": false,
"occurred_at": "2026-10-30T09:15:00.000Z"
}Bank receipt#
A payment alert Weftstore read from the store's bank or wallet, after it tried to match it to an order waiting for a transfer.
Sent by bank_receipts/matched and bank_receipts/unmatched (needs read_orders).
The payer's name, the account number and the text of the alert aren't sent.
| Field | Type | What it holds |
|---|---|---|
id | string | The receipt's id. |
bank | string | The bank or wallet, as the store named it. |
method | string | bank_transfer, raast, jazzcash or easypaisa. |
ref | string | The bank's transaction reference, or a fingerprint of the alert when it has none. |
amount | string | The amount received, as a decimal string. |
currency | string | The currency of the amount. |
status | string | matched for bank_receipts/matched; new (waiting for staff) for bank_receipts/unmatched. |
matched_how | string or null | How it was matched: reference (the customer's transaction id), amount (a unique amount) or name (amount, name and time). null when it wasn't. |
order_ids | array of strings | The orders it paid. Empty when it wasn't matched. |
source | string | Where Weftstore read the alert: mail (the store's mailbox) or sms (forwarded by SMS). |
received_at | string | When the bank sent the alert (ISO 8601). |
created_at | string | When Weftstore filed the receipt (ISO 8601). |
{
"id": "cm2rcpt0001",
"bank": "Meezan Bank",
"method": "bank_transfer",
"ref": "IBFT-20261030-118",
"amount": "7200.00",
"currency": "PKR",
"status": "matched",
"matched_how": "reference",
"order_ids": [
"cm2ordr0001"
],
"source": "mail",
"received_at": "2026-10-30T09:15:00.000Z",
"created_at": "2026-10-30T09:16:04.000Z"
}Courier payment#
A courier's cash on delivery payment, imported from its payment sheet or its API, after its parcels were matched to orders. The counts say how many need a look.
Sent by courier_settlements/imported (needs read_orders).
| Field | Type | What it holds |
|---|---|---|
id | string | The payment's id. |
courier | string | The courier's id: postex, leopards, tcs, trax, mnp, callcourier or blueex. |
courier_name | string | The courier's name. |
reference | string | The courier's reference for the payment. |
paid_at | string or null | When the courier paid (ISO 8601), when it says. |
source | string | upload (a payment sheet) or api (the courier's API). |
currency | string | The currency of the amounts. |
cod_total | string | The cash the courier collected on these parcels. |
charges_total | string | What the courier took off: delivery, cash on delivery fees and returns. |
net_amount | string | What the courier paid. |
lines_count | number | Parcels on the payment. |
matched_count | number | Parcels matched to an order and paid as expected, counting the ones that came back and only have return charges. |
problems_count | number | Parcels that need a look: short, over, not found or already paid. |
short_count | number | Parcels the courier paid less for than it was to collect. |
over_count | number | Parcels the courier paid more for. |
unmatched_count | number | Parcels that match no order of the store. |
duplicate_count | number | Parcels that an earlier payment already covered. |
return_charge_count | number | Parcels that came back and only have charges. |
short_total | string | How much the courier paid short, in all. |
created_at | string | When it was imported (ISO 8601). |
{
"id": "cm2setl0001",
"courier": "postex",
"courier_name": "PostEx",
"reference": "CPR 104233",
"paid_at": "2026-10-30T09:15:00.000Z",
"source": "upload",
"currency": "PKR",
"cod_total": "54000.00",
"charges_total": "3150.00",
"net_amount": "50850.00",
"lines_count": 12,
"matched_count": 10,
"problems_count": 2,
"short_count": 1,
"over_count": 0,
"unmatched_count": 1,
"duplicate_count": 0,
"return_charge_count": 1,
"short_total": "500.00",
"created_at": "2026-10-30T09:15:00.000Z"
}Courier hasn't paid#
A delivered cash on delivery parcel that the courier still hasn't paid for after the days it usually takes. Sent once per parcel.
Sent by couriers/cod_overdue (needs read_orders).
| Field | Type | What it holds |
|---|---|---|
id | string | The parcel's fulfillment id. |
order_id | string | The order it belongs to. |
courier | string | The courier's id (postex, leopards, tcs…). |
courier_name | string | The courier's name. |
tracking_number | string or null | The parcel's tracking number. |
amount | string | The cash the courier holds, as a decimal string. |
currency | string | The currency of the amount. |
days | number | Days since the parcel was delivered. |
expected_days | number | The days the courier usually takes to pay. |
delivered_at | string or null | When the parcel was delivered (ISO 8601). |
{
"id": "cm2fulf0001",
"order_id": "cm2ordr0001",
"courier": "postex",
"courier_name": "PostEx",
"tracking_number": "PX-30415528",
"amount": "4500.00",
"currency": "PKR",
"days": 9,
"expected_days": 7,
"delivered_at": "2026-10-21T10:40:00.000Z"
}Product status#
A product became active, draft or archived. The same fields as the product's own id, title, handle and status in the Admin API.
Sent by products/status_changed (needs read_products).
| Field | Type | What it holds |
|---|---|---|
id | string | The product's id. |
title | string | The product's title. |
handle | string | The product's handle. |
status | string | The new status: active, draft or archived. |
previous_status | string | The status it had before. |
updated_at | string | When the product last changed (ISO 8601). |
{
"id": "cm2prod0001",
"title": "Linen shirt",
"handle": "linen-shirt",
"status": "active",
"previous_status": "draft",
"updated_at": "2026-10-30T09:15:00.000Z"
}Product added to or removed from a collection#
A product joined or left a collection: picked by hand, or because an automated collection's conditions started or stopped matching it. When one change moves more than 1,000 products (new conditions on a big collection), the first 1,000 are sent.
Sent by products/added_to_collection and products/removed_from_collection (needs read_products).
| Field | Type | What it holds |
|---|---|---|
id | string | The product's id. |
title | string | The product's title. |
handle | string | The product's handle. |
collection_id | string | The collection's id. |
collection_title | string | The collection's title. |
collection_handle | string | The collection's handle. |
occurred_at | string | When the product joined or left (ISO 8601). |
{
"id": "cm2prod0001",
"title": "Linen shirt",
"handle": "linen-shirt",
"collection_id": "cm2coll0001",
"collection_title": "Summer linen",
"collection_handle": "summer-linen",
"occurred_at": "2026-10-30T09:15:00.000Z"
}Review#
A product review in Loom Reviews, with the fields of the Admin API's review. reviews/created is sent when it is added, published or waiting for approval; reviews/published when it goes live.
Sent by reviews/created and reviews/published (needs read_reviews).
The reviewer's name and what they wrote are sent. Their email and phone aren't: an app that also has read_customers can read them with the Admin API.
| Field | Type | What it holds |
|---|---|---|
id | string | The review's id. |
product_id | string | The product it is about. |
rating | number | 1 to 5. |
title | string | The review's title. Empty when there is none. |
body | string | What the reviewer wrote. |
author_name | string | The reviewer's name. |
photos | array of strings | Links to the photos they added. |
status | string | pending, published, hidden or spam. |
verified | boolean | Whether the reviewer bought the product. |
source | string | Where it came from: storefront, request, import, api or admin. |
reply | string or null | The store's reply. |
replied_at | string or null | When the store replied (ISO 8601). |
helpful_count | number | How many shoppers found it helpful. |
reported_count | number | How many shoppers reported it. |
order_id | string or null | The order the reviewer bought it in. |
customer_id | string or null | The reviewer's customer. |
locale | string or null | The language the review was written in. |
external_id | string or null | Where an imported review came from, for re-imports. |
published_at | string or null | When it went live (ISO 8601). |
created_at | string | When it was written (ISO 8601). |
updated_at | string | When it last changed (ISO 8601). |
{
"id": "cm3rev0001",
"product_id": "cm2prod0001",
"rating": 5,
"title": "Soft and true to size",
"body": "The lawn is soft and the print looks just like the photos.",
"author_name": "Fatima M.",
"photos": [
"https://dhaaga.example/uploads/review-1.jpg"
],
"status": "published",
"verified": true,
"source": "request",
"reply": null,
"replied_at": null,
"helpful_count": 0,
"reported_count": 0,
"order_id": "cm3order001",
"customer_id": "cm3cust001",
"locale": "en",
"external_id": null,
"published_at": "2026-10-30T09:15:00.000Z",
"created_at": "2026-10-30T09:00:00.000Z",
"updated_at": "2026-10-30T09:15:00.000Z"
}Search with no results#
Shoppers searched the storefront for words that found nothing (Loom Search & Discovery). Sent the first time each day for the same words; searching them again that day sends nothing.
Sent by search/no_results (needs read_products).
These are the words shoppers typed. Nothing says who typed them.
| Field | Type | What it holds |
|---|---|---|
query | string | The words searched, as the store's search read them. |
results | number | Products found. Always 0. |
day | string | The day in the store's time zone (YYYY-MM-DD). |
searched_at | string | When the search was made (ISO 8601). |
{
"query": "lawn kurta",
"results": 0,
"day": "2026-10-30",
"searched_at": "2026-10-30T09:15:00.000Z"
}Consent change#
A customer's agreement to get marketing changed: emails (customers/subscribed, customers/unsubscribed) or offers by WhatsApp and SMS (customers/text_subscribed, customers/text_unsubscribed). Sent when the setting changes, not when it is saved unchanged.
Sent by customers/subscribed, customers/unsubscribed, customers/text_subscribed and customers/text_unsubscribed (needs read_customers).
Carries the customer's email and phone, as the Admin API's customer does under read_customers.
| Field | Type | What it holds |
|---|---|---|
id | string | The customer's id. |
email | string or null | The customer's email. |
phone | string or null | The customer's phone. |
channel | string | email, or text for offers by WhatsApp and SMS. |
subscribed | boolean | Whether the customer agrees to get them now. |
source | string or null | How the change came about, for example newsletter, checkout, account, admin, import, api, unsubscribe_link or reply_stop. null when it isn't known. |
updated_at | string or null | When the consent changed (ISO 8601). |
{
"id": "cm2cust0001",
"email": "[email protected]",
"phone": "03001234567",
"channel": "email",
"subscribed": true,
"source": "checkout",
"updated_at": "2026-10-30T09:15:00.000Z"
}Customer message#
A customer wrote to the store's WhatsApp number or replied to an SMS. Not sent for STOP replies or answers to a cash on delivery confirmation: Weftstore handles those itself.
Sent by messages/received (needs read_customers).
Carries what the customer wrote and their phone number, so subscribe only if the app needs them.
| Field | Type | What it holds |
|---|---|---|
id | string | The message's id. |
channel | string | whatsapp or sms. |
from | string | The sender's phone number, as the provider gave it. |
text | string | What the customer wrote. |
button_payload | string or null | The payload of the quick-reply button they tapped, when they tapped one. |
reply_to | string or null | The provider's id of the message they replied to, when it says. |
customer_id | string or null | The customer with that phone number, when there is one. |
order_id | string or null | The customer's latest order of the last 7 days, when there is one. |
received_at | string | When the message arrived (ISO 8601). |
{
"id": "cm2inbx0001",
"channel": "whatsapp",
"from": "03001234567",
"text": "Kab tak deliver hoga?",
"button_payload": null,
"reply_to": null,
"customer_id": "cm2cust0001",
"order_id": "cm2ordr0001",
"received_at": "2026-10-30T09:15:00.000Z"
}Headers#
| Header | What it is |
|---|---|
X-Storeloom-Topic | The topic.orders/create |
X-Storeloom-Hmac-Sha256 | Base64 HMAC-SHA256 of the raw request body. The key is a custom app's API secret, or an App Store app's client secret.XWmrwMey6OsLMeiZKwP4FppHH3cmAiiJJAweH5Jo4bM= |
X-Storeloom-Webhook-Id | This delivery. The same on every retry of it, so use it to ignore duplicates.cm2wdel0001 |
X-Storeloom-Event-Id | The event. The same for every app notified about it.6f1c9a1e-0b8e-4a55-9d83-3cbbd1c8a1f2 |
X-Storeloom-Triggered-At | When the event happened (ISO 8601). Retries keep the original time.2026-10-23T09:30:00.000Z |
X-Storeloom-Shop-Domain | The store's primary domain: its own domain when it has one, otherwise its Weftstore address. It can change.demo.storeloom.example |
X-Storeloom-Shop-Id | The store's id, the same as the id in the shop object. It never changes, so use it rather than the domain to tell stores apart.cm2stor0001 |
X-Storeloom-API-Version | The API version the payload is in (the subscription's version).2026-10 |
Content-Type | Always JSON.application/json |
User-Agent | Identifies Weftstore's sender.Storeloom-Webhooks/1.0 |
Verifying signatures#
Anyone can send a request to your URL, so check that it came from Weftstore. X-Storeloom-Hmac-Sha256 is the HMAC-SHA256 of the raw request body, base64-encoded. Compute it over the exact bytes you received, before any JSON parsing, and compare in constant time. Answer 401 when it doesn't match.
The key is the app's secret, and which one depends on the kind of app. The header and the algorithm are the same, so one check works for both.
| App | Signed with | Where to find it |
|---|---|---|
| A custom app, made in a store's admin | Its API secret, which starts with slsk_ | Reveal it on the app's page in the admin. |
| An App Store app | Its client secret, which starts with slcs_. It is the same for every store that installs the app. | Shown once when you create the app. Rotate secret on the app's page in the partner dashboard makes a new one, and everything sent from then on is signed with it. |
import crypto from "node:crypto";
export function validWebhook(rawBody, hmacHeader, secret) {
const digest = crypto.createHmac("sha256", secret).update(rawBody).digest("base64");
const expected = Buffer.from(digest);
const received = Buffer.from(hmacHeader ?? "");
return expected.length === received.length && crypto.timingSafeEqual(expected, received);
}
// Express: read the raw body. The signature covers the exact bytes sent.
// The secret is a custom app's API secret, or an App Store app's client secret.
app.post("/webhooks/storeloom", express.raw({ type: "application/json" }), (req, res) => {
if (!validWebhook(req.body, req.get("X-Storeloom-Hmac-Sha256"), process.env.STORELOOM_API_SECRET)) {
return res.sendStatus(401);
}
res.sendStatus(200); // answer right away, then do the work
const payload = JSON.parse(req.body.toString("utf8"));
jobs.add(req.get("X-Storeloom-Topic"), payload, { jobId: req.get("X-Storeloom-Webhook-Id") });
});import base64
import hashlib
import hmac
def valid_webhook(raw_body: bytes, hmac_header: str, secret: str) -> bool:
digest = hmac.new(secret.encode("utf-8"), raw_body, hashlib.sha256).digest()
return hmac.compare_digest(base64.b64encode(digest).decode("ascii"), hmac_header or "")
# Flask: request.get_data() is the raw body.
# The secret is a custom app's API secret, or an App Store app's client secret.
@app.post("/webhooks/storeloom")
def storeloom_webhook():
signature = request.headers.get("X-Storeloom-Hmac-Sha256", "")
if not valid_webhook(request.get_data(), signature, os.environ["STORELOOM_API_SECRET"]):
abort(401)
enqueue(request.headers["X-Storeloom-Topic"], request.get_json(), job_id=request.headers["X-Storeloom-Webhook-Id"])
return "", 200<?php
function valid_webhook(string $rawBody, string $hmacHeader, string $secret): bool
{
$digest = base64_encode(hash_hmac('sha256', $rawBody, $secret, true));
return hash_equals($digest, $hmacHeader);
}
// Read the raw body before decoding it.
// The secret is a custom app's API secret, or an App Store app's client secret.
$rawBody = file_get_contents('php://input');
$signature = $_SERVER['HTTP_X_STORELOOM_HMAC_SHA256'] ?? '';
if (!valid_webhook($rawBody, $signature, getenv('STORELOOM_API_SECRET') ?: '')) {
http_response_code(401);
exit;
}
$payload = json_decode($rawBody, true);
http_response_code(200);require "base64"
require "openssl"
def valid_webhook?(raw_body, hmac_header, secret)
digest = Base64.strict_encode64(OpenSSL::HMAC.digest("SHA256", secret, raw_body))
return false if hmac_header.nil? || hmac_header.bytesize != digest.bytesize
OpenSSL.fixed_length_secure_compare(digest, hmac_header)
end
# Rails controller: request.raw_post is the raw body.
# The secret is a custom app's API secret, or an App Store app's client secret.
def storeloom
signature = request.headers["X-Storeloom-Hmac-Sha256"]
return head :unauthorized unless valid_webhook?(request.raw_post, signature, ENV.fetch("STORELOOM_API_SECRET"))
WeftstoreWebhookJob.perform_later(request.headers["X-Storeloom-Topic"], request.raw_post)
head :ok
endResponses and retries#
Answer with any 2xx status within 5 seconds and the delivery counts as delivered. Anything else is a failure: another status, a redirect (they aren't followed), a timeout or a connection error. Failed deliveries are tried again on this schedule, 9 attempts over about two days, then marked failed:
| Attempt | When | Since the event |
|---|---|---|
| 1 | When the event happens | 0 min |
| 2 | 1 min after the previous attempt | 1 min |
| 3 | 5 min after the previous attempt | 6 min |
| 4 | 15 min after the previous attempt | 21 min |
| 5 | 1 h after the previous attempt | 1 h 21 min |
| 6 | 3 h after the previous attempt | 4 h 21 min |
| 7 | 6 h after the previous attempt | 10 h 21 min |
| 8 | 12 h after the previous attempt | 22 h 21 min |
| 9 | 24 h after the previous attempt | 46 h 21 min |
Weftstore sends to different addresses at the same time and takes turns between them when many deliveries are waiting, so a slow or dead address doesn't hold up the others. Deliveries to one server go out only a couple at a time.
Every delivery, with its payload, the response code and the error, is listed on the app's page in the admin, where you can resend it. Send test there posts a sample of the topic, built from the store's latest matching record; tests aren't retried. Delivered webhooks are kept for 30 days and failed ones for 60.
The developer of an App Store app has the same list in the Webhooks tab of the app in the partner dashboard: the addresses each store's install subscribed to, with how each is doing, and the deliveries sent to them with the answer your server gave. It shows store names and delivery facts, never a payload or anything about a customer. Send test, Resend and Resume are there too. A test posts a signed message that says it is a test and holds no store data, { "test": true, "topic": "orders/create", "note": "…" }, so your handler should recognize it and skip it.
Pausing and resuming#
Weftstore keeps count for each subscription: one topic, sent to one address, from one store. Every failed attempt adds one to its run of failures, and a delivery that gets through, or a test, clears the run. When a subscription has failed 20 attempts in a row and the run has lasted at least 24 hours, Weftstore pauses it. A server that is down pauses every store's subscription to it, each on its own count.
| Status | What it means |
|---|---|
| Healthy | The last attempt got through, or nothing has been sent yet. |
| Failing | The latest attempts failed. Deliveries are still tried again on the schedule above, and nothing else changes. |
| Paused | The run of failures reached the limit. Nothing is sent to this subscription until it is started again. |
- Who is told. For an App Store app, the developer is emailed at the address of their developer account, with a link to the Webhooks tab of the app. For a custom app, the store's contact address is emailed, with a link to the app. An app gets at most one of these emails in 24 hours, however many stores and topics were paused in that time: the Webhooks tab lists every one. The store's activity log records the pause too.
- Send test. Fix the address, then press Send test on its row. A test is a real, signed delivery, and the first one your server answers with a 2xx starts the subscription again. One that fails counts as another failure.
- Resume. Resume starts a paused subscription without a test. Its count starts from zero, so a server that is still down is paused again only after another 20 failed attempts over 24 hours.
Developers of App Store apps find both buttons on the Webhooks tab of the app in the partner dashboard, one row for each store and topic. For a custom app they are on its page in the store's admin, under Webhooks.
Uninstall and privacy messages#
A store's subscriptions are deleted when it uninstalls the app, so the last messages about an install can't be sent through them. For App Store apps Weftstore keeps a queue of its own for four messages. They are signed with the client secret, carry the same headers and are never paused. app/uninstalled is tried again on the same schedule as other webhooks: 9 attempts over about two days. The three privacy messages are tried for longer, 14 attempts over about 7 days, so a server that was down for a weekend still gets them.
| Topic | Goes to | Sent when |
|---|---|---|
app/uninstalled | Every address the app subscribed to for this topic | The store uninstalls the app. The first attempt is made at once. |
shop/redact | The app's privacy webhook URL | 48 hours after an uninstall, unless the store installs the app again before then. |
customers/data_request | The app's privacy webhook URL | A merchant asks for the data apps hold about a customer. Only apps that can read customer data are sent it. |
customers/redact | The app's privacy webhook URL | A merchant erases a customer. Only apps that can read customer data are sent it. |
Only app/uninstalled needs a subscription. The three privacy topics aren't in the topic list: they go to the privacy webhook URL that every App Store app sets in the partner dashboard, whether or not it subscribed to anything. shop/redact goes to every app that has one; the two customer topics carry a customer's email and phone number, so they go only to an app that can read customer data. Privacy webhooks says which access that is, and has the payloads and what your app has to do.
A retry of app/uninstalled can arrive after the token has stopped working, so don't count on the Admin API from it. Its body is the shop object, the same as GET /shop.json: use its id to find what you kept about the store. If the store may have installed your app again since, call the API with the token you hold before you forget the store: a 401 means the install is over, and a success means the store is still there. A custom app gets app/uninstalled once, just before its token stops working, and none of the other three.
The Webhooks tab in the partner dashboard lists all four under Uninstall and privacy messages, and Resend sends a failed one again. A message about a customer can't be sent again: once it has been delivered, or given up on, its body is replaced with {"redacted":true}.
Good practice#
- Answer first, then work: put the payload on a queue and return 200. Slow answers time out and are retried.
- Expect duplicates. A retry, or a resend from the admin, carries the same
X-Storeloom-Webhook-Id; skip ids you've handled.X-Storeloom-Event-Idis the same for every app notified about one event. - Expect them out of order, especially after retries. Compare the payload's
updated_atwith what you have, or fetch the latest version from the Admin API. - Don't rely on webhooks alone for money or stock: an occasional sync with
updated_at_mincatches anything your endpoint missed while it was down. - Subscribe to
app/uninstalledto hear when the store deletes your app. A custom app gets it once, just before the tokens stop working; an App Store app gets it again if its server doesn't answer.