Skip to content

Commit

Permalink
Merge pull request #894 from OfficeDev/v-pritka/meetings-event-update
Browse files Browse the repository at this point in the history
[Sample Update] Added changes for meeting participants events in meetings notifications sample
  • Loading branch information
Pawank-MSFT authored Oct 17, 2023
2 parents 123b5a1 + ca450f7 commit e718b66
Show file tree
Hide file tree
Showing 10 changed files with 112 additions and 20 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -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": "<<APP-ID>>",
"packageName": "com.microsoft.teams.botmeetingevents",
"packageName": "com.microsoft.teams.botallmeetingevents",
"developer": {
"name": "Microsoft",
"websiteUrl": "https://www.microsoft.com",
Expand All @@ -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",
Expand All @@ -41,10 +41,24 @@
],
"webApplicationInfo": {
"id": "<<APP-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"
}
]
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
66 changes: 66 additions & 0 deletions samples/meetings-events/csharp/MeetingEvents/Bots/ActivityBot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -23,6 +25,70 @@ public ActivityBot(ConversationState conversationState)
_conversationState = conversationState;
}

/// <summary>
/// Activity Handler for Meeting Participant join event
/// </summary>
/// <param name="meeting"></param>
/// <param name="turnContext"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
protected override async Task OnTeamsMeetingParticipantsJoinAsync(MeetingParticipantsEventDetails meeting, ITurnContext<IEventActivity> turnContext, CancellationToken cancellationToken)
{
await turnContext.SendActivityAsync(MessageFactory.Attachment(createAdaptiveCardInvokeResponseAsync(meeting.Members[0].User.Name, " has joined the meeting.")));
return;
}

/// <summary>
/// Activity Handler for Meeting Participant leave event
/// </summary>
/// <param name="meeting"></param>
/// <param name="turnContext"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
protected override async Task OnTeamsMeetingParticipantsLeaveAsync(MeetingParticipantsEventDetails meeting, ITurnContext<IEventActivity> turnContext, CancellationToken cancellationToken)
{
await turnContext.SendActivityAsync(MessageFactory.Attachment(createAdaptiveCardInvokeResponseAsync(meeting.Members[0].User.Name, " left the meeting.")));
return;
}

/// <summary>
/// Sample Adaptive card for Meeting participant events.
/// </summary>
private Attachment createAdaptiveCardInvokeResponseAsync(string userName, string action)
{
AdaptiveCard card = new AdaptiveCard(new AdaptiveSchemaVersion("1.4"))
{
Body = new List<AdaptiveElement>
{
new AdaptiveRichTextBlock
{
Inlines = new List<AdaptiveInline>
{
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,
};
}

/// <summary>
/// Activity Handler for Meeting start event
/// </summary>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<ItemGroup>
<PackageReference Include="AdaptiveCards" Version="2.7.3" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.11" />
<PackageReference Include="Microsoft.Bot.Builder.Integration.AspNet.Core" Version="4.18.1" />
<PackageReference Include="Microsoft.Bot.Builder.Integration.AspNet.Core" Version="4.21.0" />
</ItemGroup>

<ItemGroup>
Expand Down
18 changes: 15 additions & 3 deletions samples/meetings-events/csharp/README.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.

Expand All @@ -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

Expand Down Expand Up @@ -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.
Expand All @@ -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)
<img src="https://pnptelemetry.azurewebsites.net/microsoft-teams-samples/samples/meetings-events-csharp" />
10 changes: 5 additions & 5 deletions samples/meetings-events/csharp/assets/sample.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
],
Expand All @@ -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": [
Expand Down

0 comments on commit e718b66

Please sign in to comment.