no-translate

Mark chat as read

Mark chats as read using the API
Napisany przez Konstantine
Zaktualizowano 3 dni temu

Chats can be marked as read using the API. 

➡️ Request

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

Read more about the authorization header here.

You need to specify chat id (required) and read (required) in the body of your PUT request.

{
    "id": 5208,
    "read": true
}

id is the identifier for the chat as given by HelpCrunch.
read
is the flag to mark a chat as read

✅ Successful Response

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

{
  "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,
  "readByAgent": true,
  "readByCustomer": true.
  "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"
  }
}

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.

401 Unauthorized

{
  "errors": [
    {
      "code": "invalid_request",
      "message": "Invalid request"
    },
    {
      "code": "unauthorized",
      "message": "Unauthorized"
    }
  ]
}

404 Not Found

{
    "errors": [
        {
            "code": "chat_not_found",
            "message": "Chat not found"
        }
    ]
}

429 Too Many Requests

{
  "errors": [
    {
      "code": "invalid_request",
      "message": "Invalid request"
    },
    {
      "code": "too_many_requests",
      "message": "Too many requests"
    }
  ]
}

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

👩‍💻 Happy Coding! 👨‍💻

Czy odpowiedzieliśmy na Twoje pytanie?