Tejas Sutar
Tejas Sutar

Reputation: 777

How to send a notification into Microsoft Teams activity feed from external source

Is there a way to send a notification into Activity Feed of Microsoft Teams from external source?

I have found this link but it seems like it will generate notification only when user posts a message into channel.

Can we build a service that can push notifications into Activity Feed of Microsoft Teams?

Upvotes: 0

Views: 2159

Answers (1)

Wajeed Shaikh
Wajeed Shaikh

Reputation: 3158

To access the activity feed, you will need to use a Bot. Also, you can send notification only for message/card sent in 1:1 chat conversation.

If your bot posts cards/messages into a channel, they'll automatically show up in the user's feed if he or she has followed that channel.

Sample code to 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);

Upvotes: 2

Related Questions