Automation Triggers

A trigger defines the event that fires an automation. Each automation has exactly one trigger, set in the trigger_type column of the automations table.

Available trigger types

Contact triggers

trigger_type Fires when
contact.created A new contact record is inserted
contact.updated Any field on a contact changes
contact.field_changed A specific field changes (set trigger_field)
contact.tag_added A tag is added to a contact
contact.tag_removed A tag is removed from a contact

Deal triggers

trigger_type Fires when
deal.created A new deal is created
deal.stage_changed A deal moves to a different pipeline stage
deal.won A deal is marked as won
deal.lost A deal is marked as lost
deal.value_changed The deal value changes

Campaign / SMS triggers

trigger_type Fires when
campaign.sent A campaign message is sent to a contact
campaign.replied A contact replies to a campaign message
sms.inbound Any inbound SMS is received

Time-based triggers

trigger_type Fires when
schedule.daily Once per day at a configured time
schedule.interval Every N minutes/hours (set trigger_interval)

Manual triggers

trigger_type Fires when
manual Triggered explicitly via API call or "Run now" button

Trigger configuration fields

SELECT trigger_type, trigger_field, trigger_value, trigger_interval
FROM automations
WHERE id_company = :id_company;
  • trigger_field — used with contact.field_changed to specify which field (e.g. status, lead_score)
  • trigger_value — optional; automation only fires when the field changes to this value
  • trigger_interval — used with schedule.interval; integer minutes

Important: multi-tenant scoping

All trigger evaluations check id_company before firing. An event on a contact belonging to company A will never fire an automation belonging to company B, even if the trigger type matches.

Missed call triggers

trigger_type Fires when
missed_call An inbound call goes unanswered (duration = 0 or status = no-answer). Context: from_number, to_number, id_customer (if number matched a contact), called_at

Missed call events are captured in missed_call_webhooks. After trigger evaluation, processed is set to true to prevent re-firing.

Appointment triggers

trigger_type Fires when
appointment.created A new appointment is inserted via POST /api/appointments
appointment.reminder NOW() is within trigger_interval minutes of appointment.start_time. Set trigger_interval to minutes before (e.g. 60 = 1 hour before)
appointment.status_changed appointments.status changes. Set trigger_value to the new status to match (e.g. no_show, cancelled)

Appointment reminder triggers require the scheduler route (/api/automations/schedule) to be called on a cron — every minute for minute-accurate reminders, or every 5 minutes for most use cases.