Create Rule
gorgias_create_ruleCreate an automation rule with JavaScript logic and event triggers to automate helpdesk workflows.
Instructions
POST /api/rules — Create a new automation rule with JavaScript logic and event triggers.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"name": "<name>",
"code": "<code>"
},
"name": "gorgias_create_rule"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | The logic of the rule as JavaScript code | |
| name | Yes | The name of the rule | |
| code_ast | No | The logic of the rule as an ESTree AST representation (auto-generated from code if not specified) | |
| priority | No | Order of execution; rules with higher priority values are executed first | |
| description | No | A human-readable description of the rule | |
| event_types | No | Comma-separated list of events that trigger this rule. Allowed values: ticket-created, ticket-updated, ticket-message-created, ticket-assigned, ticket-self-unsnoozed, satisfaction-survey-responded | |
| deactivated_datetime | No | ISO 8601 datetime when the rule was deactivated. Set to null to create the rule as active |