Dispatches verified Shopify webhooks to a handle_topic/3 clause you define in your own controller.
use ShopifexWeb.WebhookController wires up an action/2 that calls
handle_topic(conn, shop, topic), where topic comes from the
x-shopify-topic header (a missing or duplicated header is rejected with
400). Add a clause per topic you subscribe to:
use ShopifexWeb.WebhookController
# `app/uninstalled` has no built-in default — handle it yourself.
def handle_topic(conn, shop, "app/uninstalled") do
Shopifex.Shops.delete_shop(shop)
send_resp(conn, 200, "success")
endBuilt-in GDPR compliance defaults
This module ships default clauses for Shopify's three mandatory compliance (GDPR) topics so a fresh app passes review without extra code:
customers/data_request— acknowledges with200(touches no data).customers/redact— acknowledges with200(touches no data). Delete customer data here if your app stores any.shop/redact— deletes the shop record (when one is loaded) and responds200.
handle_topic/3 is defoverridable. Defining your own handle_topic/3
replaces all of these defaults, including the GDPR clauses. To keep them,
add a catch-all that delegates to super/3:
def handle_topic(conn, shop, topic), do: super(conn, shop, topic)