Skip to content

Trigger Commands

The canviq trigger commands manage survey triggers. Triggers define when and how a survey is shown to users. All operations require authentication (see Authentication) and accept the global --json/--quiet flags (see Scripting and CI).

Valid trigger types: event, manual, scheduled, page_view.

trigger list <survey-id>

List all triggers for a survey.

canviq trigger list srv_abc123
canviq trigger list srv_abc123 --json

Options

Flag Description
--json Output raw JSON
--quiet Suppress output except errors

The table output shows: id, type, active, config, created_at.

trigger create <survey-id>

Create a trigger for a survey. Run canviq trigger create --help for the full config schema for every trigger type, kept in sync with the tools that read and write it.

# Event trigger fired when the user completes onboarding
canviq trigger create srv_abc123 \
  --type event \
  --config '{"event":"onboarding_complete","min_count":1}'

# Manual trigger (no automatic firing, no config fields)
canviq trigger create srv_abc123 --type manual

# Page view trigger (no config fields)
canviq trigger create srv_abc123 --type page_view --json

# Scheduled trigger: fires every 30 days, 90-day cooldown per user
canviq trigger create srv_abc123 \
  --type scheduled \
  --config '{"window_days":30,"cooldown_days":90}'

Options

Flag Required Description
--type <type> yes Trigger type: event, manual, scheduled, page_view
--config <json> no Trigger config as a JSON string (schema below)
--json no Output raw JSON
--quiet no Suppress output except errors

trigger update <trigger-id>

Update a trigger's config or active state. At least one of --config or --active is required. --config replaces the existing config wholesale (it is not deep-merged), so pass every field the trigger's config needs, not just the one changing. Run canviq trigger update --help for the full config schema for every trigger type.

# Disable a trigger
canviq trigger update trig_abc --active false

# Update config on an event-type trigger
canviq trigger update trig_abc \
  --config '{"event":"payment_complete","min_count":1}' \
  --json

# Enable and update config together (event-type trigger, including the
# optional cooldown_days field used by the pmf_create shortcut)
canviq trigger update trig_abc \
  --active true \
  --config '{"event":"payment_complete","min_count":1,"cooldown_days":90}'

Options

Flag Description
--config <json> New trigger config as a JSON string (schema below)
--active <bool> Set active state: true or false
--json Output raw JSON
--quiet Suppress output except errors

--active accepts only true or false. Other values (such as 1, yes, enable) are rejected with exit code 2.

trigger delete <trigger-id>

Delete a trigger. The CLI prompts for confirmation unless --yes is passed.

canviq trigger delete trig_abc
# Delete trigger trig_abc? This action cannot be undone. [y/N]

canviq trigger delete trig_abc --yes
canviq trigger delete trig_abc --yes --quiet

Options

Flag Description
--yes Skip the confirmation prompt
--json Output raw JSON
--quiet Suppress output except errors

!!! warning In non-TTY environments (CI, piped input), the confirmation prompt will cause the process to exit with code 2 if --yes is not passed. Always pass --yes in scripts.