Webhook plug-in structure

In this topic you can find information about configuring Webhook event sources and Webhook event conditions.

Configuring a Webhook event source

There are three different types of configuration for event sources that receive Webhook events:
  • Generic HMAC
    When configuring a Generic HMAC type event source, you need to specify the following parameters:
    Secret
    • Type: string
    • minlength: 1
    • maxlength: 1000
    • Required
    • isPassword
    The secret is a cryptographic key shared between the sender and receiver. This key is used by the payload in a HMAC algorithm to generate a hexadecimal hash-based digest applied to the Webhook message.
    Algorithm
    • Type: string
    • minlength: 1
    • maxlength: 1000
    • Required
    You need to specify the generic cryptographic hash function you want to use. You can choose between two set values:
    • {"name": "SHA-256"}
    • {"name": "SHA-512"}
    HeaderName
    • Type: string
    • minlength: 1
    • maxlength: 1000
    • Required
    The name of the header that in the Webhook message contains information derived from the calculation of the secret and the hashing algorithm, which are then matched with HCL Universal Orchestrator internal calculations. If the header and the internal calculations match, the event is authorized to be received and processed. The value of the header must be calculated as a hexadecimal HMAC digest.
    IPNetMask
    • Type: list
    • minlength: 1
    • maxlength: 1000
    You can specify an IP net mask to filter one or more IPs you want to receive events from.
  • Generic
    When configuring a Generic type event source you can specify:
    IPNetMask
    • Type: list
    • minlength: 1
    • maxlength: 1000
    You can specify an IP net mask to filter one or more IPs you want to receive events from.
  • Github
    When configuring a Github type event source, you need to specify the following mandatory parameter:
    Secret
    • Type: string
    • minlength: 1
    • maxlength: 1000
    • Required
    • isPassword
    You need to specify a secret cryptographic key.
    IPNetMask
    • Type: list
    • minlength: 1
    • maxlength: 1000
    You can specify an IP net mask to filter one or more IPs you want to receive events from.

Example

The following is an example of a generic type event source configured to receive Webhook events:
$eventsource

EVENT_SOURCE /WEBHOOK1
DESCRIPTION "Webhook testing"
PLUGIN Webhook
TYPE GenericHMAC
CONFIGURATION {

      "secret": "secretvalue",
      "algorithm": "SHA-256",
      "headerName": "headerNamevalue",
      "ipNetMask": ["xxx.xxx.x.x/xx"]

         }
END

Configuring a Webhook event condition

WebhookEvent type event conditions can be configured in workflows specifying the following required properties:
  • Name
    Restriction: If you want to start the event condition name with the prefix "in", ensure that the name is enclosed within double quotes.
  • Type
  • Event source
Note: When defining event conditions, all the relative fields are case insensitive
You can also specify any number of properties that filter the events received from the event source:
Method
  • Type: string
  • Operator: EQ("=") or NE("!=")
  • minlength: 1
  • maxlength: false
  • Wildcard allowed: false
  • Multiple filters: true
  • Single predicate: false
  • Case sensitive: false
  • Values: you can choose one or more:
    • POST
    • GET
    • DELETE
    • PUT
    • OPTIONS
    • HEAD
    • CONNECT
    • PATCH
    • TRACE
Specify the method of the Webhook callback to enable filtering of events that either match or do not match the specified input.
Headers
  • Type: map
  • Operator: KEY_VALUE("keyvalue")
  • minlength: 1
  • maxlength: 1000
  • Wildcard allowed: true
  • Multiple filters: false
  • Single predicate: false
  • Case sensitive: false
  • Values: {HeaderName[,Headervalue]}
Specify the key and or value of the Webhook header to enable filtering of events that either match or do not match the specified input.
Parameters
  • Type: map
  • Operator: KEY_VALUE("keyvalue")
  • minlength: 1
  • maxlength: 1000
  • Wildcard allowed: true
  • Multiple filters: false
  • Single predicate: false
  • Case sensitive: false
  • Values: {ParamName[,Paramvalue]}
Specify the key and or value of the Webhook parameter to enable filtering of events that either match or do not match the specified input.
ContentType
  • Type: string
  • Operator: EQ("=") or NE("!=")
  • minlength: 1
  • maxlength: false
  • Wildcard allowed: true
  • Multiple filters: true
  • Single predicate: false
  • Case sensitive: false
  • Values: application/json
Specify the content type of the Webhook event to enable filtering of events that either match or do not match the specified input.
Body
  • Type: json
  • Operator: JSONATA("jsonata")
  • minlength: 1
  • maxlength: 1000
  • Wildcard allowed: false
  • Multiple filters: false
  • Single predicate: true
  • Case sensitive: false
  • Values: jsonataExpression
Specify the jsonata expression of the Webhook body to enable filtering of events that either match or do not match the specified input.

Example

The following is an example of a workflow with three Webhook event conditions:
$jobstream

WORKFLOW /WS_AGT_1#/WF_EVT_TRIGGER_WH
  DESCRIPTION "Event driven workflow webhook"
  TRIGGER TRIGGER1 DESCRIPTION "Sample event trigger" TIMEOUT PT1M CORRELATIONS method CONDITIONS
    NAME EC TYPE "Webhook/WebhookEvent" SOURCE /WEBHOOK1 FILTERS method = POST
    NAME CC TYPE "Webhook/WebhookEvent" SOURCE /WEBHOOK1 FILTERS headers keyvalue {HEADERNAME,HEADERVALUE}
    NAME CE TYPE "Webhook/WebhookEvent" SOURCE /WEBHOOK1 FILTERS body jsonata $.test.testing[0].tested
  ENDTRIGGER
:
END