Feel connected

To achieve trust and flexibility and give the clients and users the feeling of life-like, in-person interactions, you can add features to support both users and clients, such as providing information if the client or the user is online or typing a message to make the conversation more alive and save everyone’s time. You can also offer to change the status of messages once they are delivered or read or if an error occurs when sending the message. You can provide a way to indicate the status when other parties in a conversation are typing a letter to the user in the chat window.

In this page you will learn about

  1. Online
  2. Typing
  3. Message delivery status

Online

A massive benefit of using messengers to connect users with their clients is asynchronous communication allowing sales managers to assist more than one customer at a time. Still, it is always better if the chat is instant and both the client and the user are online simultaneously to increase the engagement rate. That’s why providing the “online” presence information is a good practice for both to provide the best service.Our API doesn’t provide a method for this information. Still, you can accomplish the connection using WebSocket, webhooks, REST API, or any other method supported by the chat service being integrated. After connecting, you can get the client status or set the user status using the UI/UX part to show an online mark beside the client’s name or somewhere in the interface.in

From the Kommo interface, you can send the information that the user is online if they are in a specific chat or performing operations in the interface.

To avoid swamping the connection with a lot of information, you might transfer the client presence information once the user is in their chat.

Typing

You can forward indicators from the chat service when the client is entering text in the conversation by requesting it from the chat service and then sending a request to Kommo using the typing method from our Chat API to show it on the Kommo interface.

In the conversation, information indicating that the client is typing will appear in the interface to let the user know that the client is typing a message.

The chat service will send a start typing message when the client is writing something in the messenger. Integrators can transfer the typing information to Kommo to be displayed in the interface using the method  POST https://amojo.kommo.com/v2/origin/custom/{scope_id}/typing. This method shows the typing info for 5 seconds.

Example of the body sent to Kommo online chat

{
   "conversation_id": "62ef74a4-80c5-403d-93d9-bada6302810f",
   "sender": {
       "id": "209beccc-4f66-46ff-b06f-d245fca1af0a"
   }
}

If the user erases the text, the chat service sends an end typing message, and the typing indicator should be removed, which tells the user that the client stopped entering text and is no longer preparing to send a text message. No more typing information should be sent to Kommo.

Likewise, Kommo also provides special webhooks when a user is typing a message in a conversation in the Kommo interface. You can transfer this information to the chat service to show the client that the user is typing. Such a webhook is sent once every 5 seconds after the user starts typing a message in the Kommo interface. It includes the account id from which the user is typing, who this user is, in which conversation that is happening, and with which client, along with the time of writing and the typing information’s expiration time.

{
   "account_id": "52fd2a28-d2eb-4bd8-b862-b57934927b38",
   "time": 1670585310,
   "action": {
       "typing": {
           "user": {
               "id": "b0bc49f0-ec21-4463-965f-1fe1d4cd5b89"
           },
           "conversation": {
               "id": "30477717-9f3c-4d3f-8101-60327e14dc48",
               "client_id": "62ef74a4-80c5-403d-93d9-bada6302810f"
           },
           "expired_at": 1670585315
       }
   }
}

Integrators can use these webhooks to send messages of the types start and end typing, so the client can also see the typing indicator and the experience is consistent.

Message delivery status

To help each part of the conversation understand the messages flow and status you can change the statuses of the messages once they are delivered, read, or something wrong got the message across.

You can provide the changes for both user and client messages. For messages sent from the Kommo user, you can send a request to the chat service to get the status of the message, then update the delivery status in Kommo online chat.
While for messages sent from the client, you can, for example, suggest changing the message’s status from delivered to read once the user in the Kommo interface opens the conversation with the client and sends this information to the chat service using its method to show the client the new status.

Errors

As mentioned in the delivery status, you can mark a message with an error message describing the issue. Some errors are automatically reported, and you can add others according to the situation you want to describe.status error

Error Code When should the code be sent?
901 The user has deleted the message
902 Integration disabled on channel side
903 Internal server error
904 Unable to create a conversation (For example, the user is not registered in the chat service)
905 Any other, along with this error code, you must send the error text

Next, we discuss managing profiles for users and clients.