لوكلاء AI: ملف markdown لهذه الصفحة — /docs-content-en/calls/log/chat.md فهرس التوثيق — /llms.txt
مقالات التوثيق متاحة حاليًا باللغة الإنجليزية فقط.
Chat with a user
GET /v1/calls/log/chat
Returns the ID of the key owner's private chat with an employee. If the chat does not exist yet, the call creates it.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
ParameteruserId (query) |
Typeinteger | Requiredyes | DescriptionEmployee ID. List: GET /v1/users. In the call journal, take the callData.userId field from the call journal list |
Examples
curl — personal key
curl -X GET "https://vibecode.bitrix24.com/v1/calls/log/chat?userId=77" \
-H "X-Api-Key: YOUR_API_KEY"
curl — OAuth application
curl -X GET "https://vibecode.bitrix24.com/v1/calls/log/chat?userId=77" \
-H "X-Api-Key: YOUR_APP_KEY" \
-H "Authorization: Bearer USER_SESSION_TOKEN"
JavaScript — personal key
const response = await fetch('https://vibecode.bitrix24.com/v1/calls/log/chat?userId=77', {
headers: { 'X-Api-Key': 'YOUR_API_KEY' },
})
const { success, data, error } = await response.json()
console.log(success ? data.chatId : error.code)
JavaScript — OAuth application
const response = await fetch('https://vibecode.bitrix24.com/v1/calls/log/chat?userId=77', {
headers: {
'X-Api-Key': 'YOUR_APP_KEY',
'Authorization': 'Bearer USER_SESSION_TOKEN',
},
})
const { success, data, error } = await response.json()
console.log(success ? data.chatId : error.code)
Response fields
| Field | Type | Description |
|---|---|---|
Fieldsuccess |
Typeboolean | Descriptiontrue on success |
Fielddata.chatId |
Typeinteger | DescriptionID of the private chat with the employee |
Response example
{
"success": true,
"data": {
"chatId": 253
}
}
Error response example
400 — userId is missing or not a positive integer:
{
"success": false,
"error": {
"code": "INVALID_PARAMS",
"message": "userId must be a positive integer"
}
}
Errors
| HTTP | Code | Description |
|---|---|---|
| HTTP400 | CodeINVALID_PARAMS |
DescriptionuserId is missing or not a positive integer |
| HTTP422 | CodeBITRIX_ERROR |
DescriptionBitrix24 did not return a chat: Bitrix24 did not return a chat |
| HTTP403 | CodeWRITE_BLOCKED_READONLY_KEY |
DescriptionThe key is read-only — see access rights |
| HTTP403 | CodeSCOPE_DENIED |
DescriptionThe key lacks the call scope |
| HTTP403 | CodeBITRIX_ACCESS_DENIED |
DescriptionBitrix24 denied access |
| HTTP401 | CodeTOKEN_MISSING |
DescriptionThe key has no Bitrix24 tokens configured |
| HTTP429 | CodeRATE_LIMITED |
DescriptionThe Bitrix24 request limit is exceeded |
| HTTP502 | CodeBITRIX_UNAVAILABLE |
DescriptionBitrix24 is unavailable |
| HTTP503 | CodeBITRIX_TIMEOUT |
DescriptionBitrix24 did not respond in time |
The full list of common API errors — Errors.
Known specifics
GET requires a key with write access. The call can create a chat, so a read-only key gets 403 WRITE_BLOCKED_READONLY_KEY before Bitrix24 is called, even though the method is GET.