-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Admin configuraiton details #152
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,11 +21,65 @@ The rows of this grid show configuration settings for all registered hooks, both | |
|
||
## Create a new hook | ||
|
||
Click **Add New Webhook** from the grid page to display the form for creating a new hook. If the plugin for the webhook method and type entered into the form has not been generated for the Commerce instance, a warning to run the `webhooks:generate:module` command will appear upon clicking **Save**. | ||
Click **Add New Webhook** from the grid page to display the form for creating a new hook. | ||
|
||
<InlineAlert variant="warning" slots="text" /> | ||
|
||
On Cloud instances, due to the read-only file system, the `webhooks:generate:module` command cannot be run. If a plugin-type webhook is added through the Admin, the method name and type should be declared in a `webhooks.xml` file so that the required plugin is generated during the build phase of the deployment process. | ||
If the plugin for the webhook method and type entered into the form have not been generated for the Commerce instance, a warning to run the `webhooks:generate:module` command will appear upon clicking **Save**. You cannot run the `webhooks:generate:module` command on Cloud instances, due to its read-only file system. If you add a plugin-type webhook through the Admin, declare the method name and type in a `webhooks.xml` file. | ||
|
||
 | ||
|
||
The **Hook Settings** configuration panel contains the following fields: | ||
|
||
Field | Description | ||
--- | --- | ||
**Webhook Method** | The internal name of a webhook. The value must be in the form `<type>.<webhook_name>`, where `type` is either `observer` or `plugin`, and `webhook_name` matches a valid Commerce event name. Use the [`bin/magento webhooks:list:all`](commands.md#return-a-list-of-supported-webhook-event-names) command to display a list of possible webhooks. | ||
**Webhook Type** | Select whether to run the webhook `before` or `after` the original action. | ||
**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. | ||
**Hook Name** | A name that must be unique within a batch. The name must contain English alphanumeric characters and underscores (_) only. | ||
**URL** | The HTTP endpoint to send the request for processing. | ||
**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. | ||
**Soft timeout** | A soft timeout limit (milliseconds) for the request. Requests exceeding this timeout are logged for debugging purposes. | ||
**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. | ||
**Fallback error message** | The error message to display when the hook fails. | ||
**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. | ||
**Active** | Indicates whether to skip a removed hook during the batch execution. | ||
**Method** | The HTTP method (POST, PUT, GET, or DELETE) used to invoke the hook. | ||
|
||
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. | ||
|
||
### Configure hook fields | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One idea from Sasha was to show screenshots of each of the fields/headers/rules section. For fields though, there is already a screenshot later in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I decided against adding screenshots for the bottom half of the configuration screen. The UI is repetitive and I don't think adding the screenshots really adds anything. |
||
|
||
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. | ||
|
||
Field | Description | ||
--- | --- | ||
**Name** | The path to the field to include in the transmitted webhook, such as `product.sku`. | ||
**Source** | The path to the value in the default webhook. If not set, the **Name** value is used. | ||
**Converter** | A class that transforms the value of a field, such as from integer to string. | ||
**Active** | Indicates whether to include the field in the payload. | ||
|
||
### Configure hook headers | ||
|
||
The **Configure 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. | ||
|
||
Field | Description | ||
--- | --- | ||
**Name** | The header name, in the same form as it will be sent. For example, `Authorization`. | ||
**Value** | The value of the header, such as `Bearer: <token>`. | ||
**Resolver** | The resolver class that appends headers dynamically. | ||
**Active** | Set to **No** to remove the header from the request. | ||
|
||
### Configure hook rules | ||
|
||
The **Configure 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. | ||
|
||
Field | Description | ||
--- | --- | ||
**Field** | The event field to be evaluated. For nested fields, use the dot-separated format, such as `data.order.product.id`. | ||
**Value** | The value to be compared. | ||
**Operator** | Defines which comparison operator to use. Examples include `equal`, `notEqual`, and `regex`. | ||
**Active** | Set to **No** to remove the rule from the request. | ||
|
||
## Edit an existing hook | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could consider just adding a mention of deploying after declaring the method name and type in a
webhooks.xml
file since it's during the deployment process that the needed plugin class would get generatedThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We decided to leave this as-is. I added a statement to the events and webhooks
generate:module
commands stating they're for on-premises only,