Teams bot onMemberAdded messages without actual event

45 views Asked by At

I have a Teams bot added to channel. Bot is based on this example from Microsoft GitHub.

There is a following peace of code:

this.onMembersAdded(async (context, next) => {
  const membersAdded = context.activity.membersAdded;
  
  for (let cnt = 0; cnt < membersAdded.length; cnt++) {
    if (membersAdded[cnt].id !== context.activity.recipient.id) {
      const welcomeMessage = `Welcome to the Proactive Bot sample.  Navigate to ${process.env.PROVISIONOUTPUT__BOTOUTPUT__SITEENDPOINT}/api/notify to proactively message everyone who has previously messaged this bot.`;
      await context.sendActivity(welcomeMessage);
    }
  }

  // By calling next() you ensure that the next BotHandler is run.
  await next();
});

Basically, whenever new member is added, there will be a welcome message.

The problem is that sometimes we see in the channel welcome messages without any reason - no new member added.

What could be the reason?

0

There are 0 answers