Search code examples
botframework

Typing indicator for bot framework in C#


I have a bot in Bot framework. Once user responds to the bot and bot is processing it, I want to show the typing indicator to the user in the meanwhile.

It is possible in Nodejs here - https://learn.microsoft.com/en-us/bot-framework/nodejs/bot-builder-nodejs-send-typing-indicator

But how can I implement it in C#?


Solution

  • You have to send an activity of type Typing.

    You can do it like that:

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