question

NainukunnelIbrahimHarisEXTERNAL-2639 avatar image
0 Votes"
NainukunnelIbrahimHarisEXTERNAL-2639 asked YutongTie-MSFT answered

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

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.

dotnet-csharpazure-bot-service
chatbot.png (37.0 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Thanks for reaching out to us, checking internally to see if there any way to do it.

Regards,
Yutong

0 Votes 0 ·

1 Answer

YutongTie-MSFT avatar image
0 Votes"
YutongTie-MSFT answered

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

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.