I'm trying to implement Proactive Messaging with a MS Teams bot. According to the docs i have to get a conversationReference
before sending any message to the user so I implemented the onMembersAdded
event listener as follows:
class TeamsBot extends TeamsActivityHandler {
constructor() {
super();
this.onConversationUpdate(async (context, next) => {
this.addConversationReference(context);
});
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) {
this.addConversationReference(context);
}
}
await next();
});
}
The problem is that I get notified only of the user that is installing the app even tough my Team (and channel) has plenty of members:
How do I get conversation references for every team member once the bot is installed?
It's important to note the difference between the users in a Team and the conversation reference between a user and a bot. What the docs are -trying- to say is this:
The docs, imo, don't really explain that well - they assume that by enumerating the list of users you'll be getting -actual- conversation references straight away, and/or that you might be able to initiate the conversation using the bot framework itself.