onTeamsMembersAddedEvent handler doesn't run
See original GitHub issueVersions
What package version of the SDK are you using: ^4.9.0
What nodejs version are you using: v13.6.0
What browser version are you using: Chrome 81.0.4044.138
What os are you using: MacOS 10.14.6
Describe the bug
TeamsActivityHandler.onTeamsMembersAddedEvent handler doesn’t fire.
To Reproduce
- Inside Teams, Upload custom app -> select .zip -> Add
- Observe that app home screen is now open in web app
- Observe POST request to bot endpoint (using ngrok)
// POST /api/messages
{
"membersAdded": [
{
"id": "29:1hjD7KSnkCFRm5xasdfd4Jt0Kw9Ehhk56B_T0KB6b1428DEgDa0s7bOAV71kcBtXa_w",
"aadObjectId": "32adf3ba-8b97-44c7-a06c-e2d4f7sdsda38cbc"
},
{
"id": "28:85a028da-48d7-4237-b1ac-4231c4544fe8"
}
],
"type": "conversationUpdate",
"timestamp": "2020-05-13T09:38:52.6203787Z",
"id": "f:e9e5ac1a-dbf0-38b0-1d1f-dd6b5c5b34fe",
"channelId": "msteams",
"serviceUrl": "https://smba.trafficmanager.net/amer/",
"from": {
"id": "29:1hjD7KSnkCmRm5x3iCCDMB6Ivlq4AYc1aID9JnJB4Jt0Kw9Ehhk56B_T0KB6b1428DEgDa0s7bOAV71kcBtXa_w",
"aadObjectId": "12alf9ba-8b97-44c7-a06c-e2d4f7a38cbc"
},
"conversation": {
"conversationType": "personal",
"tenantId": "a2aee900-2e61-4451-97f0-f45baa3db628",
"id": "a:14mtI5vt1TkHonyxiEu3mNptiDttg80gtLHGBUWkdzmvmOrDlYSsx7ELKGMegDBxuvpPFQd0bKL2CUrRVfHrAdOXGlfn64mej1UOCAQlal-j4N-OOo9YUnXe9q5L-yDsc"
},
"recipient": {
"id": "28:85b828da-48f7-4237-b0ac-4231c4545fe8",
"name": "MyBot"
},
"channelData": {
"tenant": {
"id": "a2aee900-2e61-4451-97f0-f45baa3db628"
}
}
}
// server.js
const bot = new MyBot()
app.post('/api/messages', async (req, res) => {
adapter.processActivity(req, res, async (context) => {
if (context.activity.type !== ActivityTypes.Invoke) {
await bot.run(context)
}
})
})
// bot.js
module.exports.MyBot = class MyBot extends TeamsActivityHandler {
constructor() {
super()
this.onTeamsMembersAddedEvent(async (membersAdded, teamInfo, turnContext, next) => {
console.log('onTeamsMembersAddedEvent')
await next()
})
}
}
Expected behavior
‘onTeamsMembersAddedEvent’ string output to console
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
this.onConversationUpdate
works (by work, I mean I can see that the handler code is executed)
So does this.onMembersAdded
.
Interestingly, using both this.onMembersAdded
and this.onTeamsMembersAddedEvent
at the same time, neither of them fire. When I remove, this.onTeamsMembersAddedEvent
, this.onMembersAdded
fires. this.onConversationUpdate
always fires no matter what other handlers are registered.
[bug]
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (5 by maintainers)
Confirmed that I can repro this on v4.9.0, but not prior. Digging into this now.
Hi @oliviert
Thank you for reporting this!
We have a fix https://github.com/microsoft/botbuilder-js/pull/2237 which should be released in the next few days as v4.9.1