botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

Reply with "Is Typing" message

Open jakobpn opened this issue 10 years ago • 11 comments

The bot I am working on will need to query a service in order to respond to the user. These requests may take several seconds. I would be awesome if the bot could reply with a "is typing" message to let the user know that the request is being worked on. The "is typing" message would go away when the bot responds with the real reply.

Can this be done with the current framework?

jakobpn avatar Apr 21 '16 18:04 jakobpn

You can send multiple messages, but I don't think many channels (e.g. text, email, etc) support having messages go away.

willportnoy avatar Apr 21 '16 22:04 willportnoy

I agree that this would be something that would work differently across channels. Do some of the channels currently supported have a way to signal "is typing"?

jakobpn avatar Apr 21 '16 22:04 jakobpn

Slack seems to support this.

From https://api.slack.com/rtm:

Clients can send a typing indicator to indicate that the user is currently writing a message to send to a channel:

{
    "id": 1,
    "type": "typing",
    "channel": "C024BE91L"
}

This can be sent on every key press in the chat input unless one has been sent in the last three seconds. Unless there is an error the server will not send a reply, but it will send a "user_typing" event to all team members in the channel.

anoopnair avatar Apr 22 '16 18:04 anoopnair

Telegram also support "typing" message.

wiltodelta avatar Apr 22 '16 20:04 wiltodelta

Hi, do you think it is possible to implement this using the custom channel messages?

PatrickKalkman avatar Jun 05 '16 08:06 PatrickKalkman

I've done a quick test (replying with ChannelData with type = typing) and it didn't work.

srogovtsev avatar Jun 14 '16 14:06 srogovtsev

I guess the Bot connector is filtering the message if the type is not known and does not send it to the Channel.

PatrickKalkman avatar Jun 14 '16 14:06 PatrickKalkman

I am using the latest version of Bot Builder and Emulator. This Typing feature is not working properly. Is that am doing something wrong here var connector = new ConnectorClient(new Uri(activity.ServiceUrl)); toReply.Type = ActivityTypes.Typing; await connector.Conversations.SendToConversationAsync(toReply);

I can see Typing pop up before my actual reply. But also it shows a empty message to the Chat window

b4usat avatar Jul 15 '16 14:07 b4usat

I explicitly set the Text property of the reply to null. I also noticed that not all channels are working correctly yet. I got Facebook messenger to work.

ConnectorClient connector = new ConnectorClient(new Uri(activity.ServiceUrl)); Activity reply = activity.CreateReply(); reply.Type = ActivityTypes.Typing; reply.Text = null; await connector.Conversations.ReplyToActivityAsync(reply);

botframeworkv3

PatrickKalkman avatar Jul 17 '16 10:07 PatrickKalkman

That's the right way to do it. Not all channels support typing indicator (2 that I know are Facebook and Slack.)

tomlm avatar Jul 20 '16 01:07 tomlm

I am facing the same issues a, tried alot of soln on the same but unfortunately nothing helped.

I have a built a custom chat window using cshtml and javascript. I am sending Typing activity from my bot solution. This piece of code is working with "webchat" and "emulator" but it is not working with my designed page.

when i am setting webSocket = true my directline calls are failing. PFB

BotChat.App({
    botConnection: botapp.botConnection,
    user: botapp.user,
    bot: bot,
    resize: 'detect',
    directLine: {
        secret: '.......................gc.cwA.gzs.DgekX5............................',
    webSocket:true
}
}, document.getElementById("divbot"));

Please help me out on the issue.

Thanks in advance. Appreciate you for taking out time this.

tinuCoder avatar Mar 11 '18 07:03 tinuCoder