Forum Discussion

alexkovalev's avatar
alexkovalev
Copper Contributor
Dec 22, 2021

Teams Notification Bot: TeamsInfo.getPagedMembers is sometimes not returning newly added members

Hi, I am a developer for a 3rd party Teams app. We include a built in notification bot that sends notifications to users of the app. To find these users, we implement

https://docs.microsoft.com/en-us/javascript/api/botbuilder/teamsactivityhandler?view=botbuilder-ts-latest#onTeamsMembersAdded[…]______Promise_void__to detect any time new users are added to a channel with our app, or the bot is added to a new channel. We then call https://docs.microsoft.com/en-us/javascript/api/botbuilder/teamsinfo?view=botbuilder-ts-latest#getPagedMembers_TurnContext__number__string_ (fetching all pages of users using the continuation token) to confirm that we have the user data on our end for their channel.

However, a small subset of our customer users are not being detected by the TeamsInfo.getPagedMembers call and are unable to have notifications sent to them. This affects less than 10% of new users, and we are not fully clear what is special about them. We have been able to reproduce this issue inside our own tenant:
 - Create a new user in admin.microsoft.com
 - Add this new user to a MS Teams team/channel as an admin

What's strange is that we had created our initial users in our tenant using this method, and they are successfully picked up by the TeamsInfo.getPagedMembers call.

Any help would be greatly appreciated, let me know if there are any other details I can provide


  • Please let us know if there's update on this issue? Is it fixed or are you still looking for support? If yes, I have posted few question could you please answer those it will help to repro this at our end.

    Thanks.
    • alexkovalev's avatar
      alexkovalev
      Copper Contributor

      HunaidHanfee-MSFT 

      Hi, yes we still need help with this issue. Here is some additional information that you asked for:
      1) These users are being added to the channel after the bot has been installed
      2) The bot is detecting some users, but not all. See the following screenshots for our tenant, where I checkmarked the users being detected:



      The users marked in red are the ones not being detected by the bot, and the blue ones are being detected. The way we create users is:
       - Create a new user in admin.microsoft.com
       - Add this new user to a MS Teams team/channel as an admin

      The only difference between the working and non-working users is that the working ones we added a while back, and the non-working ones are all new users from us trying to reproduce the issue.


      To confirm, here is my backend code, printing out the resulting list "members" confirms that only the 3 checkmarked emails are being detected:

          const members = [];
          do {
            var pagedMembers = await TeamsInfo.getPagedMembers(context, 100, continuationToken);
            continuationToken = pagedMembers.continuationToken;
            members.push(...pagedMembers.members.filter(m => !!m.email));
          }
          while (continuationToken !== undefined);



       

  • Are these users added after adding bot?
    Are there only few user which are not being detected after adding bot in channel or is it for all?
    Can you share more detailed steps on how you have created the user and added them in team/channel maybe with screenshots so that we can have repro at our end?

    Thanks

Resources