Send a typing indicator in the v3 JavaScript SDK
APPLIES TO: SDK v3
Users expect a timely response to their messages. If your bot performs some long-running task like calling a server or executing a query without giving the user some indication that the bot heard them, the user could get impatient and send additional messages or just assume the bot is broken. Many channels support the sending of a typing indication to show the user that the message was received and is being processed.
The following example demonstrates how to send a typing indication using session.sendTyping(). You can test this with the Bot Framework Emulator.
// Create bot and default message handler
var bot = new builder.UniversalBot(connector, function (session) {
session.sendTyping();
setTimeout(function () {
session.send("Hello there...");
}, 3000);
});
Typing indicators are also useful when inserting a message delay to prevent messages that contain images from being sent out of order.
To learn more, see How to send a rich card.