Creating a webhook action

A webhook action is a type of action that invokes a webhook. You can create a webhook action by using a curl command or by using the Swagger UI for the WebSphere Automation REST API.

About this task

You must have access to the WebSphere Automation REST API, and you must authenticate with Red Hat OpenShift Container Platform administrator credentials by clicking Authorize on the Swagger UI page.

Creating a webhook action in WebSphere Automation

Because a webhook action is a type of action, make sure that you are familiar with the process to create an action.

  1. Do the first three steps in the instructions for creating an action.
  2. After you click Try it out, open the Examples menu and select WebhookActionCreationRequest.

    The example request body is populated with a sample webhook action.

  3. Edit the request body to set the parameters and values you want.

    Ensure that the value of the type parameter is webhook, and enter the details required by the webhook into the configuration parameter.

Refer to the following example for a valid configuration section.

  "configuration": {
    "targetUrl": "http://webhook-sim/abcdef/senddata",
    "method": "POST",
    "contentType": "application/json",
    "username": "j.doe@example.com",
    "password": "passw0rd",
    "headers": [
      {
        "name": "mycustomheader",
        "value": "{{somevalue}}"
      }
    ],
    "body": "{\"id\" : {{theId}}, \"data\": \"{{theData}}\"}"
  },

Of the parameters shown in the example, the only one that is required is the targetURL parameter. Set this parameter to the URL for the webhook that you want to invoke. For more information about the other parameters, see the Webhook action resource page.

The example shows the use of variables (for example, {{somevalue}}). Variables can be passed to an action from the trigger by using this Mustache syntax. Actions support other Mustache features; for more information, see Passing variables from the trigger.

What to do next

To invoke your webhook action, you must create a trigger.