How to add customized typing indicator using c# in Azure bot

2021-03-18T14:32:17.407+00:00

I am building a chat application using botframework v4 with .net core. I want to implement customized typing indicator. Currently I am using below code and it is showing typing indicator like below image.

  public async override Task OnTurnAsync(ITurnContext turnContext, CancellationToken cancellationToken = default)  
    {  
        ITypingActivity replyActivity = Activity.CreateTypingActivity();   
        await turnContext.SendActivityAsync((Activity)replyActivity);   
        await Task.Delay(5000);  
        await base.OnTurnAsync(turnContext, cancellationToken);  
    }  

79275-chatbot.png

But instead of showing this typing symbol(...), I need to show some customized message (like bot is typing) and after getting bot response indicator need to remove automatically.

Azure AI Bot Service
Azure AI Bot Service
An Azure service that provides an integrated environment for bot development.
790 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,605 questions
{count} votes

1 answer

Sort by: Most helpful
  1. YutongTie-MSFT 48,326 Reputation points
    2021-03-30T23:11:16.26+00:00

    Hello,

    Thanks for the your patience. This can be done in defaultstyleoption.js file. You can also customize other item according to your requirement.

    Please see the 139 line of the file.

    https://github.com/microsoft/BotFramework-WebChat/blob/38a2c78221806f57c7ee82f1f13d9dc516aa81b8/packages/component/src/Styles/defaultStyleOptions.js#L139

    Regards,
    Yutong

    0 comments No comments