Webhook connector and action

edit

Webhook connector and action

edit

The Webhook connector uses axios to send a POST or PUT request to a web service.

Create connectors in Kibana

edit

You can create connectors in Stack Management > Connectors or as needed when you’re creating a rule. For example:

Webhook connector
Connector configuration
edit

Webhook connectors have the following configuration properties:

Name
The name of the connector.
URL
The request URL. If you are using the xpack.actions.allowedHosts setting, make sure the hostname is added to the allowed hosts.
Method
HTTP request method, either post(default) or put.
Headers
A set of key-value pairs sent as headers with the request
Require authentication
If true, a username and password for login type authentication must be provided.
Username
Username for HTTP basic authentication.
Password
Password for HTTP basic authentication.

Create preconfigured connectors

edit

If you are running Kibana on-prem, you can define connectors by adding xpack.actions.preconfigured settings to your kibana.yml file. For example:

xpack.actions.preconfigured:
  my-webhook:
    name: preconfigured-webhook-connector-type
    actionTypeId: .webhook
    config:
      url: https://test.host
      method: post
      headers:
        testheader: testvalue
    secrets:
      user: testuser
      password: passwordkeystorevalue

Config defines information for the connector type.

url
A URL string that corresponds to URL.
method
A string that corresponds to Method.
headers
A record<string, string> that corresponds to Headers.
hasAuth
A boolean that corresponds to Requires authentication. If true, this connector will require values for user and password inside the secrets configuration. Defaults to true.

Secrets defines sensitive information for the connector type.

user
A string that corresponds to User. Required if hasAuth is set to true.
password
A string that corresponds to Password. Should be stored in the Kibana keystore. Required if hasAuth is set to true.

Test connectors

edit

You can test connectors with the run connector API or as you’re creating or editing the connector in Kibana. For example:

Webhook params test

Webhook actions have the following properties.

Body

A JSON payload sent to the request URL. For example:

{
  "short_description": "{{context.rule.name}}",
  "description": "{{context.rule.description}}",
  ...
}

Mustache template variables (the text enclosed in double braces, for example, context.rule.name) have their values escaped, so that the final JSON will be valid (escaping double quote characters). For more information on Mustache template variables, refer to Actions.

Connector networking configuration

edit

Use the Action configuration settings to customize connector networking configurations, such as proxies, certificates, or TLS settings. You can set configurations that apply to all your connectors or use xpack.actions.customHostSettings to set per-host configurations.