Loading...
Loading...
Add or modify webhook interceptors in an Adobe Commerce app. Use when the user wants to intercept Commerce operations to validate input, append data, or modify behavior — before or after execution. Requires a base app initialized with commerce-app-init.
npx skill4agent add adobe/skills commerce-app-webhooksapp.commerce.config.tsapp.commerce.config.tssrc/commerce-extensibility-1/node_modules@adobe/aio-commerce-lib-appapp.commerce.config.tscommerce-app-initsrc/commerce-extensibility-1/node_modulesnpx @adobe/aio-commerce-lib-app initwebpack-config.cjstsconfig.jsoninitcommerce-app-initwebhook_methodplugin.magento.catalog_product.savewebhook_typebeforeafterruntimeAction: "<package>/<action>"webhook.urlvalidationappendmodificationbatch_namehook_name| Field | Constraint |
|---|---|
| |
| |
| Optional; must be |
| |
| Must be a valid absolute URL ( |
| Required, non-empty |
| Required, non-empty |
| Required HTTP method (e.g., |
| Optional; positive integer (milliseconds) |
| Optional; positive integer |
app.commerce.config.tswebhookswebhooks// Runtime action handler (handler lives in this app)
webhooks: [
{
label: "Validate Product Save",
description: "Validates product data before saving.",
category: "validation", // optional
runtimeAction: "my-package/validate-product", // <package>/<action>
webhook: {
webhook_method: "plugin.magento.catalog_product.save",
webhook_type: "before",
batch_name: "my_app", // [a-zA-Z0-9_]+ only
hook_name: "validate_product", // [a-zA-Z0-9_]+ only
method: "POST",
},
},
];
// URL handler (external endpoint)
webhooks: [
{
label: "Fraud Check",
description: "Calls external fraud service before order placement.",
webhook: {
webhook_method: "plugin.magento.sales_order.place",
webhook_type: "before",
batch_name: "my_app",
hook_name: "fraud_check",
method: "POST",
url: "https://fraud.example.com/check", // inside webhook object, not top level
},
},
];env"paas""saas"runtimeActionsrc/actions/app.config.yamlsrc/commerce-extensibility-1/ext.config.yamlapp-managementapp-management# src/commerce-extensibility-1/ext.config.yaml
# (add below the auto-generated app-management package)
runtimeManifest:
packages:
app-management:
# ... auto-generated — do not edit
my-app: # your package name — any name except "app-management"
actions:
validate-product:
function: actions/validate-product/index.js # relative to src/commerce-extensibility-1/
web: "yes"
runtime: nodejs:24
annotations:
require-adobe-auth: true<package>/<action>runtimeActionmy-app/validate-productmy-appvalidate-product// src/commerce-extensibility-1/actions/validate-product/index.ts
import {
ok,
successOperation,
exceptionOperation,
addOperation,
replaceOperation,
removeOperation,
} from "@adobe/aio-commerce-lib-webhooks/responses";
export async function main(params: Record<string, unknown>) {
// params contains the Commerce operation payload
// Allow the operation to proceed
return ok(successOperation());
// Block the operation (validation failure)
// return ok(exceptionOperation("Product SKU is required"));
// Append data to the operation result
// return ok(addOperation("result/custom_field", { value: "appended" }));
// Modify a field in the result
// return ok(replaceOperation("result/price", 99.99));
// Remove a field from the result
// return ok(removeOperation("result/unwanted_field"));
}| Response | Effect |
|---|---|
| Allow — operation proceeds unchanged |
| Block — operation is rejected with this message |
| Append data at |
| Replace the value at |
| Remove the field at |
aio app buildbatch_namehook_namemy_appvalidate_product_saveruntimeActionwebhook.urlruntimeActionwebhook.urlurlurlwebhooklabelapp-managementext.config.yamlsrc/commerce-extensibility-1/src/...actions/validate-product/index.jssrc/commerce-extensibility-1/actions/validate-product/index.jsdefineConfig@adobe/aio-commerce-lib-appdefineConfig@adobe/aio-commerce-lib-app/configaio app buildaio app buildcommerce-app-business-configcommerce-app-eventingcommerce-app-admin-uicommerce-app-storage