Ви можете змінити статус будь-якого чату за допомогою його ID.
➡️ Запит
URL | https://api.helpcrunch.com/v1/chats/status |
Метод | PUT |
Headers | Authorization: Bearer <your_api_key> |
Ви повинні вказати ID чату (обов’язково) і статус чату (обов’язково) у тілі запиту PUT.
{
"id": 5215752,
"status": "open"
}
Назва статусу може бути:
- новий - new
- відкритий - open
- в очікуванні - pending
- на паузі - on-hold
- без спілкування - no communication
- закритий - closed.
✅ Відповідь на успішний запит
Якщо ваш запит пройшов успішно, ви отримаєте код статусу успішного виконання 200 OK разом із наведеним нижче тілом відповіді.
{
"id": 5215752,
"closedBy": null,
"lastCustomerMessageAt": null,
"status": "opened",
"closedAt": null,
"rating": null,
"createdAt": 1597758468,
"lastMessageAt": 1597762389,
"snoozedUntil": null,
"lastMessageText": "Ok, testing the status update via API",
"lastMessageId": 9577621,
"lastCommunicatedAgentId": 4188,
"agents": [],
"customer": {
"id": 8738438,
"name": "John Doe",
"email": "john@example.com",
"userId": "myusers_4188"
},
"assignee": null,
"department": {
"id": 233048,
"name": "Test Department"
}
}
🛑 Відповіді з помилками
Ви можете отримати один із наведених нижче кодів статусу помилки та відповіді.
400 Bad Request
{
"errors": [
{
"code": "invalid_chat_value",
"message": "status value is invalid"
}
]
}
401 Unauthorized
{
"errors": [
{
"code": "invalid_token",
"message": "Invalid token"
}
]
}
404 Not Found
{
"errors": [
{
"code": "chat_not_found",
"message": "Chat is missing"
}
]
}
429 Too Many Requests
{
"errors": [
{
"code": "too_many_requests",
"message": "You have exceeded your requests limit"
}
]
}