Webhooks
The webhooks field in your app.commerce.config file declares Adobe Commerce webhook subscriptions for your application and configures the subscriptions in the merchant's Admin. Webhooks allow your app to make calls to third-party systems synchronously.
Use Events and webhooks when you need both asynchronous event delivery and synchronous hooks inside Commerce processes.
Responsibilities by role
Webhook configuration spans both the developer who ships the app and the merchant who associates it with Commerce:
- App developers declare webhooks in the
webhooksfield ofapp.commerce.config. That manifest is what App Management uses to know which webhook subscriptions belong to your app. - Merchants usually get webhooks from that manifest without extra setup. See Install and access App Management and Commerce webhooks and apps for more information on how to configure Adobe Commerce.
Webhook entries
Add a webhooks array at the top level of defineConfig. When present, it must contain at least one entry.
Each entry must use one of these patterns (not both):
runtimeAction. Nourlinsidewebhook. The runtime action (formatpackage/action) supplies the webhook URL at runtime. OptionalrequireAdobeAuthcontrols Adobe auth on that resolution path.- Explicit
url. The nestedwebhookobject includes a valid absolutehttpsURL. Do not setruntimeActionon the entry, or your configuration will be flagged as invalid.
Each webhook entry uses the following properties:
labeldescriptioncategoryvalidation, append, or modification.runtimeActionurl in webhook. Runtime action that resolves the webhook URL.requireAdobeAuthruntimeAction, indicates whether Adobe authentication is required. Must match the require-adobe-auth setting for that runtime action in app.config.yaml.webhookurl or no url (if runtimeAction is set).Webhook category property
Webhooks are divided into 3 categories (from lower to higher when it comes to possible conflicts with other applications):
validation- Webhook is used only for validation purposes, returns onlysuccessorvalidationoperations.append- Webhook only appends data to the result and does not modify existing data. For example, add a shipping method on the checkout page.modification- Webhook modifies the Commerce data withadd,replace, andremoveoperations.
data-variant=warning
data-slots=text
category to choose between append and modification, use modification. Keep in mind that it will not stop the app from install if there are possible conflicts, it only warns the user before install.Nested webhook object
The webhook object contains the following properties:
webhook_methodobserver.catalog_product_save_after).webhook_typebefore or after the original action.batch_namehook_namebatch_name.methodPOST).urlruntimeAction. Omit when using runtimeAction.batch_orderpriorityrequiredsoft_timeouttimeoutfallback_error_messagettlfieldsname (required), source (optional).rulesfield, operator, value (all strings).headersname, value.For the full property reference, see Webhooks API.
Example with explicit URL
import { defineConfig } from "@adobe/aio-commerce-lib-app/config"
export default defineConfig({
metadata: {
// ...
},
webhooks: [
{
label: "Product save notification",
description: "POST to your endpoint after a product is saved",
category: "append",
webhook: {
webhook_method: "observer.catalog_product_save_after",
webhook_type: "after",
batch_name: "product_batch",
hook_name: "notify_external",
method: "POST",
url: "https://my-app.example.com/webhooks/product-save",
headers: [
{ name: "Authorization", value: "Bearer ${token}" },
],
fields: [
{ name: "sku", source: "product.sku" },
],
},
},
],
});
Example with runtime action
Use this pattern so the webhook can execute a runtimeAction in the project.
import { defineConfig } from "@adobe/aio-commerce-lib-app/config"
export default defineConfig({
metadata: {
// ...
},
webhooks: [
{
label: "Cart validation",
description: "Runtime-resolved endpoint for cart validation",
category: "validation",
runtimeAction: "my-package/resolve-webhook-url",
requireAdobeAuth: true,
webhook: {
webhook_method: "observer.checkout_cart_product_add_after",
webhook_type: "after",
batch_name: "cart_validation",
hook_name: "stock_check",
method: "POST",
rules: [
{ field: "product.qty", operator: "greaterThan", value: "0" },
],
},
},
],
});
After changing webhooks, rebuild and deploy your app so the pre-app-build hook refreshes generated artifacts. See Build and deploy for more information.
Handler implementation (optional)
When your runtime action handles the HTTP callback from Commerce, you build the response body with Webhook operations (success, exception, add, replace, remove). The @adobe/aio-commerce-lib-webhooks package (responses entry point) provides optional helpers for that workflow. Declaring webhooks in app.commerce.config does not require installing it.
Related documentation
- Install and access App Management (Experience League) — user guide for App Management in the Admin.
- Adobe Commerce Webhooks — product concepts and Admin behavior.
- Webhook responses — operation types for handler actions.