Create an automation rule
const url = 'https://open-api.replyco.com/openapi/messagerule';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json-patch+json'}, body: '{ "ruleName": "Mark support reports read", "condition": { "tableName": "Thread", "fieldName": "Subject", "value1": "product support report" }, "action": { "tableName": "Message", "fieldName": "Unread", "value": "false" } }'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://open-api.replyco.com/openapi/messagerule \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json-patch+json' \ --data '{ "ruleName": "Mark support reports read", "condition": { "tableName": "Thread", "fieldName": "Subject", "value1": "product support report" }, "action": { "tableName": "Message", "fieldName": "Unread", "value": "false" } }'Creates an automation rule. Every incoming message is checked against the rule’s condition; when it matches,
the action is applied to that message’s thread. Rules run in priority order (lowest number first).
A rule created here has exactly one condition and one action. For AND/OR groups of conditions or several actions, build the rule in the rule editor of the Replyco app; such rules are still listed here by their first condition and first action.
Request body
{
"ruleName": "Auto-mark read: Amazon support reports",
"priority": 0,
"inActive": false,
"condition": {
"tableName": "Thread",
"fieldName": "Subject",
"operator": "Contain",
"value1": "Amazon product support report available",
"value2": null,
"relations": null
},
"action": {
"tableName": "Message",
"fieldName": "Unread",
"value": "false",
"actionType": "UpdateField",
"relations": null
}
}
ruleName— required. Shown in the app and in each thread’s change log.priority— optional.0places the rule after all existing rules; otherwise lower numbers run first.inActive— optional.truecreates the rule disabled.condition.tableName/condition.fieldName— required. Which table and column to read (case-sensitive).condition.operator— how to compare; name or number, see below. Defaults toContain.condition.value1— required. What to compare with, always a string.condition.value2— the upper bound forBetween.action.tableName— required.action.fieldName— the column to set; required forUpdateField.action.value— required. The new value as a string, or a JSON object forInsertRelation.action.actionType—UpdateField(0) orInsertRelation(2); name or number. Defaults toUpdateField.relations— optional on both. The navigation path fromMessagetotableName; it is filled in automatically for every table listed below, so you can leave it out.
Operators (condition.operator)
Contain(0) —value1appears anywhere in the field. Text only.NotContain(1) —value1does not appear; also true when the field is empty. Text only.StartWith(2) /EndWith(3) — the field starts / ends withvalue1. Text only.Equals(4) — exact match. Any type.Between(5) —value1≤ field ≤value2. Numbers and dates.
How to write value1 / value2 per field type
- Text — the fragment or exact text, e.g.
"refund". - Numbers (
OrderTotalAmount,NumberOfMessages) —"100".Betweenneeds bothvalue1andvalue2. - Dates (
CreatedDate,LastUpdated,PurchaseDate,LatestShipDate,MessageDate) — useBetween. Each bound is either a number of days ago ("7"= 7 days ago; must be 0 or greater) or an ISO date ("2026-01-31").value1is the older bound andvalue2the newer one; leavevalue2out to mean “up to now”.- created within the last 7 days:
value1"7" - created between 30 and 7 days ago:
value1"30",value2"7" - not updated for 30 days:
value1"2000-01-01",value2"30"
- created within the last 7 days:
- Yes/no (
InActive,IsFromCompany,IsBlocked,Paid) —Equalswith"true"or"false". - Statuses and marketplaces —
Equalswith the number. ThreadStatus: Open 0, InProgress 1, ActionRequired 2, Resolved 3, AwaitingCustomer 4, Snoozed 5.Marketplace: Ebay 1, Etsy 2, Mail 3, BigCommerce 4, WooCommerce 5, Magento 6, Shopify 7, Linnworks 8, Gmail 10, AmazonSP 16, Outlook 21 — the same numbers asmarketplacein thread and account responses. - Ids (
AccountId,PriorityId,UserId) —Equalswith the GUID.
Conditions — what you can test
- Message — the incoming message:
Text(body),Title(the message’s own subject line),To,SenderAddress,LanguageCode(e.g.en),AccountId(the connected account it arrived on),MessageDate,IsFromCompany. Computed:NumberOfMessages— how many messages the thread has (Equals/Between). - Thread — the ticket:
Subject,Status,Marketplace,CreatedDate,LastUpdated,InActive(archived),PriorityId,SalesChannel. Computed:DayOfWeek—Equalswith a JSON array of weekdays invalue1, 0 = Sunday … 6 = Saturday, e.g."[0,6]"for weekends. - Customer —
CustomerName,FirstName,LastName,Email,Phone,Marketplace,LanguageCode,IsBlocked. - Order — the order linked to the thread:
Status(text, e.g.Shipped),PaymentStatus(text),MarketOrderId,OrderTotalAmount,PurchaseDate,LatestShipDate,TrackingNumber,ShippingService,PaymentMethod,ShopName,Paid. - Task — the assignment:
UserId(assigned user; ids fromGET /openApi/user/id_name). - Product — products of the linked order or thread:
Title,MarketItemId,Category,SKU(text operators).
Other columns of these tables are accepted too, as long as value1 converts to the column’s type.
Actions — what you can do
- Set thread status —
Thread/Status/"3"(numbers as above). The inbox list is updated as well. - Archive / unarchive —
Thread/InActive/"true"or"false". - Set SLA priority —
Thread/PriorityId/"{priorityId}"(thepriorityIdshown on thread responses). - Assign to a user —
Task/UserId/"{userId}"(ids fromGET /openApi/user/id_name). - Mark read / unread —
Message/Unread/"false"(read) or"true"(unread). - Add to a folder (label) —
actionTypeInsertRelation,tableNameFolderThreads,value{"FolderId":"{folderId}"}(the same folder ids asPOST /openApi/folderThreads/assignFoldersToThreads).
More examples
Resolve threads whose order has shipped:
{ "ruleName": "Resolve shipped orders",
"condition": { "tableName": "Order", "fieldName": "Status", "operator": "Equals", "value1": "Shipped" },
"action": { "tableName": "Thread", "fieldName": "Status", "value": "3", "actionType": "UpdateField" } }
Assign every message mentioning “refund” to a team member:
{ "ruleName": "Refunds to Anna",
"condition": { "tableName": "Message", "fieldName": "Text", "operator": "Contain", "value1": "refund" },
"action": { "tableName": "Task", "fieldName": "UserId", "value": "6f1c0a2e-9d2b-4c1e-8a7f-2b3c4d5e6f70", "actionType": "UpdateField" } }
Label orders over 500 with a “VIP” folder:
{ "ruleName": "VIP orders",
"condition": { "tableName": "Order", "fieldName": "OrderTotalAmount", "operator": "Between", "value1": "500", "value2": "1000000" },
"action": { "tableName": "FolderThreads", "value": "{\"FolderId\":\"0b4e6c1d-2f3a-4b5c-9d8e-7f6a5b4c3d2e\"}", "actionType": "InsertRelation" } }
Archive weekend tickets from eBay:
{ "ruleName": "Archive weekend eBay tickets",
"condition": { "tableName": "Thread", "fieldName": "DayOfWeek", "operator": "Equals", "value1": "[0,6]" },
"action": { "tableName": "Thread", "fieldName": "InActive", "value": "true", "actionType": "UpdateField" } }
(A single rule has one condition, so “from eBay” would be a second rule or an in-app rule with two conditions.)
Give a priority to customers writing from a specific domain:
{ "ruleName": "Key account priority",
"condition": { "tableName": "Customer", "fieldName": "Email", "operator": "EndWith", "value1": "@bigretailer.com" },
"action": { "tableName": "Thread", "fieldName": "PriorityId", "value": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d", "actionType": "UpdateField" } }
Errors
400with{ "error": "…" }— a required field is missing, the table or column does not exist, the value does not convert to the column’s type,Betweenon a number lacksvalue2, orrelationsdoes not lead totableName. The message names the problem, e.g.Problems with input MessageRule: Can't find field 'IsRead' in table 'Thread'.401— not authenticated.
The rule is scoped to the current company; the create is recorded in the automation change log.
Authorizations
Section titled “Authorizations”Request Body
Section titled “Request Body”The rule to create.
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
Human-readable rule name, shown in the app and in the thread change log. Required.
Execution order; lower numbers run first. Leave 0 to place the rule after all existing rules.
Set true to create/keep the rule disabled. Defaults to enabled.
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
The table to read: Message, Thread, Customer, Order, Task or
Product (case-sensitive). 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.
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.
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”.
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.
A single action applied to the matching message’s thread when the rule’s condition matches.
object
The table to change: Thread, Message or Task for UpdateField;
FolderThreads for InsertRelation (case-sensitive). Required.
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.
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.
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.
Example
{ "ruleName": "Mark support reports read", "condition": { "tableName": "Thread", "fieldName": "Subject", "value1": "product support report" }, "action": { "tableName": "Message", "fieldName": "Unread", "value": "false" }}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
Human-readable rule name, shown in the app and in the thread change log. Required.
Example
Auto-mark read: Amazon support reportsExecution order; lower numbers run first. Leave 0 to place the rule after all existing rules.
Set true to create/keep the rule disabled. Defaults to enabled.
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
The table to read: Message, Thread, Customer, Order, Task or
Product (case-sensitive). Required.
Example
ThreadThe 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.
Example
SubjectThe 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.
Example
Amazon product support report availableThe upper bound for Between. Required for numeric ranges; for dates it is the “newer” bound and
may be omitted to mean “up to now”.
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.
A single action applied to the matching message’s thread when the rule’s condition matches.
object
The table to change: Thread, Message or Task for UpdateField;
FolderThreads for InsertRelation (case-sensitive). Required.
Example
MessageThe 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.
Example
UnreadFor 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.
Example
falseNavigation 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.
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
Human-readable rule name, shown in the app and in the thread change log. Required.
Example
Auto-mark read: Amazon support reportsExecution order; lower numbers run first. Leave 0 to place the rule after all existing rules.
Set true to create/keep the rule disabled. Defaults to enabled.
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
The table to read: Message, Thread, Customer, Order, Task or
Product (case-sensitive). Required.
Example
ThreadThe 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.
Example
SubjectThe 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.
Example
Amazon product support report availableThe upper bound for Between. Required for numeric ranges; for dates it is the “newer” bound and
may be omitted to mean “up to now”.
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.
A single action applied to the matching message’s thread when the rule’s condition matches.
object
The table to change: Thread, Message or Task for UpdateField;
FolderThreads for InsertRelation (case-sensitive). Required.
Example
MessageThe 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.
Example
UnreadFor 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.
Example
falseNavigation 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.
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
Human-readable rule name, shown in the app and in the thread change log. Required.
Example
Auto-mark read: Amazon support reportsExecution order; lower numbers run first. Leave 0 to place the rule after all existing rules.
Set true to create/keep the rule disabled. Defaults to enabled.
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
The table to read: Message, Thread, Customer, Order, Task or
Product (case-sensitive). Required.
Example
ThreadThe 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.
Example
SubjectThe 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.
Example
Amazon product support report availableThe upper bound for Between. Required for numeric ranges; for dates it is the “newer” bound and
may be omitted to mean “up to now”.
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.
A single action applied to the matching message’s thread when the rule’s condition matches.
object
The table to change: Thread, Message or Task for UpdateField;
FolderThreads for InsertRelation (case-sensitive). Required.
Example
MessageThe 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.
Example
UnreadFor 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.
Example
falseNavigation 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.
Responses
Section titled “Responses”The rule was created and is returned.
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
Unique identifier of the rule.
Human-readable rule name.
Execution priority; lower numbers run first.
When true the rule is disabled.
The condition that must match for an automation rule to fire.
object
Unique identifier of the condition.
The entity the condition reads, e.g. Message, Thread, Customer, Order, Product.
The field on tableName to compare, e.g. Text, Status, Marketplace.
Primary comparison value.
Secondary value, used only with the Between operator.
Navigation path from Message to the target table when the field is not directly on Message, e.g. "Thread".
A single action applied when an automation rule matches.
object
Unique identifier of the action.
The entity the action modifies, e.g. Thread, Task, Message, FolderThreads.
The field to set (for UpdateField).
For UpdateField: the scalar value to set. For InsertRelation: a JSON object describing the record to insert.
Navigation path when the action targets a table related to the thread/message.
Example
{ "id": "1d3f5a7c-9e2b-4d6f-8a0c-2e4f6a8c0e2b", "ruleName": "Mark support reports read", "priority": 7, "inActive": null, "condition": { "id": "4b6d8f0a-2c4e-4f6a-9b1d-3f5a7c9e1b3d", "tableName": "Thread", "fieldName": "Subject", "value1": "product support report", "value2": null, "relations": "Thread" }, "action": { "id": "6e8a0c2e-4a6c-4e8a-8c0e-5a7c9e1b3d5f", "tableName": "Message", "fieldName": "Unread", "value": "false", "relations": null }}The request is invalid; the body’s error says why.
User is not authenticated or authorized.