Rich messages

We in Kommo took it upon ourselves to provide a streamlined experience for users and save developers’ time by supporting sending different kinds of messages, including

  1. Rich links
  2. Templates
  3. Interactive messages
  4. Sending images and files
  5. Sending NPS
  6. Voice messages
  7. Location stream
  8. Sharing contacts

Rich links

You can reassure customers that the website they are directed to when clicking on a link is secure and owned by the business brand by previewing the content inline using rich links. They also provide beautiful visuals for better understanding.

You can provide users the ability to add a picture to a URL giving the clients the confidence to navigate outside the conversation for a better business experience. Video previews can also be added to rich links for a more immersive experience.

We don’t have a specific method to support sending messages with rich links, but you can process this by dividing the message into three parts: before the link, the link and its data (link, title, image, or video), and after the link. You can process as many links as you want, sending each part as a separate message to our online chat.

Templates

Since users have to send many messages to clients and prospects, and while personalized communication is key to building solid relationships, writing a similar message repeatedly can be time-consuming. That’s where message templates become a game-changer in the business.

Kommo provides adding message templates with dynamic fields which, when sending the template, automatically pull out the information from a Lead card, saving you a lot of time and energy. Message templates reduce the likelihood of spam sent to users on the chat service, which makes them great conversation starters to gain potential clients.

When the user sends a template using your integration, the online chat service sends a webhook to the address specified when you registered the chat channel, containing the message information that includes, in addition to the message type and text which is the template body after replacing the placeholders with their values, the template information: template id, content and a list of the template parameters keys and values.

An example of a webhook when sending a template:

{
  "account_id": "73587adf-c058-447f-8e82-bc4eaf1987a0",
  "time": 1680270708,
  "message": {
    "receiver": {
      "id": "f5f00d91-a540-4d34-9603-657d5db538a7",
      "name": "",
      "phone": "+18305803077",
      "email": "",
      "client_id": "con-1376265f-86df-4c49-a0cc-000000000001"
    },
    "sender": {
      "id": "b0bc49f0-ec21-4463-965f-1fe1d4cd5b89"
    },
    "conversation": {
      "id": "f00b084d-0ada-4378-b4b1-1dfff0248a6e",
      "client_id": "con-8e3e7640-49af-4448-a2cc-000000000001"
    },
    "timestamp": 1680270708,
    "msec_timestamp": 1680270708223,
    "message": {
      "id": "68a624c4-373a-4e3b-a741-ad570582d8dd",
      "type": "text",
      "text": "Hey Adam,\n\nWelcome to town. We invite you to visit our restaurant and to enjoy our steak and other great meals. \n\nWe have lovely atmosphere every day. I advise you to pay us a visit on the weekend; we always have live jazz music. \n\nRegards,\n\nLama Saqqour",
      "tag": "",
      "media": "",
      "thumbnail": "",
      "file_name": "",
      "file_size": 0,
      "template": {
        "id": 19380,
        "content": "Hey {{contact.name}},\n\nWelcome to town. We invite you to visit our restaurant and to enjoy our steak and other great meals. \n\nWe have lovely atmosphere every day. I advise you to pay us a visit on the weekend; we always have live jazz music. \n\nRegards,\n\n{{lead.responsible.name}}",
        "params": [
          {
            "key": "{{contact.name}}",
            "value": "Adam"
          },
          {
            "key": "{{lead.responsible.name}}",
            "value": "Lama Saqqour"
          }
        ]
      }
    }
  }
}

Integrations activated in the account have access to the templates defined in it. At the same time, some chat services impose their conditions regarding what the user can send to the clients, and for that, users can add the templates to their accounts in the chat service, or you can provide a window in your integration to do this. Then, they can copy/paste them to their Kommo account, or you can provide them the ability to export/import templates to/from the chat service to the Kommo account. Once copied/imported, all approved templates will be saved as chat templates in the Kommo account and users will be able to send them to their clients with a click.

Importing and synchronize templates

It’s very important to import pre approved templates to the Kommo account from the chat service account. Further, Kommo clients will be able to send one of the imported templates by inserting them in the chat via /.

You can provide a button to synchronize the templates in the integration settings window, and show the last state of synchronization (synchronized + date, in progress, not).

func GetTemplates(kommoAccountId kaccountId) {
    ChatClient chatclient = new ChatClient();
	credentials = chatclient.chatCredentialsRepository.GetByAccountId(kaccountId);
    return chatclient.GetTemplates(credentials.AppName, credentials.Apikey);
}

