Hello 👋🏼 How can we help?

Update chat status

Change the status of any chat
Written by Konstantine
Updated 9 months ago

You can change the status of any chat by its id.

➡️ Request

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

Read more about authorization header here.

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

{
    "id": 5215752,
    "status": "opened"
}

Status name can be "new", "opened", "pending", "on-hold", "no communication" or "closed".


✅ Successful Response

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

{
    "id": 5215752,
    "closedBy": null,
    "lastCustomerMessageAt": null,
    "status": "opened",
    "notes": null,
    "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"
    }
}

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": "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"
        }
    ]
}

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

👩‍💻 Happy Coding! 👨‍💻

Did this answer your question?