# `Shopifex.Plug.ShopifyWebhook`
[🔗](https://github.com/ericdude4/shopifex/blob/main/lib/shopifex/plug/shopify_webhook.ex#L1)

Authenticates a Shopify request and builds the Shopifex session.

Two modes, chosen with the `:mode` plug option:

  * `:webhook` (default) — a webhook `POST`. The `x-shopify-hmac-sha256`
    header is verified against the HMAC of the **raw request body** (see
    `Shopifex.Plug.valid_webhook_hmac?/1`). The shop is resolved from the
    `x-shopify-shop-domain` header or the verified body — never from a
    query/body param a caller can choose, and a query-string `hmac` is
    ignored.
  * `:admin_link` — an admin-link / bulk-action-link `GET`, signed like an
    app load. The query `hmac` is verified and, when a `timestamp` is
    present, its freshness is checked. The shop is resolved from the signed
    query `shop` param.

The `:shopify_webhook` and `:shopify_admin_link` pipelines set the mode.

# `call`

# `init`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
