简体   繁体   English

如果未捕获安装事件,是否有任何方法可以获取用户 ID/对话参考以主动向团队中的用户发送消息

[英]Is there any way to get user id/conversation reference to proactively message user on teams if installation event wasnt captured

Looking for the best course of action that would have the least impact on users to be able proactively message users with teams app (bot) installed but where they have not messaged the bot and the conversation reference was not captured at time of install.寻找对用户影响最小的最佳行动方案,以便能够主动向安装了团队应用程序(机器人)的用户发送消息,但他们没有向机器人发送消息,并且在安装时未捕获对话参考。

The scenario is that have an enterprise bot that has been operational for over 3 years servicing 10s of thousands of employees.场景是有一个已经运行了 3 年以上的企业机器人为成千上万的员工提供服务。 The bot is auto installed for all users in the tenant, but conversation references were only being stored in the last 2/3's of the applications life, and the install event was not being captured until recently.该机器人是为租户中的所有用户自动安装的,但对话引用仅存储在应用程序生命的最后 2/3 中,并且直到最近才捕获安装事件。 This was not an issue in past as all proactive functionality was predicated on some interaction with the bot.这在过去不是问题,因为所有主动功能都基于与机器人的某些交互。

I now have a need to be able proactively messages all users within tenant regardless of if they have messaged the bot or not, or if they last messaged the bot before conversation references were being stored.我现在需要能够主动向租户内的所有用户发送消息,无论他们是否已向机器人发送消息,或者他们是否在存储对话引用之前最后向机器人发送消息。 There are only a small subset of users the fall into this category.只有一小部分用户属于这一类。

Hoping some way to generate a conversation update, be it through graph or other means.希望以某种方式生成对话更新,无论是通过图表还是其他方式。 The installationUpdate event through app update seemed promising as can update the application but seems only triggered if bot is added or removed通过应用程序更新的installationUpdate 事件似乎很有希望,因为它可以更新应用程序,但似乎只有在添加或删除机器人时才会触发

You might look into using the List Teams functionality in the Graph API.您可能会考虑在 Graph API 中使用List Teams功能。 You can use Graph to get teams and list their members, assuming you can grant your bot the necessary permissions.假设您可以授予机器人必要的权限,您可以使用 Graph 获取团队并列出他们的成员。 There are many features in the Graph API which might help you accomplish this. Graph API中有许多功能可以帮助您完成此任务。

To send a proactive message to user the bot requires the conversation reference.要向用户发送主动消息,机器人需要对话参考。 The conversation can be only retrieved when bot installed.只有在安装了机器人后才能检索对话。 Without conversation reference you cannot send a proactive message using bot.如果没有对话参考,您将无法使用机器人发送主动消息。

You can use Send message in a chat API to send message to chat with delegated permissions.您可以使用聊天 API 中的发送消息来发送消息以使用委派权限进行聊天。

Could you please raise a uservoice for your case您能否为您的案例提高用户声音

Review the information provided here: https://docs.microsoft.com/en-us/microsoftteams/platform/graph-api/proactive-bots-and-messages/graph-proactive-bots-and-messages?tabs=dotnet查看此处提供的信息: https ://docs.microsoft.com/en-us/microsoftteams/platform/graph-api/proactive-bots-and-messages/graph-proactive-bots-and-messages?tabs=dotnet

Here is what we do这是我们所做的

  1. If we have the conversation ID in our cache/persistent store, we use it to send the message如果我们的缓存/持久存储中有会话 ID,我们将使用它来发送消息

  2. If we dont have, we use GET https://graph.microsoft.com/v1.0/users/{user-id}/teamwork/installedApps/{teamsAppInstallationId}/chat to get the chatid (the app id here is not the bot application ID, but the ID generated when the app is installed in the org app store and is available from the Teams Admin interface)如果没有,我们使用GET https://graph.microsoft.com/v1.0/users/{user-id}/teamwork/installedApps/{teamsAppInstallationId}/chat来获取chatid(这里的app id不是bot 应用程序 ID,但该应用程序安装在 org 应用商店时生成的 ID,可从 Teams 管理界面获得)

  3. If the user does not have our app installed, we install the app using the teamsAppInstallationId ID.如果用户没有安装我们的应用程序,我们将使用 teamsAppInstallationId ID 安装应用程序。 This automatically generates a event without user intervention that is sent to the bot which you can then use to capture the conversation ID.这会在没有用户干预的情况下自动生成一个事件,该事件被发送到机器人,然后您可以使用它来捕获对话 ID。
    POST /users/{user-id | POST /users/{用户 ID | user-principal-name}/teamwork/installedApps用户主体名称}/teamwork/installedApps

This approach does require an Application Permission: TeamsAppInstallation.ReadWriteSelfForUser.All这种方法确实需要应用程序权限:TeamsAppInstallation.ReadWriteSelfForUser.All

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在使用 python 的团队中使用 email id 获取用户 ID - How to get user id using email id in teams using python 通过 API 获取 Microsoft Teams/Graph 用户状态消息 - Get Microsoft Teams/Graph user status message via API Microsoft Graph API:有没有办法获取用户的团队活动信息? - Microsoft Graph API: Is there a way to get the user's acitivity feed of teams? Microsoft Teams:获取用户的时区? - Microsoft Teams: get timezone of user? 如何在事件发生时从外部系统向微软团队用户发送聊天消息? - How to send a chat message to microsoft teams user from an external system upon event? 在 Microsoft Teams 的群聊(对话组而不是团队频道)中安装机器人 - Bot installation in Group Chats (Conversation Groups not Teams Channels) in Microsoft Teams 有什么方法可以知道用户在团队中使用的是哪个版本的自定义选项卡应用程序? - Is there any way to know which version of custom tab app user is using in teams? MS Teams Graph API:获取所有团队用户属于 - MS Teams Graph API: Get all teams user(s) are apart of 如何在 Teams 中获取用户语言设置? - How to get user language settings in Teams? 如何通过机器人向 Teams 中的用户真正发送消息 - How to really send a message to a user in Teams through a bot
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM