|
| 1 | +--- |
| 2 | +title: Create events from the Admin |
| 3 | +description: Learn about managing webhook subscriptions through the Admin in Adobe Commerce Cloud Service. |
| 4 | +keywords: |
| 5 | + - Extensibility |
| 6 | +noIndex: true |
| 7 | +--- |
| 8 | + |
| 9 | +# Create events from the Admin |
| 10 | + |
| 11 | +<InlineAlert variant="info" slots="text1" /> |
| 12 | + |
| 13 | +This feature is available only in Adobe Commerce as a Cloud Service (ACCS). |
| 14 | + |
| 15 | +Adobe Commerce webhooks allow developers to trigger calls to external systems synchronously when an Adobe Commerce event occurs. In addition to the [webhooks REST endpoints](https://developer.adobe.com/commerce/services/cloud/guides/rest/webhooks/) available for subscribing and unsubscribing webhooks, Commerce Cloud Service supports configuring webhooks through the Admin. |
| 16 | + |
| 17 | +## View registered hooks |
| 18 | + |
| 19 | +In the Admin, select **System** > **Webhooks** > **Webhooks Subscriptions** to display the _Webhooks_ grid page. |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | +The rows of this grid show configuration settings for all registered hooks, both active and inactive. |
| 24 | + |
| 25 | +## Create a new hook |
| 26 | + |
| 27 | +Click **Add New Webhook** from the grid page to display the form for creating a new hook. |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | +The **Hook settings** configuration panel contains the following fields: |
| 32 | + |
| 33 | +Field | Description |
| 34 | +--- | --- |
| 35 | +**Webhook Method** | Select one of the supported Commerce webhook names from the dropdown. |
| 36 | +**Webhook Type** | Select whether to run the webhook `before` or `after` the original action. |
| 37 | +**Batch Name** | A unique name for the batch. Use a descriptive name that encompasses all the hooks in the batch. The name must contain English alphanumeric characters and underscores (_) only. |
| 38 | +**Batch Order** | A sort order for batch execution. The provided value overwrites the batch order set for hooks within the same batch that were configured earlier. A default value of 0 is saved if no value is set. |
| 39 | +**Hook Name** | A name that must be unique within a batch. The name must contain English alphanumeric characters and underscores (_) only. |
| 40 | +**Hook Priority** | The priority of the merging hook results in the batch. The priority is treated as 0 if a value is not set. |
| 41 | +**URL** | The HTTP endpoint to send the request for processing. |
| 42 | +**Timeout** | A hard timeout limit (milliseconds) for the request. Requests exceeding this timeout are aborted and logged. The default value of 0 indicates there is no timeout limit. |
| 43 | +**Soft timeout** | A soft timeout limit (milliseconds) for the request. Requests exceeding this timeout are logged for debugging purposes. |
| 44 | +**Cache TTL** | The cache time-to-live (in seconds) for requests with the same URL, body, and headers. If this attribute is not specified, or if the value set to `0`, the response is not cached. |
| 45 | +**Fallback error message** | The error message to display when the hook fails. |
| 46 | +**Required** | Specifies whether hook execution is required or optional. When set to `Optional`, if the hook fails to execute, the failure is logged and subsequent hooks continue to be processed. When set to `Required`, a failure terminates the process. |
| 47 | +**Active** | Indicates whether to skip a removed hook during the batch execution. |
| 48 | +**Method** | The HTTP method (POST, PUT, GET, or DELETE) used to invoke the hook. |
| 49 | + |
| 50 | +You must define at least one hook field, and you will usually need to define request headers. You can also optionally define rules that allow the webhook to run in limited situations. Continue defining these entities and click **Save** when you have fully defined a new webhook. |
| 51 | + |
| 52 | +### Configure developer console OAuth |
| 53 | + |
| 54 | +The **Developer Console OAuth** configuration panel provides the ability to configure the details of an OAuth credential from the Adobe Developer Console. If configured and enabled, an IMS token will be generated using the credential details and passed in an Authorization header with the hook request. |
| 55 | + |
| 56 | +See [Setting up the OAuth Server-to-Server credential](https://developer.adobe.com/developer-console/docs/guides/authentication/ServerToServerAuthentication/implementation/#setting-up-the-oauth-server-to-server-credential) for information on creating an OAuth credential in the Adobe Developer Console. |
| 57 | + |
| 58 | +Field | Description |
| 59 | +--- | --- |
| 60 | +**Enabled** | Indicates whether to use OAuth credential details to generate an Authorization token for hook requests. |
| 61 | +**Client ID** | The Client ID for the OAuth credential. |
| 62 | +**Client Secret** | The Client Secret for the OAuth credential. |
| 63 | +**Organization ID** | The Organization ID for the OAuth credential. |
| 64 | + |
| 65 | +### Configure hook fields |
| 66 | + |
| 67 | +The **Hook Fields** configuration panel defines the payload of a webhook request. [Define the hook body](./hooks.md#define-the-hook-body) describes how to construct the payload. |
| 68 | + |
| 69 | +Field | Description |
| 70 | +--- | --- |
| 71 | +**Name** | The path to the field to include in the transmitted webhook, such as `product.sku`. |
| 72 | +**Source** | The path to the value in the default webhook. If not set, the **Name** value is used. |
| 73 | +**Active** | Indicates whether to include the field in the payload. |
| 74 | + |
| 75 | +### Configure hook headers |
| 76 | + |
| 77 | +The **Hook Headers** configuration panel defines the headers of a webhook request. [Define request headers](./hooks.md#define-request-headers) describes how to send authorization tokens and other connection parameters. |
| 78 | + |
| 79 | +Field | Description |
| 80 | +--- | --- |
| 81 | +**Name** | The header name, in the same form as it will be sent. For example, `Authorization`. |
| 82 | +**Value** | The value of the header, such as `Bearer: <token>`. |
| 83 | +**Active** | Set to **No** to remove the header from the request. |
| 84 | + |
| 85 | +### Configure hook rules |
| 86 | + |
| 87 | +The **Hook Rules** configuration panel allows you to define rules that trigger a webhook when certain conditions are met. [Create conditional webhooks](./conditional-webhooks.md) describes how to configure hook rules. |
| 88 | + |
| 89 | +Field | Description |
| 90 | +--- | --- |
| 91 | +**Field** | The event field to be evaluated. For nested fields, use the dot-separated format, such as `data.order.product.id`. |
| 92 | +**Value** | The value to be compared. |
| 93 | +**Operator** | Defines which comparison operator to use. Examples include `equal`, `notEqual`, and `regex`. |
| 94 | +**Active** | Set to **No** to remove the rule from the request. |
| 95 | + |
| 96 | +## Webhook grid actions |
| 97 | + |
| 98 | +Actions for each hook in the **Webhooks** grid are available in the **Action** column. |
| 99 | + |
| 100 | +### Edit or delete an existing hook |
| 101 | + |
| 102 | +Click **Select** > **Edit** in the **Action** column to display a form for editing an existing hook's configuration. |
| 103 | + |
| 104 | + |
| 105 | + |
| 106 | +Click **Select** > **Delete** in the **Action** column to delete an existing hook. |
| 107 | + |
| 108 | +### Testing a webhook |
| 109 | + |
| 110 | +Click **Select** > **Test Webhook** in the **Action** column for a hook to open a page for testing execution of all hooks configured for the same webhook method and webhook type. |
| 111 | + |
| 112 | + |
| 113 | + |
| 114 | +In the **Request payload** textarea, input a webhook request payload in JSON format. After clicking the **Run Webhook** button, a banner will show at the top of the page indicating if webhook execution was successful or if an exception occurred. In the **Resolved payload** section, a JSON object showing the payload returned by the webhook after processing hook response operations is displayed. |
| 115 | + |
| 116 | +### Accessing hook logs |
| 117 | + |
| 118 | +Click **Select** > **Show Logs** in the **Action** column to open a grid displaying logging activity. The grid resembles the [Webhook Logs grid](./responses.md#database-logging), but displays activity for the one specific hook only. |
0 commit comments