如何从外部源向 Microsoft Teams activity 提要发送通知
How to send a notification into Microsoft Teams activity feed from external source
有没有办法从外部源向 Microsoft Teams 的 Activity Feed 发送通知?
我找到了 this link 但似乎只有当用户将消息发布到频道时它才会生成通知。
我们能否构建一个可以将通知推送到 Microsoft Teams 的 Activity Feed 中的服务?
要访问 activity 供稿,您需要使用 Bot。此外,您只能为 1:1 聊天对话中发送的 message/card 发送通知。
如果您的 bot cards/messages 发布到某个频道,如果用户关注了该频道,它们将自动显示在用户的 Feed 中。
示例代码 Starting personal conversations
var parameters = new ConversationParameters
{
Members = new ChannelAccount[] { new ChannelAccount(userId) },
ChannelData = new TeamsChannelData
{
Tenant = new TenantInfo(tenantId),
Notification = new NotificationInfo() { Alert = true }
}
};
MicrosoftAppCredentials.TrustServiceUrl(serviceUrl, DateTime.MaxValue);
var connectorClient = new ConnectorClient(new Uri(activity.ServiceUrl));
var response = await connectorClient.Conversations.CreateConversationAsync(parameters);
有没有办法从外部源向 Microsoft Teams 的 Activity Feed 发送通知?
我找到了 this link 但似乎只有当用户将消息发布到频道时它才会生成通知。
我们能否构建一个可以将通知推送到 Microsoft Teams 的 Activity Feed 中的服务?
要访问 activity 供稿,您需要使用 Bot。此外,您只能为 1:1 聊天对话中发送的 message/card 发送通知。
如果您的 bot cards/messages 发布到某个频道,如果用户关注了该频道,它们将自动显示在用户的 Feed 中。
示例代码 Starting personal conversations
var parameters = new ConversationParameters
{
Members = new ChannelAccount[] { new ChannelAccount(userId) },
ChannelData = new TeamsChannelData
{
Tenant = new TenantInfo(tenantId),
Notification = new NotificationInfo() { Alert = true }
}
};
MicrosoftAppCredentials.TrustServiceUrl(serviceUrl, DateTime.MaxValue);
var connectorClient = new ConnectorClient(new Uri(activity.ServiceUrl));
var response = await connectorClient.Conversations.CreateConversationAsync(parameters);