لوكلاء AI: ملف markdown لهذه الصفحة — /docs-content-en/openlines/crm.md فهرس التوثيق — /llms.txt
مقالات التوثيق متاحة حاليًا باللغة الإنجليزية فقط.
CRM chat actions
Actions on an Open Channels dialog linked to a lead, deal, company or contact: add an employee to the chat or remove one, write to the client, create a lead from an inquiry.
Bitrix24 API: imopenlines.crm.*
Scope: imopenlines
Add an employee to a CRM chat
POST /v1/openlines/crm/chats/users
Adds an employee to an Open Channels chat linked to a lead, deal, contact or company, so a colleague can join the conversation about the CRM card.
Request fields (body)
| Field | Type | Required | Description |
|---|---|---|---|
FieldcrmEntityType |
Typestring | Requiredyes | DescriptionCRM object type: lead, deal, company, contact. Case-insensitive |
FieldcrmEntityId |
Typenumber | Requiredyes | DescriptionCRM object ID, a positive integer. List: GET /v1/leads, GET /v1/deals, GET /v1/companies, GET /v1/contacts |
FielduserId |
Typenumber | Requiredyes | DescriptionID of the employee to add to the chat. List: GET /v1/users |
FieldchatId |
Typenumber | Requiredno | DescriptionID of an Open Channels chat of this CRM object. List: GET /v1/openlines/crm/chats with activeOnly=false. If omitted, the object's last chat is used |
Examples
curl — personal key
curl -X POST "https://vibecode.bitrix24.com/v1/openlines/crm/chats/users" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"crmEntityType": "deal", "crmEntityId": 42, "userId": 7, "chatId": 123}'
curl — OAuth application
curl -X POST "https://vibecode.bitrix24.com/v1/openlines/crm/chats/users" \
-H "X-Api-Key: YOUR_APP_KEY" \
-H "Authorization: Bearer USER_SESSION_TOKEN" \
-H "Content-Type: application/json" \
-d '{"crmEntityType": "deal", "crmEntityId": 42, "userId": 7, "chatId": 123}'
JavaScript — personal key
const res = await fetch('https://vibecode.bitrix24.com/v1/openlines/crm/chats/users', {
method: 'POST',
headers: {
'X-Api-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
crmEntityType: 'deal',
crmEntityId: 42,
userId: 7,
chatId: 123,
}),
})
const { success, data } = await res.json()
console.log('Chat:', data.chatId)
JavaScript — OAuth application
const res = await fetch('https://vibecode.bitrix24.com/v1/openlines/crm/chats/users', {
method: 'POST',
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
'Content-Type': 'application/json',
},
body: JSON.stringify({
crmEntityType: 'deal',
crmEntityId: 42,
userId: 7,
chatId: 123,
}),
})
const { success, data } = await res.json()
Response fields
| Field | Type | Description |
|---|---|---|
Fieldsuccess |
Typeboolean | Descriptiontrue when the employee is added |
Fielddata.chatId |
Typenumber | DescriptionID of the chat the employee was added to. If chatId is omitted, this is the CRM object's last chat |
Fielddata.userId |
Typenumber | DescriptionID of the added employee |
Fielddata.added |
Typeboolean | DescriptionAlways true |
Response example
{
"success": true,
"data": {
"chatId": 123,
"userId": 7,
"added": true
}
}
Error response example
404 — the CRM object has no chat with the given chatId:
{
"success": false,
"error": {
"code": "ENTITY_NOT_FOUND",
"message": "CRM chat not found"
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| HTTP400 | CodeINVALID_PARAMS |
DescriptionThe body is not a JSON object, crmEntityType is missing or not in the list, crmEntityId or userId is missing or not a positive integer |
| HTTP400 | CodeINVALID_JSON_BODY |
DescriptionThe request body cannot be parsed as JSON |
| HTTP400 | CodeINVALID_CHAT_ID |
DescriptionchatId is passed but is not a positive integer |
| HTTP404 | CodeENTITY_NOT_FOUND |
DescriptionMessage CRM chat not found: the CRM object has no Open Channels chats, including finished ones, or chatId is not one of them. The check runs before the write, so chat membership does not change |
| HTTP404 | CodeENTITY_NOT_FOUND |
DescriptionMessage Record not found: Bitrix24 did not find the chat when adding the employee |
| HTTP422 | CodeBITRIX_ERROR |
Descriptionerror.b24Code equals CHAT_NOT_IN_CRM: Bitrix24 did not confirm that the chat is linked to the CRM object |
| HTTP422 | CodeBITRIX_ERROR |
DescriptionBitrix24 rejected the request for another reason. The text is in message |
| HTTP403 | CodeBITRIX_ACCESS_DENIED |
DescriptionBitrix24 denied the key owner due to insufficient permissions |
| HTTP403 | CodeSCOPE_DENIED |
DescriptionThe key does not have the imopenlines scope |
| HTTP403 | CodeWRITE_BLOCKED_READONLY_KEY |
DescriptionThe key is read-only |
| HTTP401 | CodeMISSING_API_KEY |
DescriptionThe X-Api-Key header was not passed |
| HTTP401 | CodeINVALID_API_KEY |
DescriptionThe key is not recognized |
| HTTP401 | CodeTOKEN_MISSING |
DescriptionA personal key has no access to the Bitrix24 portal, or an application key was sent without a session token in Authorization |
| HTTP429 | CodeRATE_LIMITED |
DescriptionThe limit of 120 requests per minute per portal is exceeded. The limit is divided across platform replicas, so the code may arrive before the 120th request. The effective value for the key is in the x-ratelimit-limit header, the remaining quota in x-ratelimit-remaining |
| HTTP429 | CodeRATE_LIMITED |
DescriptionBitrix24 rejected the call under its request rate limit for the portal. The response carries a Retry-After header |
| HTTP502 | CodeOPENLINE_OPERATOR_FAILED |
DescriptionBitrix24 returned an unexpected write result: not a chat ID, or a chat other than the passed chatId |
| HTTP502 | CodeOPENLINE_OPERATOR_FAILED |
DescriptionThe card's chat list arrived in an unexpected shape. The check runs before the write, so chat membership does not change |
| HTTP502 | CodeBITRIX_UNAVAILABLE |
DescriptionBitrix24 is unavailable |
| HTTP503 | CodeBITRIX_TIMEOUT |
DescriptionBitrix24 did not respond in time, so the result is unknown. Check the chat membership before retrying |
Full list of common API errors — Errors.