create_automation_rule
Creates an enabled automation rule that matches conversations by conditions and applies actions, such as assigning agents or adding tags. Read it back with get_automation_rule to verify.
Instructions
Create Automation Rule
Creates an automation rule. Requires the automations:manage permission. The rule is ENABLED as soon as it is created (the table default) and starts applying to the next matching conversation; use toggle_automation_rule to disable it. The server does not validate the content of rules: a malformed rule is stored and then silently never matches, so read it back with get_automation_rule. Example, assign every new conversation whose subject contains a text to agent 5: type new_conversation, events [], rules [{"group_operator":"AND","groups":[{"logical_op":"AND","rules":[{"field":"subject","field_type":"conversation","operator":"contains","value":"Company switched from","case_sensitive_match":false}]}],"actions":[{"type":"assign_user","value":["5"]}]}].
POST /api/v1/automations/rules
Tags: Automations
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | (body) | |
| type | Yes | (body) new_conversation: on every new conversation. conversation_update: on the listed events. time_trigger: periodic, on the hours_since_* conditions | |
| rules | Yes | (body) A JSON array of rule blocks, not a string | |
| events | No | (body) Only for conversation_update; leave empty for the other types | |
| enabled | No | (body) Only read by update_automation_rule, which stores it (false when omitted). Ignored on create: a created rule is always enabled | |
| description | No | (body) |