The integration should save both the ID of the template in the chat service and the ID of the template in Kommo in its database, so that when sending the imported template, the id of the template in the chat service is sent with values of the placeholders.

You also can provide a status flag for each template, with a button to synchronize each template separately.

Once a template is imported, you can show the logo of the chat service as the source of the template, clarifying the ability to use it as a trusted one.

When sending an imported template, you can depend on the webhook information as we explained above, and its stored id, to send it along with the placeholders values. This is considered best practice and we have adopted this before.

An example of the sent JSON when sending an imported template from the integration to the chat service.

{
   "id": "c6aecef6-bcb0-4fb1-8100-28c094e3bc7c",
   "params": [
       "Adam",
       "Lama Saqqour"
   ]
}

Exporting templates

You can give your users a more streamlined experience by providing an interface in your integration to write their templates in, and then send it to the chat service to perform moderation. Once they get accepted, a notification can come to the Kommo account from the chat service and the templates will be available to use.

Interactive messages

You can provide users the ability to send something richer and more interactive than just plain text to existing messaging channels. Most conversations involve plain text. However, sometimes users want to send content (images, buttons, locations, quick replies, etc.) to a client in a richer, more interactive, more interactive, and of course, more structured format.

When discussing the exchange messages use-case, we mentioned that Kommo Chat API provides sending beside the text messages, the following types: contact, file, video, picture, voice, audio, sticker, and location, and now we will discuss how to benefit from these types to send interactive messages.

Quick Reply

To enable users to get the client’s inline choice with a single tap during an ongoing conversation, Kommo account administrators can create a template or salesbot with a quick-reply list of the options. The quick reply list contains up to 13 buttons in-conversation that contain a title and optional image. Or you can provide such messages in the way that is suitable for your own chat service methods.

When sending the quick reply, it will appear for the user in the Kommo interface as a normal message with the text and image provided when creating the quick replies.

When sending the salesbot or the template with the buttons, a webhook holding the buttons and other information will be sent

{
  "account_id": "73587adf-c058-447f-8e82-bc4eaf1987a0",
  "time": 1680278873,
  "message": {
    "receiver": {
      "id": "19c8757f-06f5-454e-a0d0-0c6773931452",
      "name": "",
      "phone": "+18305803078",
      "email": "",
      "client_id": "con-1376265f-86df-4c49-a0c4-000000000000"
    },
    "sender": {
      "id": "2c24a1c7-1f1c-4c99-8f1a-bcfd5189a0e6"
    },
    "conversation": {
      "id": "49a7d271-46bf-46ce-8576-0c3653dfd5e2",
      "client_id": "con-8e3e7640-49af-4448-a2cc-000000000003"
    },
    "timestamp": 1680278873,
    "msec_timestamp": 1680278873172,
    "message": {
      "id": "4e10773a-a666-4b69-8de3-7b801f5b0329",
      "type": "text",
      "text": "Please rate us from 1 to 5",
      "markup": {
        "mode": "inline",
        "buttons": [
          [
            {
              "text": "⭐️⭐️⭐️⭐️⭐️"
            }
          ],
          [
            {
              "text": "⭐️⭐️⭐️⭐️"
            }
          ],
          [
            {
              "text": "⭐️⭐️⭐️"
            }
          ],
          [
            {
              "text": "⭐️⭐️"
            }
          ],
          [
            {
              "text": "⭐️"
            }
          ]
        ]
      },
      "tag": "",
      "media": "",
      "thumbnail": "",
      "file_name": "",
      "file_size": 0
    }
  }
}

And the client will get quick-reply buttons (For example in Kommo live chat)

The corresponding received JSON in our Live chat looks like this

