Ви можете змінити відповідального за чат за його ID. Відповідальний — це оператор, на якого призначено чат.
➡️ Запит
| URL | https://api.helpcrunch.com/v1/chats/assignee | 
| Метод | PUT | 
| Headers | Authorization: Bearer <your_api_key> | 
Ви повинні вказати ID чату (обов’язково) та ID відповідального (обов’язково) у тілі запиту PUT.
{
  "id": 542335,
  "assignee": 542335
}
Як отримати ID усіх учасників команди
Прибрати відповідального за чат
Щоб відв'язати чат від агента, ви можете зазначити значення assignee на null в тілі запиту. Це видалить відповідального агента з чату, залишивши чат без призначення. Приклад:
{
  "id": 542335,
  "assignee": null
}
✅ Відповідь на успішний запит
Якщо ваш запит пройшов успішно, ви отримаєте код статусу успішного виконання 200 OK разом із наведеним нижче тілом відповіді.
{
  "id": 542335,
  "closedBy": "string",
  "lastCustomerMessageAt": "1603885746",
  "status": "new",
  "closedAt": "1603885746",
  "rating": "perfect",
  "createdAt": "1603885746",
  "lastMessageAt": "1603885746",
  "createdWith": "string",
  "snoozedUntil": "1603885746",
  "lastMessageText": "string",
  "lastMessageId": 542335,
  "applicationId": 542335,
  "lastCommunicatedAgentId": 542335,
  "agents": [
    {
      "id": 542335,
      "name": "string",
      "email": "string",
      "role": "string"
    }
  ],
  "customer": {
    "id": 542335,
    "name": "string",
    "email": "string",
    "userId": "string"
  },
  "assignee": {
    "id": 542335,
    "name": "string",
    "email": "string",
    "role": "string"
  },
  "department": {
    "id": 542335,
    "name": "string"
  }
}
Ви можете отримати деталі по кожному полю обʼєкту чату у статті Модель даних чату.
🛑 Відповіді з помилками
Ви можете отримати один із наведених нижче кодів статусу помилки та відповіді. Детальніше про коди помилок ви можете прочитати за посиланням.
400 Bad Request
{
  "errors": [
    {
      "code": "invalid_request",
      "message": "Invalid request"
    },
    {
      "code": "customer",
      "message": "This value should be of type numeric."
    },
    {
      "code": "filter[0].field",
      "message": "This value should not be blank."
    }
  ]
}
401 Unauthorized
{
  "errors": [
    {
      "code": "invalid_request",
      "message": "Invalid request"
    },
    {
      "code": "unauthorized",
      "message": "Unauthorized"
    }
  ]
}
404 Not Found
{
    "errors": [
        {
            "code": "not_fount",
            "message": "Chat for ID "%s" was not found"
        }
    ]
}
429 Too Many Requests
{
  "errors": [
    {
      "code": "invalid_request",
      "message": "Invalid request"
    },
    {
      "code": "too_many_requests",
      "message": "Too many requests"
    }
  ]
}