[英]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这是我们所做的
If we have the conversation ID in our cache/persistent store, we use it to send the message如果我们的缓存/持久存储中有会话 ID,我们将使用它来发送消息
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 管理界面获得)
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.