Hi,
With v3 of the framework a new typing activity type has been added. Does anybody have an example of how I can send this to the user when they send a message to the bot, whilst the bot is calling off to a 3rd party service to get a suitable response?
Thanks
Gary
After spending a while on this last night, as soon as I posted this I managed to get this working :)
For anybody who is interested here is the code I have used;
var connector = new ConnectorClient(new Uri(activity.ServiceUrl));
Activity isTypingReply = activity.CreateReply();
isTypingReply.Type = ActivityTypes.Typing;
await connector.Conversations.ReplyToActivityAsync(isTypingReply);
Thank you, @garypretty. Wondering, what is the way to do that in the Node.js SDK.
@Stevenic would you be kind to share your thoughts on that?
@alexsorokoletov
Node.js SDK have middleware for these purpose.
We can use it like bot.use(builder.Middleware.sendTyping())
Each time when the some data is received for bot, a typing activity will be send as a response.
After that the bot will process the message and response accordingly.
Hi @garypretty . In which part of the project is that which you shared:
var connector = new ConnectorClient(new Uri(activity.ServiceUrl));
Activity isTypingReply = activity.CreateReply();
isTypingReply.Type = ActivityTypes.Typing;
await connector.Conversations.ReplyToActivityAsync(isTypingReply);
Thank you
@alexsorokoletov
With @var23rav reference I'm able to achieve it, with this:
bot.use({
botbuilder: function (session, next) {
session.send(); // it doesn't work without this..
session.sendTyping();
next();
}
});
but, it doesn't seem to work when I omit session.send();...
Most helpful comment
@alexsorokoletov
Node.js SDK have middleware for these purpose.
We can use it like
bot.use(builder.Middleware.sendTyping())Each time when the some data is received for bot, a typing activity will be send as a response.
After that the bot will process the message and response accordingly.