Triggers
A trigger says “fire this function when this event happens on this sender.” Triggers are how you build event-driven automation without an AI agent — just raw events, your code reacts.message.inbound event fires for sender snd_abc, the function
runs.
Event types
Run
npx zavudev fn triggers events for the always-current list.
Adding triggers
Single event, single sender
Single event, all senders in the project
Multiple events × multiple senders (cartesian)
Mix specific + any
Schedules (cron)
Thecron event type runs the function on a schedule instead of a messaging
event. Pass a standard 5-field expression (minute, hour, day-of-month, month,
day-of-week), evaluated in UTC, minimum granularity one minute:
fn triggers toggle --off) stops the schedule;
re-enabling restarts it from now — missed ticks are not replayed.
Handling events in code
When a trigger fires, your function’s default handler (defineFunction)
receives the event:
Pausing without removing
Toggle a trigger off without deleting:Removing
When triggers + defineAgent coexist
If your function has BOTH:defineAgent({...})running on a sender, AND- An explicit trigger for
message.inboundon the same sender
- The agent processes the message and replies via tools.
- Your
defineFunctiondefault handler also runs (the trigger fires it).
Native vs HTTP webhooks
Triggers are the native way to receive events. The old path — webhooks on senders — still works and is the right choice when your event receiver lives outside Zavu (an n8n flow, a Vercel function, an internal server). Inside Zavu Functions, prefer triggers:Common patterns
Escalate to human on certain keywords
Escalate to human on certain keywords
message.inbound and the agent on the same sender. Both
run; the LLM responds, your code pages the team.Track broadcast completion
Track broadcast completion
Welcome new contacts
Welcome new contacts
