getMessageByUid
Gets a message by its unique identifier (UID).
Parameters
uid String
The message UID.
Returns
Object
- The message object or null if not found.
Example
<div id="chat"></div>
<script>
let messagesData = [
{
id: 1,
text: "This message has a specific UID that can be used to retrieve it later.",
authorId: "user1",
authorName: "John Doe",
authorImageUrl: "https://demos.telerik.com/kendo-ui/content/web/Customers/RICSU.jpg",
timestamp: new Date(2026, 0, 1, 9, 0)
},
{
id: 2,
text: "You can use getMessageByUid to find messages by their unique identifier.",
authorId: "user2",
authorName: "Jane Smith",
authorImageUrl: "https://demos.telerik.com/kendo-ui/content/web/Customers/LONEP.jpg",
timestamp: new Date(2026, 0, 1, 9, 5)
}
];
let chat = $("#chat").kendoChat({
authorId: "user1",
dataSource: messagesData
}).data("kendoChat");
// Example: Try to get a message by its UID (after the component is initialized)
setTimeout(function() {
// In a real scenario, you would have the actual UID
console.log("Attempting to get message by UID...");
let message = chat.getMessageByUid("message-uid-123");
if (message) {
console.log("Found message:", message.text);
} else {
console.log("Message with UID 'message-uid-123' not found");
}
}, 1000);
</script>
In this article