BotFramework-Composer icon indicating copy to clipboard operation
BotFramework-Composer copied to clipboard

Typing indicator doesn't work for old Teams

Open a1exwang opened this issue 1 year ago • 6 comments

Describe the bug

Version

Browser

  • [ ] Electron distribution
  • [x] Chrome
  • [ ] Safari
  • [ ] Firefox
  • [x] Edge

OS

  • [ ] macOS
  • [x] Windows
  • [ ] Ubuntu

To Reproduce

  1. Create an simple bot from teams toolkit

  2. Add following code

class TeamsBot extends TeamsActivityHandler {
  constructor() {
    super();

    this.onMessage(async (context, next) => {
      console.log("Running with Message Activity.");
      for (let i = 0; i < 10; i++) {
        await context.sendActivity({type: "typing"})
      }
      await context.sendActivity("Echo: " + context.activity.text); 
      await next();
    });
  }
}
  1. Sideloading in old Teams web client

  2. Send "hello" to bot

  3. After a while, I received Echo: hello from bot but no typing indicator.

Expected behavior

I can see typing indicator. A few days ago, it works in old Teams.

May relate to https://github.com/microsoft/BotFramework-Composer/issues/9679

a1exwang avatar Feb 08 '24 07:02 a1exwang

@a1exwang - Thank you for your patience. There are a couple things to note, here.

  1. Due to a Teams outage last week, the typing indicator was disabled for both classic as well as the new Teams apps. The typing indicator is slowly being reenabled across different groups and regions. I do not have a specific ETA on when it will be reenabled for you.

  2. With regards to your code posted above, you wouldn't see the typing indicator in this scenario, anyhow. The reason being the following activity (i.e., the 'echo' response) is running too soon for the typing indicator to show. In other words, there is no reason for the typing indicator to show because there is no delay experienced that would necessitate the typing indicator to show.

To demonstrate this, I will send only the typing activity, like below, using Web Chat as the client. You will see the typing indicator display for the default five seconds.

this.onMessage(async (context, next) => {
      console.log("Running with Message Activity.");
      await context.sendActivity({type: "typing"})
      await next();
    });

disableOAuthPromptACButton

To that end, while you can use the 'typing' activity, the preferred method for implementing the typing indicator is to use the 'ShowTypingMiddleware' middleware, like below, in the index.js. This middleware has internal logic that allows you to control the delay (how long it waits before sending the indicator) and period (how long it sends the indicator for):

const adapter = new CloudAdapter(botFrameworkAuthentication);

[ ... ]

adapter.use(new ShowTypingMiddleware(500, 1000));

The code you posted, in some scenarios, can actually cause the bot to produce an error.

stevkan avatar Feb 14 '24 01:02 stevkan

@a1exwang - Thank you for your patience. There are a couple things to note, here.

  1. Due to a Teams outage last week, the typing indicator was disabled for both classic as well as the new Teams apps. The typing indicator is slowly being reenabled across different groups and regions. I do not have a specific ETA on when it will be reenabled for you.
  2. With regards to your code posted above, you wouldn't see the typing indicator in this scenario, anyhow. The reason being the following activity (i.e., the 'echo' response) is running too soon for the typing indicator to show. In other words, there is no reason for the typing indicator to show because there is no delay experienced that would necessitate the typing indicator to show.

To demonstrate this, I will send only the typing activity, like below, using Web Chat as the client. You will see the typing indicator display for the default five seconds.

this.onMessage(async (context, next) => {
      console.log("Running with Message Activity.");
      await context.sendActivity({type: "typing"})
      await next();
    });

disableOAuthPromptACButton disableOAuthPromptACButton

To that end, while you can use the 'typing' activity, the preferred method for implementing the typing indicator is to use the 'ShowTypingMiddleware' middleware, like below, in the index.js. This middleware has internal logic that allows you to control the delay (how long it waits before sending the indicator) and period (how long it sends the indicator for):

const adapter = new CloudAdapter(botFrameworkAuthentication);

[ ... ]

adapter.use(new ShowTypingMiddleware(500, 1000));

The code you posted, in some scenarios, can actually cause the bot to produce an error.

@stevkan Thanks for the clarification.

  1. Tried your code

    this.onMessage(async (context, next) => {
       console.log("Running with Message Activity.");
       await context.sendActivity({type: "typing"})
       await next();
     });
    

    It seems the typing indicator feature still hasn't enabled for my testing org.

  2. Thanks for let me know ShowTypingMiddleware is the recommended way. I will let our customers know.

a1exwang avatar Feb 20 '24 05:02 a1exwang

@stevkan The decision to disable the typing indicator for Teams is outrageous.

We use that to provide a smooth user experience and now a lot of customers are complaining.

It should be reenabled ASAP.

atmoraes1 avatar Feb 20 '24 14:02 atmoraes1

Same here. Any updates so far?

ill-yes avatar Feb 23 '24 09:02 ill-yes

Coming back here to say when using the ShowTypingMiddleware we are receiving BadRequests all the time, we had to change our code to stop using it. Again, that is unacceptable.

atmoraes1 avatar Mar 08 '24 00:03 atmoraes1

Are there any updates on plans to enable the typing indicator since it was disabled 3 months ago?

AdiOLI avatar Mar 12 '24 13:03 AdiOLI

Closing as the issue has been resolved as of release of Microsoft Teams, version 24033.813.2773.520.

stevkan avatar May 06 '24 22:05 stevkan