{
    "uid": "ac6f0eb6-d16f-49fd-9cfd-620f30722e21",
    "method": "post",
    "payload": {
        "chat_id": "82b98532-85ba-4b60-80f2-27dc04649d04",
        "badge": 1,
        "messages": [
            {
                "message": {
                    "id": "3afbbe09-deca-4663-abd5-4cc6a3583934",
                    "is_out": false,
                    "type": "picture",
                    "text": "Please rate us",
                    "author": {
                        "id": "2c24a1c7-1f1c-4c99-8f1a-bcfd5189a0e6",
                        "name": "Salesbot",
                        "avatar": "",
                        "is_bot": true,
                        "is_admin": false
                    },
                    "media_url": "https://drive-c.kommo.com/**/rate.jpeg",
                    "file_size": 5368,
                    "chat_id": "82b98532-85ba-4b60-80f2-27dc04649d04",
                    "keyboard": {
                        "inline": [
                            {
                                "text": "⭐️⭐️⭐️⭐️⭐️",
                                "url": ""
                            },
                            {
                                "text": "⭐️⭐️⭐️⭐️",
                                "url": ""
                            },
                            {
                                "text": "⭐️⭐️⭐️",
                                "url": ""
                            },
                            {
                                "text": "⭐️⭐️",
                                "url": ""
                            },
                            {
                                "text": "⭐️",
                                "url": ""
                            }
                        ]
                    },
                    "created_at": 1679915684896,
                    "updated_at": 1679915684896
                }
            }
        ]
    }
}

If the message contains an image, the message type will be “picture”. The buttons are sent in the “keyboard” markup.

When a quick reply is tapped, the buttons will disappear and the title of the tapped button is posted to the conversation as a message.

The corresponding sent JSON from our Live chat to Kommo online chat looks like this

{
    "uid": "GPlbrOukyHM5ZGyOGxL5g",
    "method": "message",
    "payload": {
        "chat_id": "82b98532-85ba-4b60-80f2-27dc04649d04",
        "message": {
            "chat_id": "82b98532-85ba-4b60-80f2-27dc04649d04",
            "created_at": 1679916965840,
            "delivery_status": 1,
            "id": "cfe7f87d-9ba9-4065-be3c-98b08c65fc0a",
            "is_out": true,
            "text": "⭐️⭐️⭐️",
            "type": "text",
            "updated_at": 1679916965840,
        },
        "uid": "GPlbrOukyHM5ZGyOGxL5g"
    }
}

For the user the quick-reply message appears like a normal message

Sending images and files

You can send images or files by sharing a URL. Since, in this case, media files are not stored on Kommo servers, there is no limit to the file size.

"message": {
    "type": "file",
    "text": "Please find attached the offer file",
    "media" : "https://www.kommo.com/static/assets/developers/files/examples/offer.pdf",
    "file_name" : "offer"
}

And it appears on the Kommo interface like this

Sending NPS

The effectiveness of a conversation or a product can be measured by NPS (Net Promoter Score ), which is a survey questionnaire of 10 levels to get the degree of customer satisfaction about the service and to answer the ultimate question “Will they recommend the product to others/ Are they satisfied with the service”.

The responses then fall into one of three categories, detractors from one to six, passives from seven to eight, and promoters from nine to ten.

Kommo supports sending NPS to clients on advanced and enterprise plans, and it’s turned on by default. Once it’s turned on, the user can see a “send NPS” button inside a closed/ended chat.

However, you can create more complex NPS according to your users needs to help them get the client satisfaction on a continual basis. Your NPS can be characterized on attributes to give users the ability to understand the strength points of their points and where they should work more to enhance the user experience.

Voice messages

As we know, messages are better than calls when considering time and assurance, while calls are better to get the reaction and understand one thing in depth, but it takes more time. When clients call you, you spend hours of your and their time to solve an issue or get information. That’s why we suggest implementing the voice messages. This way, you provide a quick, effective, personalized way taking the advantages from both methods of communication. Kommo provides the transcript function to help users get everything written.
Kommo online chat API accepts audio messages

"message": {
    "type": "voice",
    "media" : "https://www.kommo.com/static/assets/record1.mp3",
    "file_size" : "1M"
}

Location stream

Rather than sending the address as a text message, Kommo Online chat API provides sending the address as longitude and latitude to be shown as a picture of the location on the map with a link to the preferable map application, making it more convenient to the receiver.
Kommo accepts the messages with location type by passing the longitude and the latitude in the message payload.

"message": {
    "type": "location",
    "text": "Here is our address",
    "lon" : 55.4448,
    "lat" : 37.3917
}

Contact sharing

One of the capabilities that you provide is a way to share contacts between Kommo users and clients. Kommo online chat API accepts sharing contacts by passing the contact name and number in the message

"message": {
           "type": "contact",
           "contact": {
               "name": "Sam",
               "phone": "+18305803078"
           }
       }

and it shows it in a simple wayYou can invoke scripts to change the way it’s displayed.

Last, but not least, we will discuss when the user writes first.