Automation Actions

Actions are the work an automation does. They run sequentially in sort_order order after all conditions pass.

Schema

CREATE TABLE automation_actions (
  id              INT AUTO_INCREMENT PRIMARY KEY,
  id_automation   INT NOT NULL,
  action_type     VARCHAR(50) NOT NULL,
  config          JSON,
  sort_order      INT DEFAULT 0,
  delay_seconds   INT DEFAULT 0
);

config is a JSON object whose keys depend on action_type.

Available action types

Contact actions

contact.update_field

Update a field on the triggering contact.

{ "field": "status", "value": "qualified" }

contact.add_tag

Add a tag to the contact.

{ "tag": "hot-lead" }

contact.remove_tag

Remove a tag from the contact.

{ "tag": "cold" }

contact.assign_owner

Assign the contact to a team member.

{ "user_id": 14 }

Deal actions

deal.create

Create a new deal linked to the triggering contact.

{
  "pipeline_id": 3,
  "stage_id": 11,
  "title": "New opportunity",
  "value": 0
}

deal.move_stage

Move the triggering deal to a different stage.

{ "stage_id": 15 }

deal.update_field

Update a field on the triggering deal.

{ "field": "value", "value": "5000" }

Messaging actions

sms.send

Send an SMS to the contact's primary phone number.

{
  "message": "Hi {{contact.first_name}}, just following up!",
  "from_number": "+15551234567"
}

Template variables: {{contact.first_name}}, {{contact.last_name}}, {{contact.phone}}, {{contact.email}}, {{deal.title}}

email.send

Send a transactional email.

{
  "to": "{{contact.email}}",
  "subject": "Next steps for {{deal.title}}",
  "body_html": "Hi {{contact.first_name}}..."
}

Notification actions

notification.internal

Create an in-app notification for a team member.

{
  "user_id": 14,
  "message": "New high-score lead: {{contact.first_name}} {{contact.last_name}}"
}

Flow control actions

automation.wait

Pause the sequence for a period of time. Set delay_seconds on the action row rather than using config.

webhook.post

POST JSON to an external URL.

{
  "url": "https://hooks.zapier.com/...",
  "payload": {
    "contact_id": "{{contact.id}}",
    "event": "qualified"
  }
}

Delays

Set delay_seconds on any action to pause before it runs. A 24-hour delay: delay_seconds: 86400. The automation holds state between delayed actions — the sequence resumes even if the server restarts.

Execution logs

Every action run is recorded:

SELECT * FROM automation_logs
WHERE id_automation = 42
ORDER BY created_at DESC
LIMIT 50;
Column Description
status success, failed, skipped
action_type Which action ran
error_message Populated on failure
context_json Snapshot of the record at execution time
Actions — PushButtonCRM Dev