executeAction

Fired when the user clicks an action button in an attachment card. Use this event to handle custom actions defined in attachment data.

Event Data

e.sender kendo.ui.Chat

The widget instance which fired the event.

e.action Object

The action object with title, type, and value properties describing the button that was clicked.

e.message Object

The message object that contains the attachment with the clicked action.

Example

<div id="chat"></div>
<script>
let messagesData = [
    {
        id: 1,
        text: "Here is a product card:",
        authorId: "bot",
        authorName: "Shop Bot",
        timestamp: new Date(),
        attachments: [
            {
                title: "Premium Widget",
                subtitle: "$29.99",
                actions: [
                    { title: "Buy Now", type: "call", value: "buy-widget-1" },
                    { title: "Details", type: "openUrl", value: "https://example.com" }
                ]
            }
        ]
    }
];

$("#chat").kendoChat({
    authorId: "user1",
    dataSource: messagesData,
    executeAction: function(e) {
        console.log("Action clicked:", e.action.title, e.action.value);
    }
});
</script>
In this article
executeAction
Not finding the help you need?
Contact Support