Trigger resource

You can create trigger resources to detect events in WebSphere Automation and invoke an action as a result, such as sending an email or invoking a webhook. A trigger is independent of the action, and any number of triggers can be created to invoke an action.

About the trigger resource

The trigger resource encapsulates all of the metadata that is required for the trigger. A trigger invokes an action, but actions have no dependency on the method used to invoke it, which means that any number of triggers can be created that invoke an action.

Triggers are polymorphic; different types of triggers can be created, and are defined by the type parameter. A common set of metadata exist for all trigger resources.

  • name: an arbitrary name that you give the trigger
  • id: a unique, arbitrary alphanumeric identifier for the trigger
  • description: an arbitrary description of the trigger
  • actionId: the action ID of the action that you want to invoke; copy this value from the JSON definition of the action
  • type: the type of trigger; the only valid trigger type is resource trigger
  • configuration: a value that provides data and metadata needed for the type of trigger; for more information, see the specific trigger type
  • condition: (optional) a JSONata expression External link icon that provides more control over whether the action is invoked; if the expression evaluates as true or is not present, the condition in the action is checked
  • variableMapping: a list of mappings between the variables that are defined in the action (the keys) and the data from the WebSphere Automation event (the values, as JSONata expressions External link icon)

    Some events have additional context variables that can be referenced in expressions.

    • Vulnerability events
      • $asset
      • $bulletin
    • Installation events
      • $asset
      • $fix
    • Investigation events
      • $asset
  • enabled: set to true if the trigger is active
  • created: the ISO-8601 format date and time that the trigger was created
  • createdBy: the ID of the user that created the trigger
  • updated: the ISO-8601 format date and time that the trigger was most recently updated
  • updatedBy: the ID of the user that updated the trigger

In WebSphere Automation 1.6.2, the only type of trigger resource that is supported is the resource trigger. The resource trigger invokes its action when a resource is created, updated, or deleted.

Example JSON for trigger resource

{

  "id": "085bedbc-5ea7-4157-8044-4201be81b4ec",
  "name" : "My Resource Trigger",
  "description" : "An example resource trigger",
  "actionId" : "cc4175d9-9e3c-4236-8718-ec39aafe29c3",
  "type": "resource",
  "enabled": true,
  "configuration": {
    …
  },
  "condition": "$count(vulnerability.cves[cvssBaseScore > 9 ]) > 0",
  "variableMappings": {
    "someValue": "myHeaderValue",
    "theId": "$asset.id",
    "theData": "$asset.productName"
  },
  "created": "2018-01-30T13:00:00Z",
  "createdBy": "j.doe@example.com",
  "updated": "2018-01-30T14:00:00Z",
  "updatedBy": "f.gains@example.com"
}