Skip to main content
Triggers subscribe to events and execute handlers when those events occur. They enable your agent to respond to external events from integrations or system events.

Creating a trigger

Create a trigger in src/triggers/:
Triggers subscribe to events using an array of event names. The above Trigger only executes when it receives the webchat:conversationStarted event.

Naming a Trigger

Trigger names can contain only alphanumeric characters and underscores.

Event structure

The handler receives an event object with:
  • event.type - The event type string (one of the subscribed events)
  • event.payload - The event payload data (varies by event type)
You can read these properties to handle the event appropriately:
For reference information about the payload from integration events, check out the Integrations documentation.

Multiple event subscriptions

A trigger can subscribe to multiple events and handle each of them differently:

Reference

Trigger props

Handler parameters

The handler function receives the matched event: