Update chat assignee

Change agent the chat is assigned to
Written by Konstantine
Updated 7 months ago

You can change the assignee for any chat by its id. Assignee is the agent the chat is assigned to.

➡️ Request

URL https://api.helpcrunch.com/v1/chats/assignee
Method PUT
Headers Authorization: Bearer <your_api_key>

Read more about authorization header here.

You should specify chat id (required) and assignee id (required) in the body of your PUT request:

{
    "id": 5214000,
    "assignee": 4188
}

How to get agent/assignee id


✅ Successful Response

If your request has succeeded, you'll get a 200 OK success status code together with the following response body.

{
    "id": 5214000,
    "closedBy": null,
    "lastCustomerMessageAt": 1592332354,
    "status": "pending",
    "closedAt": null,
    "rating": null,
    "createdAt": 1592332351,
    "lastMessageAt": 1592332354,
    "snoozedUntil": null,
    "lastMessageText": "HelpCrunch is the best! Thank you guys.",
    "lastMessageId": 8579581,
    "lastCommunicatedAgentId": null,
    "agents": [],
    "customer": {
        "id": 8740457,
        "name": "Noah",
        "email": "Noah@example.com",
        "userId": null
    },
    "assignee": {
        "id": 4188,
        "name": "John Doe",
        "email": "john@company.com",
        "role": "admin"
    },
    "department": null
}

You can get details on every Chat Object field in the Chat model article.

🛑 Error Responses

You may get one of the following error status codes and responses. More info on the errors is available here.

400 Bad Request

{
    "errors": [
        {
            "code": "invalid_chat_value",
            "message": "assignee 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"
        }
    ]
}

If you have any questions regarding the REST API, feel free to chat us any time.

👩‍💻 Happy Coding! 👨‍💻

Did this answer your question?