Skip to main content

Create an event-based trigger for external events

Triggers provide an effective way to automate your Genesys Cloud workflows. When you create an event-based trigger, you configure Genesys Cloud to take a specific action when a certain event occurs. For more information about trigger components, see .

External events in triggers

When you for external events, its fields are nested under the attributes object of the event. You can use these fields in trigger conditions to invoke a workflow only for the events that matter to you, such as purchases above a certain amount.

Before you create an event-based trigger for external events, create a custom schema and an event configuration under External Event Ingestion. Then, use the schema’s fields as conditions so the trigger invokes your workflow only when an event matches.

You can view the already created schema and copy the field name and its data type from the custom schema:

  1. Click Menu > Orchestration > External Event Ingestion.
  2. Open the relevant custom schema and note down the field name and its data type.
    Note: The field names are case-sensitive.

Create a trigger

To create a trigger, follow these steps:

  1. Click Menu > Orchestration > Triggers.
  2. Select the Event Based Triggers tab.
  3. Click Add Trigger.
  4. Enter a name and description for the trigger, and then click Add.
  5. Under Topic Name, select the topic for external events, v2.externalevents.contacts.{id}).
  6. Under Workflow Target, select the workflow to invoke.
  7. Under Data Format, select Json as the data format in which the input parameters route to the workflow.
    Notes:
    • The top-level primitives, such as strings, enums, numbers, and Boolean are sent to the workflow.

    • For JSON data format, the entire event is sent to the workflow as a JSON object. Configure the workflow to have an input variable named jsonData of type JSON. For more information, .

  8. (Optional) Specify the conditions to meet and invoke the trigger. To add a condition, click Add Condition.
    Note: When no conditions are set, the trigger invokes the workflow by default. Adhere to the if you want to apply this behavior.
    1. Specify the JSON Path in one of these ways:
      • In the Event Schema section, find the field and click the Add condition icon. Genesys Cloud generates the JSON Path and adds it to the condition. Alternatively, you can also click the Copy path icon and paste it in the JSON Path field. If the event schema of the topic defines part of the event only as a generic object, then load your custom JSON schema that describes the fields of that object. For more information, see .
      • Under JSON Path, enter the attribute path of the event schema manually. 
    2. To add the field name from the custom schema of an external event, click the Add condition icon next to the attributes object. Genesys Cloud adds a condition with the JSON Path $.attributes. In the JSON Path field, append the field name so the path reads $.attributes.[attribute_name], where attribute_name is the field name from your custom schema. For example, $.attributes.purchasePrice.
    3. Under Operator, select an operator for comparing the JSON Path with the user-defined values. For more information, see .
    4. Enter the values according to the type of operator selected.
      Note: Genesys Cloud formats the value based on the selected operator. For some values, you must present them in JSON format. Therefore, it is important to test the triggers for the conditions to ensure that the values format correctly in JSON.
  9. Select the timing configuration for the trigger. The Default selection does not add time restriction to the trigger and the workflow runs instantly. You can also select:
    • TTL – The threshold time after the event time stamp that a trigger executes. Enter the time in seconds. For external events, TTL is calculated from the createdDate that you provide in the event, not from when Genesys Cloud receives it. For example, enter 86400 to process only events less than one day old.
    • Delayed Start – Delay the execution of the workflow. This option is especially useful when you want to postpone the follow-up actions after an interaction. Enter the value in the range of 60–900 seconds.
  10. Click Create.
  11. (Optional) Click Save & Test. In the Test Trigger window, enter the test event in JSON format and click Test. The results show the validation of the test event, and verification of the target and conditions applied to the trigger. 
  12. To activate the trigger, switch the toggle to Active.
  13. Click Save.

Test the trigger

Before you activate a trigger, test it to validate the configuration. You can use the Notifications in the to generate an example event for the test. Testing helps you to identify any errors in the configuration.