Botframework-sdk: Reply with "Is Typing" message

Created on 21 Apr 2016  路  11Comments  路  Source: microsoft/botframework-sdk

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?

Most helpful comment

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

All 11 comments

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

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"?

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.

Telegram also support "typing" message.

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

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

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

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

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

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

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Arimov picture Arimov  路  3Comments

mattlanham picture mattlanham  路  3Comments

akakoychenko picture akakoychenko  路  3Comments

vaditya04 picture vaditya04  路  3Comments

verdysh picture verdysh  路  3Comments