readyDocs Open the appOpen the app

Inbox categories, translation and auto-reply

#List inbox categories

Returns the categories your inbox sorts conversations into. Everyone on your account shares one list, and so do your sub-accounts. A white label sub-account keeps its own.

Returns
dataobject[]
The categories in the order the inbox shows them. Each has an id (like cat_3f9a1c2b7d10), a name and usually a color. [] when you have none.
Errors
HTTPCodeWhen
503ACCOUNT_UNAVAILABLEWe couldn’t tell which account’s list to read. Try again. The list can also fail to load with a 503 and no code; try that again too.

#Save inbox categories

Replaces your account’s whole category list with the one you send. A category you leave out is deleted, and every conversation in it goes back to no category. The change shows for everyone on your account. Needs the send_sms permission and a live key.

Parameters

categoriesobject[]Required
The full list, at most 50. Each entry has a name (text, up to 60 characters) and may have a color (a hex color like #2563EB or a CSS color word). Keep the id of a category you already have; an entry with an unknown id, or none, gets a new id unless a stored category has the same name.
basestring[]
The ids of the list you last read. If your save would delete a category that isn’t in base (someone added it since), nothing is saved and you get a 409.
base_listobject[]
The entries you last read, each with id, name and color. If someone renamed or recolored one of them since, nothing is saved and you get a 409.
Returns
dataobject[]
The saved list, with the id of every category, including ones you just created.
Errors
HTTPCodeWhen
400invalid_fieldcategories is missing or not a list, or base or base_list isn’t a list.
400INVALID_CATEGORIESMore than 50 categories, an entry that isn’t an object, or a name that isn’t text or is over 60 characters.
400INVALID_CATEGORY_COLORA color that isn’t a hex color or a color word.
409CATEGORIES_CHANGEDThe list changed since you read it (see base and base_list). Nothing was saved. Read the list again and retry.
429rate_limitedToo many requests this minute for your account.
500(none)We couldn’t confirm the save. Read the list before you try again.
503ACCOUNT_UNAVAILABLEWe couldn’t tell which account’s list to save. Nothing changed; try again.

#Move a conversation to a category

Puts a conversation in one of your inbox categories, or takes it out with null. A conversation is in one category at most. Its tags don’t change. Needs the send_sms permission and a live key.

Parameters

idinteger, pathRequired
The conversation id.
category_idstring | nullRequired
A category id from your list, or null (or "") to take the conversation out of its category. Leaving the field out is an error, not a clear.
Returns
category_idstring | null
The conversation’s category now, at the top level.
Errors
HTTPCodeWhen
400category_not_foundThe id isn’t in your category list, or category_id is missing. Nothing changed.
400invalid_fieldThe conversation id isn’t a whole number, or category_id is a list or object.
404CONVERSATION_NOT_FOUNDNo such conversation on your account, or it has no contact.
500CONVERSATION_UPDATE_FAILEDThe change wasn’t saved. Nothing changed; try again in a minute.

#Translate a message to English

Detects the language of a message you received and translates it to English. Pass message_id and the translation is saved on the message, so asking again is instant. Or pass text to translate any text without saving it. There is no charge. Needs the send_sms permission and a live key.

Parameters

message_idinteger
An inbound message on your account. Outbound messages can’t be translated. When you send it, text is ignored.
textstring
Text to translate, used when there’s no message_id. Only the first 2,000 characters are translated.
Returns
data.source_langstring | null
The detected language in English, like Spanish. English when no translation was needed.
data.is_englishboolean
true when the message is already in English.
data.translationstring | null
The English text. "" when the message is already English.
data.cachedboolean
true when the translation came from the one saved on the message. Left out otherwise.
data.unavailableboolean
true when translation isn’t working right now. The answer is still a 200, with translation: null. Show the original and try again later.
Errors
HTTPCodeWhen
400NO_TEXT_TO_TRANSLATENo message_id and no text, or the message or text is empty.
400TRANSLATE_OUTBOUNDThe message is one you sent. Only received messages can be translated.
400invalid_fieldtext is a list or object.
403CONVERSATION_NOT_ASSIGNEDThe key’s user only sees their own contacts, and this message’s contact is assigned to a teammate.
403CONVERSATION_NOT_ALLOCATEDThe key’s user is limited to some of your numbers, and this message is on another one.
404MESSAGE_NOT_FOUNDNo such message on your account.
429TRANSLATE_DAILY_LIMITThe key’s user reached today’s translation limit. It resets at midnight UTC; resets_at says when, if present.
429rate_limitedToo many AI requests from your account in the last 15 minutes.
503TRANSLATE_READ_FAILEDWe couldn’t load the message. Try again in a moment.

#Get the auto-reply

The text your account sends back when a contact texts you outside business hours, with the hours and time zone it uses. The setting belongs to the account, so every team member reads the same one. If you never saved it, you get the defaults with enabled: false.

Returns
data.enabledboolean
Whether the auto-reply is on.
data.messagestring
The text it sends.
data.scheduleobject
Your business hours, one key per day (monday to sunday). Each day has enabled, start and end as 24-hour HH:MM. The default is 09:00 to 17:00 on weekdays, with the weekend off.
data.timezonestring
The IANA time zone the hours are in, like America/Chicago.

#Update the auto-reply

Turns the auto-reply on or off, or changes its text, hours or time zone. Send only what you change: a field you leave out keeps its saved value. On a first save, a field you leave out takes the value Get the auto-reply shows. Needs the send_sms permission.

Parameters

enabledboolean
On or off.
messagestring
The text to send, up to 480 characters. It can’t be blank.
scheduleobject
Your business hours, keyed by day (monday to sunday). Each day is { "enabled": true, "start": "09:00", "end": "17:00" }, with times as 24-hour HH:MM. The auto-reply goes out outside these hours. It replaces the saved hours.
timezonestring
An IANA time zone, like America/Chicago. A first save without one uses your account’s time zone.
Returns

{ "success": true }. Read the saved values back with Get the auto-reply.

Errors
HTTPCodeWhen
400invalid_fieldA field has the wrong type, or timezone is over 64 characters.
400no codeAn empty body, a blank message, a message over 480 characters, a day in schedule that isn’t in the right shape, or a time zone we don’t know. Nothing was saved.