Hello Asif,
Thanks for reaching out to us, you may need to use Azure Graph API to achieve it. There are some steps you may want to try -
Detecting Bot Installation and onMembersAdded
Event Issues
a. Check Bot Installation:
- Bot Installation Logs: Make sure you have proper logging around the bot installation and configuration. Check the bot’s installation status and logs on the Microsoft Teams Admin Center to see if the bot is installed for users who are not receiving the event.
- Teams App Catalog: Verify that the app is correctly listed in the Teams app catalog and that users have the app installed. Sometimes, users might not have permissions to install apps or there might be deployment issues.
b. Verify onMembersAdded
Event Handling:
- Bot Configuration: Ensure that your bot is correctly handling the
onMembersAdded
event and that the logic to handle this event is functioning correctly. Sometimes, bugs or errors in the event handling code might prevent the event from being processed correctly. - Event Handling Code: Review the code where the
onMembersAdded
event is processed. Make sure the bot is correctly registered to handle this event and that there are no conditions or filters that might be causing some events to be ignored.
c. Test in Different Scenarios:
- Test in Different Teams and Channels: Try adding the bot to different teams and channels to see if the issue is specific to certain teams or channels.
- Check User Permissions: Ensure that the users have the correct permissions to add the bot and that there are no policy restrictions in place that might prevent the bot from being added.
Obtaining User Details Without onMembersAdded
Event
If the onMembersAdded
event is not firing, you can still get user details using other methods:
a. Use Microsoft Graph API:
- User Information: You can use the Microsoft Graph API to query user details, such as their
userId
oremail
. The Graph API can provide information about users in a team or organization, which can be used to send messages or cards.- Example Endpoint:
GET /teams/{team-id}/members
- Documentation: Microsoft Graph API - List team members
- Example Endpoint:
b. Bot Framework’s REST API:
- Bot Framework API: Use the Bot Framework’s REST API to fetch user profiles and details if you have user IDs.
- Documentation: Bot Framework REST API
c. Manual User Interaction:
- Direct Interaction: If you have an alternate way to interact with users (e.g., via a web form or another bot interaction), you can ask users to provide their details directly.
Please take a look and let us know how it works. I hope this helps! Let us know if you have any other question.
Regards,
Yutong
-Please kindly accept the answer if you feel helpful to support the community, thanks a lot.