diff --git a/samples/meetings-events/csharp/MeetingEvents/AppManifest/color.png b/samples/meetings-events/csharp/MeetingEvents/AppManifest/color.png index bd7353f018..b8cf81afbe 100644 Binary files a/samples/meetings-events/csharp/MeetingEvents/AppManifest/color.png and b/samples/meetings-events/csharp/MeetingEvents/AppManifest/color.png differ diff --git a/samples/meetings-events/csharp/MeetingEvents/AppManifest/manifest.json b/samples/meetings-events/csharp/MeetingEvents/AppManifest/manifest.json index 9674e6bfa9..afd0550a4c 100644 --- a/samples/meetings-events/csharp/MeetingEvents/AppManifest/manifest.json +++ b/samples/meetings-events/csharp/MeetingEvents/AppManifest/manifest.json @@ -1,9 +1,9 @@ { - "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.11/MicrosoftTeams.schema.json", - "manifestVersion": "1.11", + "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.14/MicrosoftTeams.schema.json", + "manifestVersion": "1.14", "version": "1.0.0", "id": "<>", - "packageName": "com.microsoft.teams.botmeetingevents", + "packageName": "com.microsoft.teams.botallmeetingevents", "developer": { "name": "Microsoft", "websiteUrl": "https://www.microsoft.com", @@ -12,11 +12,11 @@ }, "name": { "short": "Meeting Events", - "full": "Sample for meeting events" + "full": "Sample for meeting events and meeting participant events" }, "description": { - "short": "Access real-time meeting events", - "full": "This sample demos a bot with access to meeting events" + "short": "Access real-time meeting events and meeting participant events", + "full": "This sample demos a bot with access to meeting events and meeting participant events" }, "icons": { "outline": "outline.png", @@ -41,10 +41,24 @@ ], "webApplicationInfo": { "id": "<>", - "resource": "https://AnyString", - "applicationPermissions": [ - "OnlineMeeting.ReadBasic.Chat", - "ChannelMeeting.ReadBasic.Group" - ] + "resource": "https://AnyString" + }, + "authorization": { + "permissions": { + "resourceSpecific": [ + { + "name": "OnlineMeeting.ReadBasic.Chat", + "type": "Application" + }, + { + "name": "ChannelMeeting.ReadBasic.Group", + "type": "Application" + }, + { + "name": "OnlineMeetingParticipant.Read.Chat", + "type": "Application" + } + ] + } } } diff --git a/samples/meetings-events/csharp/MeetingEvents/AppManifest/outline.png b/samples/meetings-events/csharp/MeetingEvents/AppManifest/outline.png index c2f348068d..2c3bf6fa65 100644 Binary files a/samples/meetings-events/csharp/MeetingEvents/AppManifest/outline.png and b/samples/meetings-events/csharp/MeetingEvents/AppManifest/outline.png differ diff --git a/samples/meetings-events/csharp/MeetingEvents/Bots/ActivityBot.cs b/samples/meetings-events/csharp/MeetingEvents/Bots/ActivityBot.cs index fb517773c3..b1dacefae5 100644 --- a/samples/meetings-events/csharp/MeetingEvents/Bots/ActivityBot.cs +++ b/samples/meetings-events/csharp/MeetingEvents/Bots/ActivityBot.cs @@ -13,6 +13,8 @@ namespace MeetingEvents.Bots using Microsoft.Bot.Builder.Teams; using Microsoft.Bot.Schema; using Microsoft.Bot.Schema.Teams; + using Newtonsoft.Json.Linq; + using Newtonsoft.Json; public class ActivityBot : TeamsActivityHandler { @@ -23,6 +25,70 @@ public ActivityBot(ConversationState conversationState) _conversationState = conversationState; } + /// + /// Activity Handler for Meeting Participant join event + /// + /// + /// + /// + /// + protected override async Task OnTeamsMeetingParticipantsJoinAsync(MeetingParticipantsEventDetails meeting, ITurnContext turnContext, CancellationToken cancellationToken) + { + await turnContext.SendActivityAsync(MessageFactory.Attachment(createAdaptiveCardInvokeResponseAsync(meeting.Members[0].User.Name, " has joined the meeting."))); + return; + } + + /// + /// Activity Handler for Meeting Participant leave event + /// + /// + /// + /// + /// + protected override async Task OnTeamsMeetingParticipantsLeaveAsync(MeetingParticipantsEventDetails meeting, ITurnContext turnContext, CancellationToken cancellationToken) + { + await turnContext.SendActivityAsync(MessageFactory.Attachment(createAdaptiveCardInvokeResponseAsync(meeting.Members[0].User.Name, " left the meeting."))); + return; + } + + /// + /// Sample Adaptive card for Meeting participant events. + /// + private Attachment createAdaptiveCardInvokeResponseAsync(string userName, string action) + { + AdaptiveCard card = new AdaptiveCard(new AdaptiveSchemaVersion("1.4")) + { + Body = new List + { + new AdaptiveRichTextBlock + { + Inlines = new List + { + new AdaptiveTextRun + { + Text = userName, + Weight = AdaptiveTextWeight.Bolder, + Size = AdaptiveTextSize.Default, + }, + new AdaptiveTextRun + { + Text = action, + Weight = AdaptiveTextWeight.Default, + Size = AdaptiveTextSize.Default, + } + }, + Spacing = AdaptiveSpacing.Medium, + } + } + }; + + return new Attachment() + { + ContentType = AdaptiveCard.ContentType, + Content = card, + }; + } + /// /// Activity Handler for Meeting start event /// diff --git a/samples/meetings-events/csharp/MeetingEvents/Images/MeetingsEvents.gif b/samples/meetings-events/csharp/MeetingEvents/Images/MeetingsEvents.gif index a27f6a709e..b8c2d7c055 100644 Binary files a/samples/meetings-events/csharp/MeetingEvents/Images/MeetingsEvents.gif and b/samples/meetings-events/csharp/MeetingEvents/Images/MeetingsEvents.gif differ diff --git a/samples/meetings-events/csharp/MeetingEvents/Images/meeting-participant-added.png b/samples/meetings-events/csharp/MeetingEvents/Images/meeting-participant-added.png new file mode 100644 index 0000000000..bb8a95fbd1 Binary files /dev/null and b/samples/meetings-events/csharp/MeetingEvents/Images/meeting-participant-added.png differ diff --git a/samples/meetings-events/csharp/MeetingEvents/Images/meeting-participant-left.png b/samples/meetings-events/csharp/MeetingEvents/Images/meeting-participant-left.png new file mode 100644 index 0000000000..4885cffd2b Binary files /dev/null and b/samples/meetings-events/csharp/MeetingEvents/Images/meeting-participant-left.png differ diff --git a/samples/meetings-events/csharp/MeetingEvents/MeetingEvents.csproj b/samples/meetings-events/csharp/MeetingEvents/MeetingEvents.csproj index 86d47897b2..42117eceb3 100644 --- a/samples/meetings-events/csharp/MeetingEvents/MeetingEvents.csproj +++ b/samples/meetings-events/csharp/MeetingEvents/MeetingEvents.csproj @@ -8,7 +8,7 @@ - + diff --git a/samples/meetings-events/csharp/README.md b/samples/meetings-events/csharp/README.md index 785476bdd9..43df9a1342 100644 --- a/samples/meetings-events/csharp/README.md +++ b/samples/meetings-events/csharp/README.md @@ -1,6 +1,6 @@ --- page_type: sample -description: This sample demonstrates use of various meeting events which are available in bot framework v4 +description: This sample demonstrates use of various meeting events and meeting participant events which are available in bot framework v4 products: - office-teams - office @@ -15,8 +15,9 @@ urlFragment: officedev-microsoft-teams-samples-meetings-events-csharp # Realtime meeting events -Using this C# sample, a bot can receive real-time meeting events. +Using this C# sample, a bot can receive real-time meeting events and meeting participant events. For reference please check [Real-time Teams meeting events](https://docs.microsoft.com/microsoftteams/platform/apps-in-teams-meetings/api-references?tabs=dotnet) +and [Real-time Teams meeting participant events](https://learn.microsoft.com/microsoftteams/platform/apps-in-teams-meetings/meeting-apps-apis?branch=pr-8455&tabs=dotnet%2Cparticipant-join-event#get-participant-events) The feature shown in this sample is currently available in public developer preview only. @@ -32,7 +33,7 @@ The feature shown in this sample is currently available in public developer prev ## Try it yourself - experience the App in your Microsoft Teams client Please find below demo manifest which is deployed on Microsoft Azure and you can try it yourself by uploading the app manifest (.zip file link below) to your teams and/or as a personal app. (Sideloading must be enabled for your tenant, [see steps here](https://docs.microsoft.com/microsoftteams/platform/concepts/build-and-test/prepare-your-o365-tenant#enable-custom-teams-apps-and-turn-on-custom-app-uploading)). -**Realtime meeting events:** [Manifest](/samples/meetings-events/csharp/demo-manifest/Meetings-Events.zip) +**Realtime meeting and participant events:** [Manifest](/samples/meetings-events/csharp/demo-manifest/Meetings-Events.zip) ## Prerequisites @@ -121,6 +122,16 @@ Once the meeting where the bot is added starts or ends, real-time updates are po ![Meeting end event](MeetingEvents/Images/meeting-end.png) +**MeetingParticipantEvents command interaction:** + +To utilize this feature, please enable Meeting event subscriptions for `Participant Join` and `Participant Leave` in your bot, following the guidance outlined in the [meeting participant events](https://learn.microsoft.com/microsoftteams/platform/apps-in-teams-meetings/meeting-apps-apis?branch=pr-en-us-8455&tabs=channel-meeting%2Cguest-user%2Cone-on-one-call%2Cdotnet%2Cparticipant-join-event#receive-meeting-participant-events) documentation + +![Meeting participant added event](MeetingEvents/Images/meeting-participant-added.png) + +**End meeting events details:** + +![Meeting participant left event](MeetingEvents/Images/meeting-participant-left.png) + ## Deploy the bot to Azure To learn more about deploying a bot to Azure, see [Deploy your bot to Azure](https://aka.ms/azuredeployment) for a complete list of deployment instructions. @@ -129,5 +140,6 @@ To learn more about deploying a bot to Azure, see [Deploy your bot to Azure](htt - [Real-time Teams meeting events](https://docs.microsoft.com/microsoftteams/platform/apps-in-teams-meetings/api-references?tabs=dotnet) - [Meeting apps APIs](https://learn.microsoft.com/microsoftteams/platform/apps-in-teams-meetings/meeting-apps-apis?tabs=dotnet) +- [Real-time Teams meeting participant events](https://learn.microsoft.com/microsoftteams/platform/apps-in-teams-meetings/meeting-apps-apis?branch=pr-en-us-8455&tabs=channel-meeting%2Cguest-user%2Cone-on-one-call%2Cdotnet%2Cparticipant-join-event#receive-meeting-participant-events) \ No newline at end of file diff --git a/samples/meetings-events/csharp/assets/sample.json b/samples/meetings-events/csharp/assets/sample.json index 151398fbb1..af14af1d41 100644 --- a/samples/meetings-events/csharp/assets/sample.json +++ b/samples/meetings-events/csharp/assets/sample.json @@ -2,14 +2,14 @@ { "name": "officedev-microsoft-teams-samples-meetings-events-csharp", "source": "officeDev", - "title": "Realtime meeting events", - "shortDescription": "This sample demonstrates use of various meeting events which arfe available in bot framework v4", + "title": "Realtime meeting events and meeting participant events", + "shortDescription": "This sample demonstrates use of various meeting events and meeting participant events which are available in bot framework v4", "url": "https://github.com/OfficeDev/Microsoft-Teams-Samples/tree/main/samples/meetings-events/csharp", "longDescription": [ - "This sample demonstrates use of various meeting events which arfe available in bot framework v4" + "This sample demonstrates use of various meeting events and meeting participant events which are available in bot framework v4" ], "creationDateTime": "2021-11-10", - "updateDateTime": "2022-10-21", + "updateDateTime": "2023-08-02", "products": [ "Teams" ], @@ -36,7 +36,7 @@ "type": "image", "order": 100, "url": "https://raw.githubusercontent.com/OfficeDev/Microsoft-Teams-Samples/main/samples/meetings-events/csharp/MeetingEvents/Images/MeetingsEvents.gif", - "alt": "Solution UX showing realtime meeting events" + "alt": "Solution UX showing realtime meeting events and meeting participant events" } ], "authors": [