Skip to main content

Overview

By default the agent waits for the visitor to start the conversation. Triggers let you flip that around: you fire a trigger from your own page code, and the agent generates a message and shows it to the visitor — proactively. Use triggers for things like:
  • Greeting a visitor who has been idle on the pricing page
  • Offering help when someone reaches the third step of a checkout
  • Surfacing a relevant tip after the visitor performs an action
The prompt you pass is an instruction to the agent, not text shown verbatim. The agent reads it, decides what to say, and produces a natural reply.

Quick start


API

trigger(id, prompt, options?)

Returns a promise that resolves to { fired: boolean }. fired is false when a cooldown blocked the call.

Options


Display modes

prompt (default)

The agent’s reply appears as a small clickable bubble next to the floating button. Clicking it opens the chat. The message is saved to the conversation either way.

open

The chat panel expands automatically and the agent’s message appears in the thread.
In prompt mode the bubble auto-dismisses after about 15 seconds. The message stays in the conversation history regardless of whether the visitor clicks it.

Cooldowns

A trigger usually shouldn’t fire on every page load. The cooldown option throttles how often a given id is allowed to fire on a visitor’s device.
Cooldown state is keyed by the trigger id, so keep ids stable and unique. Changing an id resets its cooldown.

Sending page context with a trigger

The pageContext option lets the agent tailor its message to what the visitor is looking at — the same idea as page context, but bundled into the trigger call.

Firing before initialization

Zephlo.trigger(...) is also available as a global. If you call it before Zephlo.initialize() has run, it waits for initialization and then fires — handy when your trigger logic and your init script live in different places.

Next steps

Page context

Keep the agent informed about where the visitor is.

Theming

Match the widget’s colors and mode to your brand.