getUserId

Gets the current user's unique identifier.

Returns

String - The current user's ID.

Example

<div id="chat"></div>
<script>
let messagesData = [
    {
        id: 1,
        text: "Welcome! Your user ID will be displayed in the console.",
        authorId: "admin",
        authorName: "Admin",
        authorImageUrl: "https://demos.telerik.com/kendo-ui/content/web/Customers/RICSU.jpg",
        timestamp: new Date(2026, 0, 1, 9, 0)
    },
    {
        id: 2,
        text: "Thanks! I can see my user ID in the console.",
        authorId: "currentUser",
        authorName: "Current User",
        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: "currentUser",
    dataSource: messagesData
}).data("kendoChat");

// Get and display the current user's ID
let userId = chat.getUserId();
console.log("Current user ID:", userId);
</script>
In this article
getUserId
Not finding the help you need?
Contact Support