unsubscribe function. Call it to remove the listener.
Parameters
string
Optional. Scope the handler to a single trigger key. Omit to receive every executed trigger.
(event: TriggerEvent) => void
required
Called once per matched execution. The event payload is described below.
Event shape
anonymousId. When the user has been
identified via Hacktionbase.identify(), userId is also set; otherwise
it is null. To distinguish an identified vs. anonymous session, check whether
userId is non-null.
Examples
Listen for a single trigger
Prefill a form from extracted data
Catch every trigger (e.g. for analytics)
Security
- Trigger events are scoped to the current session. Your handler will never receive an event from another user.
- The same
executionEventIdis delivered to your backend webhook — use it to correlate the two, or to deduplicate retries. - For sensitive actions, prefer running the side effect in your backend webhook (where you can verify the HMAC signature) and use
onTriggeronly for UI side effects (redirect, prefill, toast).
Related
- See Chat Triggers to learn how to configure triggers in the dashboard.
- See Trigger pipeline for the end-to-end architecture.

