Skip to content

Update an automation rule

PUT
/openapi/messagerule/{id}
curl --request PUT \
--url https://open-api.replyco.com/openapi/messagerule/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0 \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json-patch+json' \
--data '{ "ruleName": "Auto-mark read: Amazon support reports", "priority": 1, "inActive": true, "condition": { "tableName": "Thread", "fieldName": "Subject", "operator": "0 - Contain", "value1": "Amazon product support report available", "value2": "example", "relations": "example" }, "action": { "tableName": "Message", "fieldName": "Unread", "value": "false", "actionType": "0 - UpdateField", "relations": "example" } }'

Replaces the rule identified by id with the condition and action you send, so submit the complete rule (fetch it with GET /openApi/messageRule/{id}, change what you need, and PUT it back).

The request body is identical to Create an automation rule (POST /openApi/messageRule); see that endpoint for the full list of tables, columns, operators, actions and worked examples.

Recap

  • condition: tableName + fieldName + operator + value1 (+ value2 for Between); relations optional.
  • action: tableName + value + actionType (UpdateField or InsertRelation), fieldName for UpdateField; relations optional.
  • priority 0 keeps the rule after all existing rules.

Rules managed through the Open API have a single condition and action. Updating a rule that was created in the app with several conditions or actions replaces all of them with the single pair you send.

Errors

  • 400 with { "error": "…" } — same validation as create.
  • 404 — no rule with id exists.

The update is recorded in the automation change log.

id
required
string format: uuid

The id of the rule to update.

The complete rule definition.

Create or replace an automation rule. The same shape is used for create and update.

This is a simplified rule: exactly one condition and one action. Every incoming message is checked against the condition and, when it matches, the action is applied to that message’s thread. (The in-app rules engine supports multi-condition expressions; the Open API intentionally keeps a single condition/action for simplicity.)

object
ruleName
required

Human-readable rule name, shown in the app and in the thread change log. Required.

string
>= 1 characters

Example

Auto-mark read: Amazon support reports
priority

Execution order; lower numbers run first. Leave 0 to place the rule after all existing rules.

integer format: int32
inActive

Set true to create/keep the rule disabled. Defaults to enabled.

boolean
nullable
condition
required

The condition that must match for a rule to fire. It reads one field of one table, reached from the incoming message, and compares it with value1 (and value2 for Between).

object
tableName
required

The table to read: Message, Thread, Customer, Order, Task or Product (case-sensitive). Required.

string
>= 1 characters

Example

Thread
fieldName
required

The column of tableName to compare (case-sensitive), e.g. Subject on Thread, Text on Message, Email on Customer. See the endpoint description for the catalog per table. Required.

string
>= 1 characters

Example

Subject
operator
integer format: int32
Allowed values: 0 - Contain 1 - NotContain 2 - StartWith 3 - EndWith 4 - Equals 5 - Between
value1
required

The value to compare with, always sent as a string. Text: the fragment or exact value. Numbers: "100". Booleans: "true"/"false". Enums (thread status, marketplace): the numeric value, e.g. "3". Dates: a number of days ago ("7" = 7 days ago, must be 0 or greater) or an ISO date such as "2026-01-31". Required.

string
>= 1 characters

Example

Amazon product support report available
value2

The upper bound for Between. Required for numeric ranges; for dates it is the “newer” bound and may be omitted to mean “up to now”.

string
nullable
relations

Navigation path from Message to tableName, segments joined with &. Optional: it is filled in automatically for the documented tables (Thread → "Thread", Customer → "Thread&Customer", Order → "Thread&Order", Task → "Thread&Tasks"); Message and Product need none.

string
nullable
action
required

A single action applied to the matching message’s thread when the rule’s condition matches.

object
tableName
required

The table to change: Thread, Message or Task for UpdateField; FolderThreads for InsertRelation (case-sensitive). Required.

string
>= 1 characters

Example

Message
fieldName

The column to set (case-sensitive), e.g. Status, InActive, PriorityId on Thread; Unread on Message; UserId on Task. Required when actionType is UpdateField; ignored for InsertRelation.

string
nullable

Example

Unread
value
required

For UpdateField: the new value as a string — "3", "true", a GUID. For InsertRelation: a JSON object with the columns of the row to insert, e.g. {"FolderId":"4f6d…"} for FolderThreads. Required.

string
>= 1 characters

Example

false
actionType
integer format: int32
Allowed values: 0 - UpdateField 2 - InsertRelation
relations

Navigation path from Message to tableName, segments joined with &. Optional: filled in automatically for the documented tables (Thread → "Thread", Task → "Thread&Tasks", FolderThreads → "Thread&FolderThreads"); Message needs none.

string
nullable

The rule was updated and is returned.

Media typeapplication/json

An automation rule. When an incoming message matches the condition, the action is applied automatically.

The Open API represents a rule as a single condition and a single action. A rule created elsewhere with multiple conditions/actions is shown here by its first condition and first action.

object
id

Unique identifier of the rule.

string format: uuid
ruleName

Human-readable rule name.

string
nullable
priority

Execution priority; lower numbers run first.

integer format: int32
inActive

When true the rule is disabled.

boolean
nullable
condition

The condition that must match for an automation rule to fire.

object
id

Unique identifier of the condition.

string format: uuid
tableName

The entity the condition reads, e.g. Message, Thread, Customer, Order, Product.

string
nullable
fieldName

The field on tableName to compare, e.g. Text, Status, Marketplace.

string
nullable
operator
integer format: int32
Allowed values: 0 - Contain 1 - NotContain 2 - StartWith 3 - EndWith 4 - Equals 5 - Between
value1

Primary comparison value.

string
nullable
value2

Secondary value, used only with the Between operator.

string
nullable
relations

Navigation path from Message to the target table when the field is not directly on Message, e.g. "Thread".

string
nullable
action

A single action applied when an automation rule matches.

object
id

Unique identifier of the action.

string format: uuid
tableName

The entity the action modifies, e.g. Thread, Task, Message, FolderThreads.

string
nullable
fieldName

The field to set (for UpdateField).

string
nullable
value

For UpdateField: the scalar value to set. For InsertRelation: a JSON object describing the record to insert.

string
nullable
actionType
integer format: int32
Allowed values: 0 - UpdateField 2 - InsertRelation
relations

Navigation path when the action targets a table related to the thread/message.

string
nullable

Example

{
"condition": {
"operator": "0 - Contain"
},
"action": {
"actionType": "0 - UpdateField"
}
}

The request is invalid; the body’s error says why.

User is not authenticated or authorized.

No rule with the given id exists.