Skip to content

Add a rule (checked after the existing ones)

POST
/v1/rules
curl --request POST \
--url https://api.threadkite.app/v1/rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "inboxId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "name": "example", "enabled": true, "conditions": { "sourceIds": [ "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" ], "locationIds": [ "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" ], "channels": [ "email" ] }, "action": { "type": "assign_user", "userId": "example", "userIds": [ "example" ], "savedReplyId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "appliesTo": "leads" } }'

Only people with a Full seat can be given threads.

Media typeapplication/json
object
inboxId

The inbox it is for (your default inbox when left out)

string format: uuid
name
required
string
>= 1 characters <= 80 characters
enabled

On unless you say otherwise

boolean
default: true
conditions
object
sourceIds
Array<string>
locationIds
Array<string>
channels
Array<string>
Allowed values: email sms whatsapp chat phone form api marketplace visit messenger instagram internal
action
required
object
type
required
string
Allowed values: assign_user round_robin auto_reply
userId

assign_user only

string
userIds

round_robin only

Array<string>
savedReplyId

auto_reply only: a shared saved reply

string format: uuid
appliesTo

auto_reply only: leads (when left out) or all

string
Allowed values: leads all
Media typeapplication/json
object
id
required
string format: uuid
inboxId
required

The inbox whose new threads it handles

string format: uuid
name
required
string
kind
required
string
Allowed values: assignment auto_reply
position
required

Rules are checked in this order, lowest first

number
enabled
required
boolean
fallback
required

The fallback: used when no other rule picks anyone, whatever its conditions (set it with PUT /v1/rules/fallback)

boolean
conditions
required
object
sourceIds
required

Only leads from these sources (empty: any source)

Array<string>
locationIds
required

Only threads at these locations (empty: every location)

Array<string>
channels
required

Only messages on these channels (empty: any channel)

Array<string>
Allowed values: email sms whatsapp chat phone form api marketplace visit messenger instagram internal
action
required
object
type
required

assign_user: a named person; round_robin: the next person in turn (the inbox’s members with a Full seat when userIds is empty); auto_reply: send a saved reply out of hours

string
Allowed values: assign_user round_robin auto_reply
userId
required

assign_user: who gets the thread

string
nullable
userIds
required

round_robin: the people taking turns (empty: the inbox’s members with a Full seat)

Array<string>
savedReplyId
required

auto_reply: the shared saved reply sent

string format: uuid
nullable
appliesTo
required

auto_reply: new leads only, or every message from a contact

string
nullable
Allowed values: leads all
problems
required

Why the rule may not do what it says now (someone left or has a Basic seat, a location was removed)

Array<string>
createdAt
required
string format: date-time
updatedAt
required
string format: date-time

Example

{
"name": "Google Ads leads to Sam",
"kind": "assignment",
"position": 0,
"conditions": {
"channels": [
"email"
]
},
"action": {
"type": "assign_user",
"appliesTo": "leads"
}
}
Media typeapplication/json
object
statusCode
required
number
code
required

Stable machine-readable reason

string
message
required
string
errors

With code invalid: every problem with the request, by field (message is the first)

Array<object>
object
path
required

Dotted path inside the item, e.g. attributes.price.amountMinor

string
message
required
string

Example

{
"statusCode": 403,
"code": "forbidden",
"message": "You do not have permission to do that.",
"errors": [
{
"message": "Enter the make"
}
]
}

Missing or invalid API key

Media typeapplication/json
object
statusCode
required
number
code
required

Stable machine-readable reason

string
message
required
string
errors

With code invalid: every problem with the request, by field (message is the first)

Array<object>
object
path
required

Dotted path inside the item, e.g. attributes.price.amountMinor

string
message
required
string

Example

{
"statusCode": 403,
"code": "forbidden",
"message": "You do not have permission to do that.",
"errors": [
{
"message": "Enter the make"
}
]
}

The organisation is on the Free plan (code upgrade_required)

Media typeapplication/json
object
statusCode
required
number
code
required

Stable machine-readable reason

string
message
required
string
feature
required

The feature that needs Pro

string
nullable
Allowed values: extraSeats connections aiAssistant aiReplies rules fullReports api inboxes bulkMessages videoMessages
upgradePath
required

Where to upgrade or pay, in the web app

string

Example

{
"statusCode": 402,
"code": "upgrade_required",
"message": "Connections are part of Pro. Upgrade to connect texts, calls and more.",
"feature": "extraSeats",
"upgradePath": "/settings/billing"
}

The key does not have the scope (or the person the permission)

Media typeapplication/json
object
statusCode
required
number
code
required

Stable machine-readable reason

string
message
required
string
errors

With code invalid: every problem with the request, by field (message is the first)

Array<object>
object
path
required

Dotted path inside the item, e.g. attributes.price.amountMinor

string
message
required
string

Example

{
"statusCode": 403,
"code": "forbidden",
"message": "You do not have permission to do that.",
"errors": [
{
"message": "Enter the make"
}
]
}

Rate limit reached

Media typeapplication/json
object
statusCode
required
number
code
required

Stable machine-readable reason

string
message
required
string
retryAfter
required

Seconds until another request will be accepted

number

Example

{
"statusCode": 429,
"code": "rate_limited",
"message": "Too many requests. Each key can make 120 requests a minute; try again in 12 seconds.",
"retryAfter": 12
}