I want to detect a typing status of my telegra bot user

updateUserTyping, messages.setTyping, and messages.setEncryptedTyping are the avaialble methods in telegram TLD library but these are all only avaible to Telegram API not for Telegram bot API.Is there any way to add similar feature in bot api also?

I also used this custom code trick but it did not worked,

async function pollMessages() {
try {
const response = await fetch(${API_URL}getUpdates?offset=${lastUpdateId + 1});
const data = await response.json();
if (data.ok && data.result.length > 0) {
for (const userMessage of data.result) {
if (userMessage.update_id > lastUpdateId) {
const message = userMessage.message;
const messageText = message.text;
const photoArray = message.photo;
const documentArray = message.document;
const videoArray = message.video;

                if (message.reply_to_message) {
                    const originalMessageText = message.reply_to_message.text;
                    if (originalMessageText) {
                        const identityKeyStart = originalMessageText.indexOf('(');
                        const identityKeyEnd = originalMessageText.indexOf(')');
                        const identityKey12 = originalMessageText.substring(identityKeyStart, identityKeyEnd + 1).trim();
                        const datePattern = /w+-d{2}-d{2} @ d{1,2}.d{2}.d{2} (AM|PM)/;

                        if (identityKey === identityKey12 && datePattern.test(identityKey12)) {
                            messageReceivedFromTeam = true;

                            // Handle different types of media
                            if (photoArray) {
                                const fileId = photoArray[photoArray.length - 1].file_id;
                                const fileResponse = await fetch(`${API_URL}getFile?file_id=${fileId}`);
                                const fileData = await fileResponse.json();
                                if (fileData.ok) {
                                    const filePath = fileData.result.file_path;
                                    const fileUrl = `https://api.telegram.org/file/bot${API_TOKEN}/${filePath}`;
                                    displayMessage(fileUrl, 'other', true);
                                }
                            } else if (videoArray) {
                                const fileId = videoArray.file_id;
                                const fileResponse = await fetch(`${API_URL}getFile?file_id=${fileId}`);
                                const fileData = await fileResponse.json();
                                if (fileData.ok) {
                                    const filePath = fileData.result.file_path;
                                    const fileUrl = `https://api.telegram.org/file/bot${API_TOKEN}/${filePath}`;
                                    displayMessage(fileUrl, 'other', false, true);
                                }
                            } else if (documentArray) {
                                const fileId = documentArray.file_id;
                                const fileResponse = await fetch(`${API_URL}getFile?file_id=${fileId}`);
                                const fileData = await fileResponse.json();
                                if (fileData.ok) {
                                    const filePath = fileData.result.file_path;
                                    const fileUrl = `https://api.telegram.org/file/bot${API_TOKEN}/${filePath}`;
                                    displayMessage(fileUrl, 'other', false, false, true, documentArray.file_name);
                                }
                            } else {
                                displayMessage(messageText, 'other');
                            }

                            lastUpdateId = userMessage.update_id;
                            hideTypingIndicator();  // Hide the typing indicator after receiving a message
                        }
                    }
                }
            }
        }
    }
} catch (error) {
    console.error('Error polling messages:', error);
}

}