Application

Event Trigger Node

The Event Trigger fires a workflow whenever an event matching the criteria defined in the trigger’s configuration is created or changes state.

Event Trigger

Node Properties

There are three configurable criteria for matching events…

Event Criteria

  • Event Level: The “level” of the event, with levels of Any, Info, Warning, Error, and Critical. The Any option will fire the trigger for an event of any level.
  • Event Subject: The “subject” of the event. Event subjects use case insensitive matching, with support for globbing. Leaving this field blank will cause the trigger to fire for any subject.
  • State: The “state” of the event, with the options of New (or reopened), Acknowledged, and Resolved.

In the above example, the workflow will be triggered whenever an event is created or placed in the “new” state with an Event Level of “Error” and has the subject “Abnormal Power Draw”.

Payload

The payload will include information about the event on the data field, as well as the standard workflow payload information. In the general case, an Event Trigger workflow payload will look like the following:

{
  "applicationId": "555555555555eeeeeeeeeeee",
  "applicationName": "My Great Application",
  "data": {
    "allUpdates": "<array of all updates to this event>",
    "creationDate": "<creation date of the event>",
    "data": "<structured data attached to the event>",
    "deviceId": "<ID of the device associated with this event>",
    "eventTags": "<object of tags associated with the event>",
    "id": "<ID of the created/updated event>",
    "latestUpdate": {
      "creationDate": "<creation date of the latest update to the event>",
      "sourceId": "<ID of the source that updated the event>",
      "sourceName": "<name of the source that updated the event>",
      "sourceType": "<apiToken|flow|user|experienceUser|public>",
      "stateChange": {
        "new": "acknowledged",
        "old": "new"
      }
    },
    "level": "<critical|error|warning|info>",
    "message": "<message included in the event creation>",
    "sourceId": "<ID of the source that created/updated the event>",
    "sourceType": "<apiToken|flow|user>",
    "state": "<new|acknowledged|resolved>",
    "subject": "<subject of the event>"
  },
  "flowId": "333333333333cccccccccccc",
  "flowName": "My Great Workflow",
  "flowVersion": "myFlowVersion",
  "globals": {
    "aJsonGlobal": {
      "key": "value"
    },
    "aNumberGlobal": 42,
    "aStringGlobal": "My value"
  },
  "relayId": "<ID of the resource that created/updated the event>",
  "relayType": "<apiToken|flow|user|experienceUser|public>",
  "time": Fri Feb 19 2016 17:26:00 GMT-0500 (EST),
  "triggerId": "<any|error|critical|warning|info>",
  "triggerType": "event"
}
  • data.deviceId is the ID of the device that is associated with this event. This field will be undefined if a device is not associated with this event.
  • triggerId will be the level the Event Trigger is set to trigger on. For example, if the Event Level is set to Any Level, this field will be "any".
  • relayId and data.latestUpdate.sourceId will match when an event is updated.
  • relayType and data.latestUpdate.sourceType will match when an event is updated.
  • data.sourceType and data.sourceId are the original source that created the event.
  • data.data is any additional data that you included with the event. If no additional data is included, this field will be undefined.
  • data.latestUpdate will be undefined for new events, but includes the above information when an event is updated.
  • data.sourceType of public means that an event was created or updated by an unauthenticated Experience User or through a Public Dashboard.

Was this page helpful?


Still looking for help? You can also search the Losant Forums or submit your question there.