renderAttachments

Renders an attachment inside the Chat. The attachments are rendered through a predefined or custom template that is registered with the Chat.

Parameters

options Object

The configuration options for the attachment.

options.attachments Object

An array of attachment objects.

options.attachments.content Object

The attachment properties that are passed to the template which will be rendered inside the Chat bubble.

options.attachments.contentType String

The attachment type. Used to determine which template is used when rendering the attachment inside the Chat.

options.attachmentLayout String

The layout that will be applied for rendering the attachments.

The supported values are:

  • list
  • carousel
sender Object

The configuration object which contains information about the sender of the message bubble. Determines where the message will be rendered.

sender.id Object

The unique identifier which is used to distinguish between different users in the Chat.

sender.name String

The string which represents the name of the sender and which is rendered before the message bubble.

sender.iconUrl String

The URL that is used to show the sender avatar.

Example - rendering an attachment

<div id="chat"></div>
<script>
    $("#chat").kendoChat();

    var chat = $("#chat").data("kendoChat");

    chat.renderAttachments({
        attachments: [{
            contentType: "heroCard",
            content: {
                title: "Attachment Title",
                subtitle: "Attachment Subtitle",
                text: "Sample text"
            }
        }],
        attachmentLayout: "carousel"
    }, chat.getUser());
</script>
In this article