Triggers

Triggers listen to integrations and create an event when a set of defined event criteria are met. An action is then creates a payload from the event and sends it to a defined channel using Rabbit MQ.

Examples of what triggers can be used for include:

  • Starting a process instance when an email with a specific subject line is received.
  • Sending a signal to a process when a specific message is written to a Slack channel.
  • Sending a message when a file is created in Alfresco Content Services.

Modeling triggers

Triggers contain an event definition that is configured in the source component such as a connector and an action configured for the individual trigger.

Triggers are stored as JSON files in the format <trigger-name>.json and can be modeled using the GUI or the JSON Editor.

The basic properties for triggers are:

PropertyDescriptionExample
IDThe unique identifier for a trigger. This is system generated and cannot be altered.trigger-223f6953-008a-426b-b22f-e8dd171ae47e
NameThe name of the trigger. Trigger names must be in lowercase and between 1 and 26 characters in length. Alphanumeric characters and hyphens are allowed, however the name must begin with a letter and end alphanumerically.email-approval-trigger
DescriptionA free text description of what the trigger doesA trigger to start a process when an approval email is received.

Events

Events are created when the configured event criteria are met.

The properties for trigger events are:

PropertyDescriptionExample
sourceA combination of the source of the event, the name of the source and event name to monitor in the format <source-type>.<source-name>.<event-name>connector.my-email.EMAIL_RECEIVED
Input valuesThe inputs for the trigger event.

Events are stored as a source containing the connector and event to use and a set of inputs containing the values for the trigger event, for example using the EMAIL_RECEIVED event for the email connector:

"event": {
    "inputs": {
        "pattern": "",
        "echo": "Email pattern matched. Starting a process instance.",
        "echoError": "We hit a problem starting a process instance for that message. "
    },
    "source": "connector.email-connector-1.EMAIL_RECEIVED"
}

The following are the events that can be configured for triggers:

Actions

Actions are the trigger payload that is created and sent when an event is created. The payload for an action can include the output parameters configured for an event.

The following are the actions that can be configured for triggers:

Start a process

The action to start a process will begin a specific process instance when event are met. The payload for the start a process action is:

PropertyDescriptionExampleRequired
processDefinitionKeyThe ID of the process to startProcess_YjqRw3n2Yes
nameThe name of the process instanceapproval-processYes
businessKeyAn optional business key ID for the process instance14240No
variablesValues from the trigger can be mapped to process variables. For a connector this will include the output parameters configured in the connector event definition.No
sourceThe source is automatically set and is the channel that the action is sent tocommand-consumer

Actions are stored as a payload, for example using the start a process action for the EMAIL_RECEIVED event of the email connector:

"action": {
    "source": "command-consumer",
    "payload": {
        "payloadType": "StartProcessPayload",
        "processDefinitionKey": "Process_YjqRw3n2",
        "variables": {
            "sender": "${emailFrom}",
            "recipient": "${emailTo}",
            "subject": "${emailSubject}"
        },
        "name": "approval-process",
        "businessKey": "14240"
    }
}

Send a signal

The action to send a signal will send a named signal of global scope when an event criteria are met. The payload for a send signal action is:

PropertyDescriptionExampleRequired
NameThe name of the signal being emitted. There must be a signal catching event with the same name for the payload to be received.Signal_0n91cibYes
variablesValues from the trigger can be mapped to process variables. For a connector this will include the output parameters configured in the connector event definition. As a signal can be caught by multiple catching events, the variables must be written in JSON format.No
SourceThe source is automatically set and is the channel that the action is sent tocommand-consumer

Actions are stored as a payload, for example using the send a signal action for the EMAIL_RECEIVED event of the email connector:

"action": {
    "source": "command-consumer",
    "payload": {
        "payloadType": "StartProcessPayload",
        "variables": {
            "sender": "${emailFrom}",
            "recipient": "${emailTo}",
            "subject": "${emailSubject}"
        },
        "name": "Signal_0n91cib"
    }
}

Receive a message

The action to receive a message will send a named message when an event criteria are met. The payload for a receive message action is:

PropertyDescriptionExampleRequired
NameThe name of the message to send. There must be an intermediate message catching event or message boundary event with the same name for the payload to be received.Message_077epaxYes
correlationKeyAn optional correlation key can be provided for matching the message014-245No
payloadTypeThe payload type is set automatically to ReceiveMessagePayload.Yes
variablesValues from the trigger can be mapped to process variables. For a connector this will include the output parameters configured in the connector event definition.No
SourceThe source is automatically set and is the channel that the action is sent tocommand-consumer

Actions are stored as a payload, for example using the receive a message action for the EMAIL_RECEIVED event of the email connector:

"action": {
    "source": "command-consumer",
    "payload": {
        "payloadType": "ReceiveMessagePayload",
        "name": "Message_077epax",
        "correlationKey": "00-1245"
    }
}

Send a start message

The action to send a start message will send a named message when an event criteria are met to start a process that contains a start message event. The payload for a send message action is:

PropertyDescriptionExampleRequired
NameThe name of the message to send. There must be a start message event with the same name for the payload to be received.Message_077epaxYes
businessKeyAn optional business key can be sent with the message to contain custom values.No
payloadTypeThe payload type is set automatically to StartMessagePayload.Yes
variablesValues from the trigger can be mapped to process variables. For a connector this will include the output parameters configured in the connector event definition.No
SourceThe source is automatically set and is the channel that the action is sent tocommand-consumer

Actions are stored as a payload, for example using the send a start message action for the EMAIL_RECEIVED event of the email connector:

"action": {
    "source": "command-consumer",
    "payload": {
        "payloadType": "StartMessagePayload",
        "name": "Message_077epax",
        "businessKey": "event-message",
        "variables": {
            "trigger": "${name}"
        }
    }
}

Execute a script

The action to execute a script will execute a named script that exists in the same project as the trigger.

PropertyDescriptionExampleRequired
scriptNameThe name of the script is automatically populated from the selected script.update-orders-scriptYes
scriptIdThe ID of the script is automatically populated from the selected script.19ced673-e701-4e6c-ace6-f8aaee5455ebYes
variablesValues from the trigger event outputs can be mapped to script variables.No

© 2023 Alfresco Software, Inc. All Rights Reserved.