├── CSharp ├── Samples │ ├── Microsoft.Bot.Builder.Teams.FileBot │ │ ├── appsettings.json │ │ ├── Files │ │ │ └── teams-logo.png │ │ ├── TeamsAppManifest │ │ │ ├── color.png │ │ │ ├── outline.png │ │ │ └── manifest.json │ │ ├── BotConfiguration.bot │ │ ├── Program.cs │ │ ├── FileBot.cs │ │ └── Microsoft.Bot.Builder.Teams.FileBot.csproj │ ├── Microsoft.Bot.Builder.Teams.RemindMeBot │ │ ├── appsettings.json │ │ ├── TeamsAppManifest │ │ │ ├── color.png │ │ │ ├── outline.png │ │ │ └── manifest.json │ │ ├── appsettings.Development.json │ │ ├── BotConfiguration.bot │ │ ├── Engine │ │ │ ├── TimeEntity.cs │ │ │ └── IProactiveMessageManager.cs │ │ ├── Program.cs │ │ ├── ReadMe.md │ │ └── Microsoft.Bot.Builder.Teams.RemindMeBot.csproj │ ├── Microsoft.Bot.Builder.Teams.AuditBot.AspNet │ │ ├── Global.asax │ │ ├── TeamsAppManifest │ │ │ ├── color.png │ │ │ ├── outline.png │ │ │ └── manifest.json │ │ ├── BotConfiguration.bot │ │ ├── Global.asax.cs │ │ ├── Web.Debug.config │ │ ├── Web.Release.config │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── Web.config │ ├── Microsoft.Bot.Builder.Teams.AuditBot │ │ ├── TeamsAppManifest │ │ │ ├── color.png │ │ │ ├── outline.png │ │ │ └── manifest.json │ │ ├── BotConfiguration.bot │ │ ├── TeamOperationHistory.cs │ │ ├── OperationDetails.cs │ │ ├── Program.cs │ │ ├── AuditBot.cs │ │ ├── AuditLogAccessor.cs │ │ └── Microsoft.Bot.Builder.Teams.AuditBot.csproj │ ├── Microsoft.Bot.Builder.Teams.TeamEchoBot │ │ ├── TeamsAppManifest │ │ │ ├── color.png │ │ │ ├── outline.png │ │ │ └── manifest.json │ │ ├── appsettings.Development.json │ │ ├── appsettings.json │ │ ├── EchoState.cs │ │ ├── Program.cs │ │ ├── ReadMe.md │ │ ├── Microsoft.Bot.Builder.Teams.TeamEchoBot.csproj │ │ └── EchoStateAccessor.cs │ ├── Microsoft.Bot.Builder.Teams.MessagingExtensionBot │ │ ├── TeamsAppManifest │ │ │ ├── color.png │ │ │ └── outline.png │ │ ├── BotConfiguration.bot │ │ ├── Program.cs │ │ ├── MessagingExtensionBot.cs │ │ └── Microsoft.Bot.Builder.Teams.MessagingExtensionBot.csproj │ ├── Microsoft.Bot.Builder.Teams.WikipediaMessagingExtension │ │ ├── TeamsAppManifest │ │ │ ├── color.png │ │ │ ├── outline.png │ │ │ └── manifest.json │ │ ├── BotConfiguration.bot │ │ ├── Engine │ │ │ ├── Models │ │ │ │ ├── WikipediaThumbnail.cs │ │ │ │ ├── WikipediaQueryResult.cs │ │ │ │ ├── WikipediaPage.cs │ │ │ │ ├── WikipediaQuery.cs │ │ │ │ └── WikipediaResult.cs │ │ │ ├── ISearchHandler.cs │ │ │ └── TeamsInvokeActivityHandler.cs │ │ ├── Program.cs │ │ ├── ReadMe.md │ │ ├── WikipediaMessagingExtensionBot.cs │ │ └── Microsoft.Bot.Builder.Teams.WikipediaMessagingExtension.csproj │ ├── Microsoft.Bot.Builder.Abstractions.Teams │ │ ├── ConversationUpdate │ │ │ ├── TeamRenamedEvent.cs │ │ │ ├── ChannelCreatedEvent.cs │ │ │ ├── ChannelDeletedEvent.cs │ │ │ ├── ChannelRenamedEvent.cs │ │ │ ├── TeamMembersAddedEvent.cs │ │ │ ├── TeamMembersRemovedEvent.cs │ │ │ └── TeamEventBase.cs │ │ └── Microsoft.Bot.Builder.Abstractions.Teams.csproj │ └── Microsoft.Bot.Builder.Abstractions │ │ ├── IInvokeActivityHandler.cs │ │ ├── IMessageActivityHandler.cs │ │ ├── IMessageReactionActivityHandler.cs │ │ ├── IConversationUpdateActivityHandler.cs │ │ ├── IActivityProcessor.cs │ │ └── Microsoft.Bot.Builder.Abstractions.csproj ├── Build │ ├── 272MSSharedLibSN2048.snk │ └── stylecop.json ├── NuGet.config ├── UnitTests │ └── Microsoft.Bot.Builder.Teams.Tests │ │ ├── Jsons │ │ ├── SampleFileDownloadInfoAttachment.json │ │ ├── SampleResponseGetTeamsConversationMembers.json │ │ ├── SampleSkeletonActivity.json │ │ ├── SampleActivityTeamRenamed.json │ │ ├── SampleActivityNoMentions.json │ │ ├── SampleActivityMembersAdded.json │ │ ├── SampleActivityMembersRemoved.json │ │ ├── SampleActivityChannelCreated.json │ │ ├── SampleActivityChannelDeleted.json │ │ ├── SampleActivityChannelRenamed.json │ │ ├── SampleActivitySigninAuthStateVerification.json │ │ ├── SampleActivityInvoke.json │ │ ├── SampleActivityComposeExtension.json │ │ ├── SampleActivityAtMention.json │ │ └── SampleActivity2AtMentions.json │ │ ├── TestDelegatingHandler.cs │ │ └── SigninAuthTests.cs ├── Microsoft.Bot.Schema.Teams │ ├── Microsoft.Bot.Schema.Teams.csproj │ ├── TeamsChannelAccount.Ex.cs │ ├── TaskModuleAction.cs │ ├── Generated │ │ ├── TaskModuleRequestContext.cs │ │ ├── TenantInfo.cs │ │ ├── AppBasedLinkQuery.cs │ │ ├── ConversationList.cs │ │ ├── MessagingExtensionResponse.cs │ │ ├── NotificationInfo.cs │ │ ├── TaskModuleResponse.cs │ │ ├── MessagingExtensionSuggestedAction.cs │ │ ├── TeamInfo.cs │ │ ├── TaskModuleResponseBase.cs │ │ ├── ChannelInfo.cs │ │ ├── O365ConnectorCardFact.cs │ │ ├── O365ConnectorCardImage.cs │ │ ├── MessagingExtensionParameter.cs │ │ ├── TaskModuleMessageResponse.cs │ │ ├── MessagingExtensionQueryOptions.cs │ │ ├── TaskModuleContinueResponse.cs │ │ ├── SigninStateVerificationQuery.cs │ │ ├── TaskModuleRequest.cs │ │ ├── O365ConnectorCardOpenUriTarget.cs │ │ ├── O365ConnectorCardMultichoiceInputChoice.cs │ │ ├── MessageActionsPayloadBody.cs │ │ ├── O365ConnectorCardHttpPOST.cs │ │ ├── MessagingExtensionActionResponse.cs │ │ ├── FileInfoCard.cs │ │ ├── MessagingExtensionAttachment.cs │ │ ├── O365ConnectorCardOpenUri.cs │ │ ├── TeamDetails.cs │ │ ├── O365ConnectorCardViewAction.cs │ │ ├── O365ConnectorCardActionQuery.cs │ │ ├── O365ConnectorCardActionBase.cs │ │ ├── O365ConnectorCardDateInput.cs │ │ ├── FileDownloadInfo.cs │ │ ├── MessageActionsPayloadMention.cs │ │ └── MessageActionsPayloadUser.cs │ ├── AttachmentExtensions.cs │ └── MessageActionsPayloadBodyExtensions.cs ├── Microsoft.Bot.Connector.Teams │ ├── Microsoft.Bot.Connector.Teams.csproj │ └── ITeamsConnectorClient.cs └── Microsoft.Bot.Builder.Teams │ ├── Microsoft.Bot.Builder.Teams.csproj │ ├── JObjectExtensions.cs │ ├── TeamsContext.IncomingChannelAccount.cs │ ├── Middlewares │ ├── DropChannelActivitiesMiddleware.cs │ ├── DropChatActivitiesMiddleware.cs │ └── DropNonTeamsActivitiesMiddleware.cs │ ├── TeamsContext.cs │ └── StateStorage │ └── TeamSpecificConversationState.cs ├── .github └── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── Swagger ├── README.md └── generateclient.cmd └── LICENSE /CSharp/Samples/Microsoft.Bot.Builder.Teams.FileBot/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "botFilePath": "BotConfiguration.bot", 3 | "botFileSecret": "" 4 | } -------------------------------------------------------------------------------- /CSharp/Build/272MSSharedLibSN2048.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/BotBuilder-MicrosoftTeams-dotnet/HEAD/CSharp/Build/272MSSharedLibSN2048.snk -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.RemindMeBot/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "botFilePath": "BotConfiguration.bot", 3 | "botFileSecret": "" 4 | } -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.AuditBot.AspNet/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="Microsoft.Bot.Builder.Teams.AuditBot.AspNet.WebApiApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.FileBot/Files/teams-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/BotBuilder-MicrosoftTeams-dotnet/HEAD/CSharp/Samples/Microsoft.Bot.Builder.Teams.FileBot/Files/teams-logo.png -------------------------------------------------------------------------------- /CSharp/NuGet.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.FileBot/TeamsAppManifest/color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/BotBuilder-MicrosoftTeams-dotnet/HEAD/CSharp/Samples/Microsoft.Bot.Builder.Teams.FileBot/TeamsAppManifest/color.png -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.AuditBot/TeamsAppManifest/color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/BotBuilder-MicrosoftTeams-dotnet/HEAD/CSharp/Samples/Microsoft.Bot.Builder.Teams.AuditBot/TeamsAppManifest/color.png -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.AuditBot/TeamsAppManifest/outline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/BotBuilder-MicrosoftTeams-dotnet/HEAD/CSharp/Samples/Microsoft.Bot.Builder.Teams.AuditBot/TeamsAppManifest/outline.png -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.FileBot/TeamsAppManifest/outline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/BotBuilder-MicrosoftTeams-dotnet/HEAD/CSharp/Samples/Microsoft.Bot.Builder.Teams.FileBot/TeamsAppManifest/outline.png -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.RemindMeBot/TeamsAppManifest/color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/BotBuilder-MicrosoftTeams-dotnet/HEAD/CSharp/Samples/Microsoft.Bot.Builder.Teams.RemindMeBot/TeamsAppManifest/color.png -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.TeamEchoBot/TeamsAppManifest/color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/BotBuilder-MicrosoftTeams-dotnet/HEAD/CSharp/Samples/Microsoft.Bot.Builder.Teams.TeamEchoBot/TeamsAppManifest/color.png -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.AuditBot.AspNet/TeamsAppManifest/color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/BotBuilder-MicrosoftTeams-dotnet/HEAD/CSharp/Samples/Microsoft.Bot.Builder.Teams.AuditBot.AspNet/TeamsAppManifest/color.png -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.RemindMeBot/TeamsAppManifest/outline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/BotBuilder-MicrosoftTeams-dotnet/HEAD/CSharp/Samples/Microsoft.Bot.Builder.Teams.RemindMeBot/TeamsAppManifest/outline.png -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.TeamEchoBot/TeamsAppManifest/outline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/BotBuilder-MicrosoftTeams-dotnet/HEAD/CSharp/Samples/Microsoft.Bot.Builder.Teams.TeamEchoBot/TeamsAppManifest/outline.png -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.AuditBot.AspNet/TeamsAppManifest/outline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/BotBuilder-MicrosoftTeams-dotnet/HEAD/CSharp/Samples/Microsoft.Bot.Builder.Teams.AuditBot.AspNet/TeamsAppManifest/outline.png -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.MessagingExtensionBot/TeamsAppManifest/color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/BotBuilder-MicrosoftTeams-dotnet/HEAD/CSharp/Samples/Microsoft.Bot.Builder.Teams.MessagingExtensionBot/TeamsAppManifest/color.png -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.MessagingExtensionBot/TeamsAppManifest/outline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/BotBuilder-MicrosoftTeams-dotnet/HEAD/CSharp/Samples/Microsoft.Bot.Builder.Teams.MessagingExtensionBot/TeamsAppManifest/outline.png -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.RemindMeBot/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Debug", 5 | "System": "Information", 6 | "Microsoft": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.TeamEchoBot/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Debug", 5 | "System": "Information", 6 | "Microsoft": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.TeamEchoBot/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "MicrosoftAppId": "", 3 | "MicrosoftAppPassword": "", 4 | "Logging": { 5 | "LogLevel": { 6 | "Default": "Warning" 7 | } 8 | }, 9 | "AllowedHosts": "*" 10 | } 11 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.WikipediaMessagingExtension/TeamsAppManifest/color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/BotBuilder-MicrosoftTeams-dotnet/HEAD/CSharp/Samples/Microsoft.Bot.Builder.Teams.WikipediaMessagingExtension/TeamsAppManifest/color.png -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.WikipediaMessagingExtension/TeamsAppManifest/outline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OfficeDev/BotBuilder-MicrosoftTeams-dotnet/HEAD/CSharp/Samples/Microsoft.Bot.Builder.Teams.WikipediaMessagingExtension/TeamsAppManifest/outline.png -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.AuditBot/BotConfiguration.bot: -------------------------------------------------------------------------------- 1 | { 2 | "name": "AuditBot", 3 | "services": [ 4 | { 5 | "type": "endpoint", 6 | "name": "development", 7 | "endpoint": "", 8 | "appId": "", 9 | "appPassword": "", 10 | "id": "1" 11 | } 12 | ], 13 | "padlock": "", 14 | "version": "2.0" 15 | } -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.FileBot/BotConfiguration.bot: -------------------------------------------------------------------------------- 1 | { 2 | "name": "FileBot", 3 | "services": [ 4 | { 5 | "type": "endpoint", 6 | "name": "development", 7 | "endpoint": "", 8 | "appId": "", 9 | "appPassword": "", 10 | "id": "1" 11 | } 12 | ], 13 | "padlock": "", 14 | "version": "2.0" 15 | } 16 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.AuditBot.AspNet/BotConfiguration.bot: -------------------------------------------------------------------------------- 1 | { 2 | "name": "AuditBot", 3 | "services": [ 4 | { 5 | "type": "endpoint", 6 | "name": "development", 7 | "endpoint": "", 8 | "appId": "", 9 | "appPassword": "", 10 | "id": "1" 11 | } 12 | ], 13 | "padlock": "", 14 | "version": "2.0" 15 | } -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.RemindMeBot/BotConfiguration.bot: -------------------------------------------------------------------------------- 1 | { 2 | "name": "RemindMeBot", 3 | "services": [ 4 | { 5 | "type": "endpoint", 6 | "name": "development", 7 | "endpoint": "", 8 | "appId": "", 9 | "appPassword": "", 10 | "id": "1" 11 | } 12 | ], 13 | "padlock": "", 14 | "version": "2.0" 15 | } -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.MessagingExtensionBot/BotConfiguration.bot: -------------------------------------------------------------------------------- 1 | { 2 | "name": "MessagingExtensionBot", 3 | "services": [ 4 | { 5 | "type": "endpoint", 6 | "name": "development", 7 | "endpoint": "", 8 | "appId": "", 9 | "appPassword": "", 10 | "id": "1" 11 | } 12 | ], 13 | "padlock": "", 14 | "version": "2.0" 15 | } 16 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.WikipediaMessagingExtension/BotConfiguration.bot: -------------------------------------------------------------------------------- 1 | { 2 | "name": "WikipediaMessagingExtension", 3 | "services": [ 4 | { 5 | "type": "endpoint", 6 | "name": "development", 7 | "endpoint": "", 8 | "appId": "", 9 | "appPassword": "", 10 | "id": "1" 11 | } 12 | ], 13 | "padlock": "", 14 | "version": "2.0" 15 | } -------------------------------------------------------------------------------- /CSharp/UnitTests/Microsoft.Bot.Builder.Teams.Tests/Jsons/SampleFileDownloadInfoAttachment.json: -------------------------------------------------------------------------------- 1 | { 2 | "contentType": "application/vnd.microsoft.teams.file.download.info", 3 | "contentUrl": null, 4 | "content": { 5 | "downloadUrl": "https://bing.com", 6 | "uniqueId": "b83b9f77-7003-4d63-985c-9611c98303f3", 7 | "fileType": "txt", 8 | "etag": "078251f7-12bb-4132-93e4-2f2bb05fee8c" 9 | }, 10 | "name": null, 11 | "thumbnailUrl": null 12 | } -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.RemindMeBot/Engine/TimeEntity.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Teams.RemindMeBot.Engine 6 | { 7 | /// 8 | /// Time entity. 9 | /// 10 | public class TimeEntity 11 | { 12 | /// 13 | /// Gets or sets the time in seconds. 14 | /// 15 | public int TimeInSeconds { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Schema.Teams/Microsoft.Bot.Schema.Teams.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.TeamEchoBot/EchoState.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Teams.TeamEchoBot 6 | { 7 | /// 8 | /// Class for storing conversation state. 9 | /// 10 | public class EchoState 11 | { 12 | /// 13 | /// Gets or sets the turn count. 14 | /// 15 | public int TurnCount { get; set; } = 0; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Connector.Teams/Microsoft.Bot.Connector.Teams.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: "[Bug]" 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **SDK Version** 14 | 15 | **.Net Version** 16 | 17 | **Expected behavior** 18 | A clear and concise description of what you expected to happen. 19 | 20 | **Screenshots** 21 | If applicable, add screenshots to help explain your problem. 22 | 23 | **Additional context** 24 | Add any other context about the problem here. 25 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.WikipediaMessagingExtension/Engine/Models/WikipediaThumbnail.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Teams.WikipediaMessagingExtension.Engine.Models 6 | { 7 | /// 8 | /// Represents data of Wikipedia article image. 9 | /// 10 | internal class WikipediaThumbnail 11 | { 12 | /// 13 | /// Gets or sets the source url of the image. 14 | /// 15 | public string Source { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /CSharp/UnitTests/Microsoft.Bot.Builder.Teams.Tests/Jsons/SampleResponseGetTeamsConversationMembers.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": "29:UserId1", 4 | "aadObjectId": "0955be99-52ab-4b9e-9e9f-73e0c02bf4ea", 5 | "givenName": "Name", 6 | "email": "name@contoso.com", 7 | "userPrincipalName": "nme@contoso.com", 8 | "name": "Name" 9 | }, 10 | { 11 | "id": "29:UserId2", 12 | "aadObjectId": "cf7592ea-cae8-4e4f-b161-bd7315907892", 13 | "givenName": "FirstName", 14 | "surname": "LastName", 15 | "email": "FirstName.LastName@contoso.com", 16 | "userPrincipalName": "contoso@contoso.com", 17 | "name": "FirstName LastName" 18 | } 19 | ] -------------------------------------------------------------------------------- /CSharp/UnitTests/Microsoft.Bot.Builder.Teams.Tests/Jsons/SampleSkeletonActivity.json: -------------------------------------------------------------------------------- 1 | { 2 | "text": "Test Message", 3 | "textFormat": "plain", 4 | "type": "message", 5 | "timestamp": "2017-03-31T00:12:59.893Z", 6 | "id": "1400900100700", 7 | "channelId": "msteams", 8 | "serviceUrl": "https://smba.trafficmanager.net/amer-client-ss.msg/", 9 | "from": { 10 | "id": "29:SAMPLEID", 11 | "name": "SAMPLE USER" 12 | }, 13 | "conversation": { 14 | "isGroup": true, 15 | "id": "19:ThreadID@thread.skype;messageid=1400900100700" 16 | }, 17 | "recipient": { 18 | "id": "28:f7c72d1a-9892-42b7-8fe0-6fb6e7c85851", 19 | "name": "TestBot" 20 | } 21 | } -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.WikipediaMessagingExtension/Engine/Models/WikipediaQueryResult.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Teams.WikipediaMessagingExtension.Engine.Models 6 | { 7 | /// 8 | /// Defines the object that contains Wikipedia query results. 9 | /// 10 | internal class WikipediaQueryResult 11 | { 12 | /// 13 | /// Gets or sets query result from Wikipedia API. 14 | /// 15 | public WikipediaQuery Query { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Builder.Teams/Microsoft.Bot.Builder.Teams.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /CSharp/Build/stylecop.json: -------------------------------------------------------------------------------- 1 | { 2 | // ACTION REQUIRED: This file was automatically added to your project, but it 3 | // will not take effect until additional steps are taken to enable it. See the 4 | // following page for additional information: 5 | // 6 | // https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/EnableConfiguration.md 7 | 8 | "$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json", 9 | "settings": { 10 | "documentationRules": { 11 | "companyName": "Microsoft", 12 | "copyrightText": "Licensed under the MIT License." 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.AuditBot/TeamOperationHistory.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Teams.AuditBot 6 | { 7 | using System.Collections.Generic; 8 | 9 | /// 10 | /// Team operation history. 11 | /// 12 | public class TeamOperationHistory 13 | { 14 | /// 15 | /// Gets or sets the member operations. Operation is a tuple of ObjectId, Operation and Time. 16 | /// 17 | public List MemberOperations { get; set; } = new List(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: "[Feature]" 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Abstractions.Teams/ConversationUpdate/TeamRenamedEvent.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Abstractions.Teams.ConversationUpdate 6 | { 7 | /// 8 | /// Team renamed event. 9 | /// 10 | /// 11 | public class TeamRenamedEvent : TeamEventBase 12 | { 13 | /// 14 | /// Gets the event type. 15 | /// 16 | public override TeamEventType EventType 17 | { 18 | get 19 | { 20 | return TeamEventType.TeamRenamed; 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.WikipediaMessagingExtension/Engine/Models/WikipediaPage.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Teams.WikipediaMessagingExtension.Engine.Models 6 | { 7 | /// 8 | /// Represents page data Wikipedia API returns. 9 | /// 10 | internal class WikipediaPage 11 | { 12 | /// 13 | /// Gets or sets the pageid of the wikipedia article. 14 | /// 15 | public string Pageid { get; set; } 16 | 17 | /// 18 | /// Gets or sets the image thumbnail. 19 | /// 20 | public WikipediaThumbnail Thumbnail { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Abstractions/IInvokeActivityHandler.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Abstractions 6 | { 7 | using System.Threading.Tasks; 8 | 9 | /// 10 | /// Processes activites with set to . 11 | /// 12 | public interface IInvokeActivityHandler 13 | { 14 | /// 15 | /// Handles the invoke task asynchronously. 16 | /// 17 | /// The turn context. 18 | /// Invoke response. 19 | Task HandleInvokeTaskAsync(ITurnContext turnContext); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Abstractions/IMessageActivityHandler.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Abstractions 6 | { 7 | using System.Threading.Tasks; 8 | 9 | /// 10 | /// Processes activites with set to . 11 | /// 12 | public interface IMessageActivityHandler 13 | { 14 | /// 15 | /// Handles the message activity asynchronously. 16 | /// 17 | /// The turn context. 18 | /// Task tracking operation. 19 | Task HandleMessageAsync(ITurnContext turnContext); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.WikipediaMessagingExtension/Engine/ISearchHandler.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Teams.WikipediaMessagingExtension.Engine 6 | { 7 | using System.Threading.Tasks; 8 | using Microsoft.Bot.Schema.Teams; 9 | 10 | /// 11 | /// Search handler. 12 | /// 13 | public interface ISearchHandler 14 | { 15 | /// 16 | /// Gets the search result asynchronously. 17 | /// 18 | /// The invoke query object 19 | /// Messaging extension result. 20 | Task GetSearchResultAsync(MessagingExtensionQuery query); 21 | } 22 | } -------------------------------------------------------------------------------- /CSharp/UnitTests/Microsoft.Bot.Builder.Teams.Tests/Jsons/SampleActivityTeamRenamed.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "conversationUpdate", 3 | "timestamp": "2017-03-31T00:12:59.893Z", 4 | "id": "1400900100700", 5 | "channelId": "msteams", 6 | "serviceUrl": "https://smba.trafficmanager.net/amer-client-ss.msg/", 7 | "from": { 8 | "id": "29:SAMPLEID" 9 | }, 10 | "conversation": { 11 | "isGroup": true, 12 | "id": "19:ThreadID@thread.skype;messageid=1400900100700" 13 | }, 14 | "recipient": { 15 | "id": "28:f7c72d1a-9892-42b7-8fe0-6fb6e7c85851", 16 | "name": "TestBot" 17 | }, 18 | "channelData": { 19 | "team": { 20 | "id": "19:ThreadID2@thread.skype", 21 | "name": "Test Team" 22 | }, 23 | "eventType": "teamRenamed", 24 | "tenant": { 25 | "id": "3b9e9fbb-ed2f-415b-b776-cf788e573366" 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /Swagger/README.md: -------------------------------------------------------------------------------- 1 | # BotFramework Connector 2 | 3 | > see https://aka.ms/autorest 4 | 5 | Configuration for generating BotFramework Connector SDK. 6 | 7 | ``` yaml 8 | add-credentials: true 9 | openapi-type: data-plane 10 | ``` 11 | The current release for the BotFramework Connector is v3.0. 12 | 13 | # Releases 14 | 15 | ## Connector API 3.0 16 | 17 | ``` yaml 18 | input-file: TeamsAPI.json 19 | ``` 20 | 21 | ### Connector API 3.0 - CSharp Settings 22 | These settings apply only when `--csharp` is specified on the command line. 23 | ``` yaml $(csharp) 24 | csharp: 25 | namespace: Microsoft.Bot.Connector.Teams 26 | override-client-name: TeamsConnectorClient 27 | use-datetimeoffset: true 28 | sync-methods: None 29 | license-header: MICROSOFT_MIT_NO_VERSION 30 | azure-arm: false 31 | output-folder: Generated 32 | clear-output-folder: true 33 | ``` -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Schema.Teams/TeamsChannelAccount.Ex.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Schema.Teams 6 | { 7 | using Newtonsoft.Json; 8 | 9 | /// 10 | /// Teams Channel Account extensions. 11 | /// 12 | public partial class TeamsChannelAccount 13 | { 14 | /// 15 | /// Gets or sets the AAD Object Id. 16 | /// 17 | [JsonProperty(PropertyName = "objectId")] 18 | private string ObjectId 19 | { 20 | get 21 | { 22 | return this.AadObjectId; 23 | } 24 | 25 | set 26 | { 27 | this.AadObjectId = value; 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /CSharp/UnitTests/Microsoft.Bot.Builder.Teams.Tests/Jsons/SampleActivityNoMentions.json: -------------------------------------------------------------------------------- 1 | { 2 | "text": "Test ", 3 | "textFormat": "plain", 4 | "type": "message", 5 | "timestamp": "2017-04-25T22:29:14.158Z", 6 | "id": "1493159353121", 7 | "channelId": "msteams", 8 | "serviceUrl": "https://smba.trafficmanager.net/amer-client-ss.msg/", 9 | "from": { 10 | "id": "29:Key", 11 | "name": "TestUser" 12 | }, 13 | "conversation": { 14 | "id": "ConversationId" 15 | }, 16 | "recipient": { 17 | "id": "28:00000000-1111-2222-3333-444444444444", 18 | "name": "TestBot" 19 | }, 20 | "entities": [ 21 | { 22 | "locale": "en-US", 23 | "country": "US", 24 | "platform": "Windows", 25 | "type": "clientInfo" 26 | } 27 | ], 28 | "channelData": { 29 | "tenant": { 30 | "id": "0fb0a2ff-2539-417a-8514-7f3b695024fd" 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Abstractions/IMessageReactionActivityHandler.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Abstractions 6 | { 7 | using System.Threading.Tasks; 8 | 9 | /// 10 | /// Processes activites with set to . 11 | /// 12 | public interface IMessageReactionActivityHandler 13 | { 14 | /// 15 | /// Handles the message reaction activity asynchronously. 16 | /// 17 | /// The turn context. 18 | /// Task tracking operation. 19 | Task HandleMessageReactionAsync(ITurnContext turnContext); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.RemindMeBot/Engine/IProactiveMessageManager.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Teams.RemindMeBot.Engine 6 | { 7 | using System; 8 | 9 | /// 10 | /// Proactive message manager. 11 | /// 12 | public interface IProactiveMessageManager 13 | { 14 | /// 15 | /// Queues the work item to be executed at a later point. 16 | /// 17 | /// The turn context. 18 | /// The message to send. 19 | /// The time to wait. 20 | void QueueWorkItem(ITurnContext turnContext, string messageToSend, TimeSpan timeToWait); 21 | } 22 | } -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.AuditBot.AspNet/Global.asax.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Teams.AuditBot.AspNet 6 | { 7 | using System.Web.Http; 8 | 9 | #pragma warning disable SA1649 // File name should match first type name 10 | /// 11 | /// Starts up web application. 12 | /// 13 | /// 14 | public class WebApiApplication : System.Web.HttpApplication 15 | #pragma warning restore SA1649 // File name should match first type name 16 | { 17 | /// 18 | /// Starts the application. 19 | /// 20 | protected void Application_Start() 21 | { 22 | GlobalConfiguration.Configure(WebApiConfig.Register); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.AuditBot/OperationDetails.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Teams.AuditBot 6 | { 7 | using System; 8 | 9 | /// 10 | /// Operation details of a team operation. 11 | /// 12 | public class OperationDetails 13 | { 14 | /// 15 | /// Gets or sets the object identifier. 16 | /// 17 | public string ObjectId { get; set; } 18 | 19 | /// 20 | /// Gets or sets the operation. 21 | /// 22 | public string Operation { get; set; } 23 | 24 | /// 25 | /// Gets or sets the operation time. 26 | /// 27 | public DateTimeOffset OperationTime { get; set; } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /CSharp/UnitTests/Microsoft.Bot.Builder.Teams.Tests/Jsons/SampleActivityMembersAdded.json: -------------------------------------------------------------------------------- 1 | { 2 | "membersAdded": [ 3 | { 4 | "id": "29:UniqueID" 5 | } 6 | ], 7 | "type": "conversationUpdate", 8 | "timestamp": "2017-03-31T00:12:59.893Z", 9 | "id": "1400900100700", 10 | "channelId": "msteams", 11 | "serviceUrl": "https://smba.trafficmanager.net/amer-client-ss.msg/", 12 | "from": { 13 | "id": "29:SAMPLEID" 14 | }, 15 | "conversation": { 16 | "isGroup": true, 17 | "id": "19:ThreadID@thread.skype;messageid=1400900100700" 18 | }, 19 | "recipient": { 20 | "id": "28:f7c72d1a-9892-42b7-8fe0-6fb6e7c85851", 21 | "name": "TestBot" 22 | }, 23 | "channelData": { 24 | "team": { 25 | "id": "19:ThreadID@thread.skype" 26 | }, 27 | "eventType": "teamMemberAdded", 28 | "tenant": { 29 | "id": "3b9e9fbb-ed2f-415b-b776-cf788e573366" 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /CSharp/UnitTests/Microsoft.Bot.Builder.Teams.Tests/Jsons/SampleActivityMembersRemoved.json: -------------------------------------------------------------------------------- 1 | { 2 | "membersRemoved": [ 3 | { 4 | "id": "29:UniqueID" 5 | } 6 | ], 7 | "type": "conversationUpdate", 8 | "timestamp": "2017-03-31T00:12:59.893Z", 9 | "id": "1400900100700", 10 | "channelId": "msteams", 11 | "serviceUrl": "https://smba.trafficmanager.net/amer-client-ss.msg/", 12 | "from": { 13 | "id": "29:SAMPLEID" 14 | }, 15 | "conversation": { 16 | "isGroup": true, 17 | "id": "19:ThreadID@thread.skype;messageid=1400900100700" 18 | }, 19 | "recipient": { 20 | "id": "28:f7c72d1a-9892-42b7-8fe0-6fb6e7c85851", 21 | "name": "TestBot" 22 | }, 23 | "channelData": { 24 | "team": { 25 | "id": "19:ThreadID@thread.skype" 26 | }, 27 | "eventType": "teamMemberRemoved", 28 | "tenant": { 29 | "id": "3b9e9fbb-ed2f-415b-b776-cf788e573366" 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Abstractions/IConversationUpdateActivityHandler.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Abstractions 6 | { 7 | using System.Threading.Tasks; 8 | 9 | /// 10 | /// Processes activites with set to . 11 | /// 12 | public interface IConversationUpdateActivityHandler 13 | { 14 | /// 15 | /// Handles the conversation update activity task asynchronously. 16 | /// 17 | /// The turn context. 18 | /// Task tracking operation. 19 | Task HandleConversationUpdateActivityTaskAsync(ITurnContext turnContext); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /CSharp/UnitTests/Microsoft.Bot.Builder.Teams.Tests/Jsons/SampleActivityChannelCreated.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "conversationUpdate", 3 | "timestamp": "2017-03-31T00:12:59.893Z", 4 | "id": "1400900100700", 5 | "channelId": "msteams", 6 | "serviceUrl": "https://smba.trafficmanager.net/amer-client-ss.msg/", 7 | "from": { 8 | "id": "29:SAMPLEID" 9 | }, 10 | "conversation": { 11 | "isGroup": true, 12 | "id": "19:ThreadID@thread.skype;messageid=1400900100700" 13 | }, 14 | "recipient": { 15 | "id": "28:f7c72d1a-9892-42b7-8fe0-6fb6e7c85851", 16 | "name": "TestBot" 17 | }, 18 | "channelData": { 19 | "channel": { 20 | "id": "19:Channel@thread.skype", 21 | "name": "Channel2" 22 | }, 23 | "team": { 24 | "id": "19:ThreadID@thread.skype" 25 | }, 26 | "eventType": "channelCreated", 27 | "tenant": { 28 | "id": "3b9e9fbb-ed2f-415b-b776-cf788e573366" 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /CSharp/UnitTests/Microsoft.Bot.Builder.Teams.Tests/Jsons/SampleActivityChannelDeleted.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "conversationUpdate", 3 | "timestamp": "2017-03-31T00:12:59.893Z", 4 | "id": "1400900100700", 5 | "channelId": "msteams", 6 | "serviceUrl": "https://smba.trafficmanager.net/amer-client-ss.msg/", 7 | "from": { 8 | "id": "29:SAMPLEID" 9 | }, 10 | "conversation": { 11 | "isGroup": true, 12 | "id": "19:ThreadID@thread.skype;messageid=1400900100700" 13 | }, 14 | "recipient": { 15 | "id": "28:f7c72d1a-9892-42b7-8fe0-6fb6e7c85851", 16 | "name": "TestBot" 17 | }, 18 | "channelData": { 19 | "channel": { 20 | "id": "19:Channel@thread.skype", 21 | "name": "Channel2" 22 | }, 23 | "team": { 24 | "id": "19:ThreadID@thread.skype" 25 | }, 26 | "eventType": "channelDeleted", 27 | "tenant": { 28 | "id": "3b9e9fbb-ed2f-415b-b776-cf788e573366" 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /CSharp/UnitTests/Microsoft.Bot.Builder.Teams.Tests/Jsons/SampleActivityChannelRenamed.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "conversationUpdate", 3 | "timestamp": "2017-03-31T00:12:59.893Z", 4 | "id": "1400900100700", 5 | "channelId": "msteams", 6 | "serviceUrl": "https://smba.trafficmanager.net/amer-client-ss.msg/", 7 | "from": { 8 | "id": "29:SAMPLEID" 9 | }, 10 | "conversation": { 11 | "isGroup": true, 12 | "id": "19:ThreadID@thread.skype;messageid=1400900100700" 13 | }, 14 | "recipient": { 15 | "id": "28:f7c72d1a-9892-42b7-8fe0-6fb6e7c85851", 16 | "name": "TestBot" 17 | }, 18 | "channelData": { 19 | "channel": { 20 | "id": "19:Channel2@thread.skype", 21 | "name": "Channel3" 22 | }, 23 | "team": { 24 | "id": "19:ThreadID@thread.skype" 25 | }, 26 | "eventType": "channelRenamed", 27 | "tenant": { 28 | "id": "3b9e9fbb-ed2f-415b-b776-cf788e573366" 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Abstractions/IActivityProcessor.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Abstractions 6 | { 7 | using System.Threading; 8 | using System.Threading.Tasks; 9 | 10 | /// 11 | /// Incoming Bot Framework activity processor. 12 | /// 13 | public interface IActivityProcessor 14 | { 15 | /// 16 | /// Processes the incoming activity asynchronously. 17 | /// 18 | /// The turn context. 19 | /// The cancellation token. 20 | /// Task tracking operation. 21 | Task ProcessIncomingActivityAsync(ITurnContext turnContext, CancellationToken cancellationToken = default(CancellationToken)); 22 | } 23 | } -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.WikipediaMessagingExtension/Engine/Models/WikipediaQuery.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Teams.WikipediaMessagingExtension.Engine.Models 6 | { 7 | using System.Collections.Generic; 8 | using Newtonsoft.Json; 9 | 10 | /// 11 | /// Return the query data that Wikipedia API returns. 12 | /// 13 | internal class WikipediaQuery 14 | { 15 | /// 16 | /// Gets or sets Wikipedia search result. 17 | /// 18 | [JsonProperty(PropertyName = "search")] 19 | public IList Results { get; set; } 20 | 21 | /// 22 | /// Gets or sets pages from Wikipedia article. 23 | /// 24 | public IList Pages { get; set; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.WikipediaMessagingExtension/Engine/Models/WikipediaResult.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Teams.WikipediaMessagingExtension.Engine.Models 6 | { 7 | /// 8 | /// Represents data Wikipedia search API returns. 9 | /// 10 | internal class WikipediaResult 11 | { 12 | /// 13 | /// Gets or sets the pageid of the wikipedia article. 14 | /// 15 | public string Pageid { get; set; } 16 | 17 | /// 18 | /// Gets or sets the title of the wikipedia article. 19 | /// 20 | public string Title { get; set; } 21 | 22 | /// 23 | /// Gets or sets the snippet of the wikipedia article. 24 | /// 25 | public string Snippet { get; set; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /CSharp/UnitTests/Microsoft.Bot.Builder.Teams.Tests/Jsons/SampleActivitySigninAuthStateVerification.json: -------------------------------------------------------------------------------- 1 | { 2 | "text": "Test", 3 | "textFormat": "plain", 4 | "type": "invoke", 5 | "name": "signin/verifyState", 6 | "timestamp": "2017-04-25T22:29:14.158Z", 7 | "id": "1493159353121", 8 | "channelId": "msteams", 9 | "serviceUrl": "https://smba.trafficmanager.net/amer-client-ss.msg/", 10 | "from": { 11 | "id": "29:Key", 12 | "name": "TestUser" 13 | }, 14 | "conversation": { 15 | "id": "ConversationId" 16 | }, 17 | "recipient": { 18 | "id": "28:00000000-1111-2222-3333-444444444444", 19 | "name": "TestBot" 20 | }, 21 | "entities": [ 22 | { 23 | "locale": "en-US", 24 | "country": "US", 25 | "platform": "Windows", 26 | "type": "clientInfo" 27 | } 28 | ], 29 | "channelData": { 30 | "tenant": { 31 | "id": "0fb0a2ff-2539-417a-8514-7f3b695024fd" 32 | } 33 | }, 34 | "value": { 35 | "state": "WHATEVER_STATE_CONTENT" 36 | } 37 | } -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Abstractions.Teams/ConversationUpdate/ChannelCreatedEvent.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Abstractions.Teams.ConversationUpdate 6 | { 7 | using Microsoft.Bot.Schema.Teams; 8 | 9 | /// 10 | /// Channel created event arguments. 11 | /// 12 | /// 13 | public class ChannelCreatedEvent : TeamEventBase 14 | { 15 | /// 16 | /// Gets the event type. 17 | /// 18 | public override TeamEventType EventType 19 | { 20 | get 21 | { 22 | return TeamEventType.ChannelCreated; 23 | } 24 | } 25 | 26 | /// 27 | /// Gets the created channel. 28 | /// 29 | public ChannelInfo Channel { get; internal set; } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Abstractions.Teams/ConversationUpdate/ChannelDeletedEvent.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Abstractions.Teams.ConversationUpdate 6 | { 7 | using Microsoft.Bot.Schema.Teams; 8 | 9 | /// 10 | /// Channel deleted event arguments. 11 | /// 12 | /// 13 | public class ChannelDeletedEvent : TeamEventBase 14 | { 15 | /// 16 | /// Gets the event type. 17 | /// 18 | public override TeamEventType EventType 19 | { 20 | get 21 | { 22 | return TeamEventType.ChannelDeleted; 23 | } 24 | } 25 | 26 | /// 27 | /// Gets the deleted channel. 28 | /// 29 | public ChannelInfo Channel { get; internal set; } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Abstractions.Teams/ConversationUpdate/ChannelRenamedEvent.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Abstractions.Teams.ConversationUpdate 6 | { 7 | using Microsoft.Bot.Schema.Teams; 8 | 9 | /// 10 | /// Channel renamed event. 11 | /// 12 | /// 13 | public class ChannelRenamedEvent : TeamEventBase 14 | { 15 | /// 16 | /// Gets the event type. 17 | /// 18 | public override TeamEventType EventType 19 | { 20 | get 21 | { 22 | return TeamEventType.ChannelRenamed; 23 | } 24 | } 25 | 26 | /// 27 | /// Gets the details of the renamed channel. 28 | /// 29 | public ChannelInfo Channel { get; internal set; } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Builder.Teams/JObjectExtensions.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Teams 6 | { 7 | using Newtonsoft.Json.Linq; 8 | 9 | /// 10 | /// JObject extensions. 11 | /// 12 | internal static class JObjectExtensions 13 | { 14 | /// 15 | /// Converts into . 16 | /// 17 | /// The object instance. 18 | /// instance. 19 | public static JObject AsJObject(this object objectInstance) 20 | { 21 | if (objectInstance as JObject == null) 22 | { 23 | return JObject.FromObject(objectInstance); 24 | } 25 | else 26 | { 27 | return objectInstance as JObject; 28 | } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Abstractions.Teams/ConversationUpdate/TeamMembersAddedEvent.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Abstractions.Teams.ConversationUpdate 6 | { 7 | using System.Collections.Generic; 8 | using Microsoft.Bot.Schema; 9 | 10 | /// 11 | /// Event arguments for members added event. 12 | /// 13 | /// 14 | public class TeamMembersAddedEvent : TeamEventBase 15 | { 16 | /// 17 | /// Gets the event type. 18 | /// 19 | public override TeamEventType EventType 20 | { 21 | get 22 | { 23 | return TeamEventType.MembersAdded; 24 | } 25 | } 26 | 27 | /// 28 | /// Gets the list of added members. 29 | /// 30 | public IList MembersAdded { get; internal set; } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Abstractions.Teams/ConversationUpdate/TeamMembersRemovedEvent.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Abstractions.Teams.ConversationUpdate 6 | { 7 | using System.Collections.Generic; 8 | using Microsoft.Bot.Schema; 9 | 10 | /// 11 | /// Event arguments for members removed event. 12 | /// 13 | /// 14 | public class TeamMembersRemovedEvent : TeamEventBase 15 | { 16 | /// 17 | /// Gets the event type. 18 | /// 19 | public override TeamEventType EventType 20 | { 21 | get 22 | { 23 | return TeamEventType.MembersRemoved; 24 | } 25 | } 26 | 27 | /// 28 | /// Gets the list of removed members. 29 | /// 30 | public IList MembersRemoved { get; internal set; } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Swagger/generateclient.cmd: -------------------------------------------------------------------------------- 1 | call npm install replace@0.3.0 2 | call npm install autorest@2.0.4262 3 | 4 | call node_modules\.bin\autorest README.md --csharp 5 | 6 | cd generated 7 | call ..\node_modules\.bin\replace "Microsoft.Bot.Connector.Teams.Models" "Microsoft.Bot.Schema.Teams" . -r --include="*.cs" 8 | call ..\node_modules\.bin\replace "using Models;" "using Microsoft.Bot.Schema.Teams;" . -r --include="*.cs" 9 | call ..\node_modules\.bin\replace "FromProperty" "From" . -r --include="*.cs" 10 | call ..\node_modules\.bin\replace "fromProperty" "from" . -r --include="*.cs" 11 | cd .. 12 | 13 | del generated\Models\CardAction.cs 14 | del generated\Models\CardImage.cs 15 | del generated\Models\Attachment.cs 16 | del generated\Models\ChannelAccount.cs 17 | del generated\Models\Activity.cs 18 | del ..\CSharp\Microsoft.Bot.Schema.Teams\Generated\*.* /Q 19 | copy generated\Models\*.* ..\CSharp\Microsoft.Bot.Schema.Teams\Generated 20 | move ..\Microsoft.Bot.Schema\ErrorResponseException.cs ..\Microsoft.Bot.Connector 21 | copy generated\*.* ..\CSharp\Microsoft.Bot.Connector.Teams 22 | rd /q /s generated 23 | 24 | -------------------------------------------------------------------------------- /CSharp/UnitTests/Microsoft.Bot.Builder.Teams.Tests/Jsons/SampleActivityInvoke.json: -------------------------------------------------------------------------------- 1 | { 2 | "text": "Test", 3 | "textFormat": "plain", 4 | "type": "invoke", 5 | "timestamp": "2017-04-25T22:29:14.158Z", 6 | "id": "1493159353121", 7 | "channelId": "msteams", 8 | "serviceUrl": "https://smba.trafficmanager.net/amer-client-ss.msg/", 9 | "from": { 10 | "id": "29:Key", 11 | "name": "TestUser" 12 | }, 13 | "conversation": { 14 | "id": "ConversationId" 15 | }, 16 | "recipient": { 17 | "id": "28:00000000-1111-2222-3333-444444444444", 18 | "name": "TestBot" 19 | }, 20 | "entities": [ 21 | { 22 | "locale": "en-US", 23 | "country": "US", 24 | "platform": "Windows", 25 | "type": "clientInfo" 26 | } 27 | ], 28 | "channelData": { 29 | "tenant": { 30 | "id": "0fb0a2ff-2539-417a-8514-7f3b695024fd" 31 | } 32 | }, 33 | "value": { 34 | "commandId": "testQuery", 35 | "title": "testQuery", 36 | "parameters": [ 37 | { 38 | "name": "selectedQueryJson", 39 | "value": "Value" 40 | } 41 | ] 42 | } 43 | } -------------------------------------------------------------------------------- /CSharp/UnitTests/Microsoft.Bot.Builder.Teams.Tests/Jsons/SampleActivityComposeExtension.json: -------------------------------------------------------------------------------- 1 | { 2 | "text": "Test", 3 | "textFormat": "plain", 4 | "type": "invoke", 5 | "name": "composeExtension/query", 6 | "timestamp": "2017-04-25T22:29:14.158Z", 7 | "id": "1493159353121", 8 | "channelId": "msteams", 9 | "serviceUrl": "https://smba.trafficmanager.net/amer-client-ss.msg/", 10 | "from": { 11 | "id": "29:Key", 12 | "name": "TestUser" 13 | }, 14 | "conversation": { 15 | "id": "ConversationId" 16 | }, 17 | "recipient": { 18 | "id": "28:00000000-1111-2222-3333-444444444444", 19 | "name": "TestBot" 20 | }, 21 | "entities": [ 22 | { 23 | "locale": "en-US", 24 | "country": "US", 25 | "platform": "Windows", 26 | "type": "clientInfo" 27 | } 28 | ], 29 | "channelData": { 30 | "tenant": { 31 | "id": "0fb0a2ff-2539-417a-8514-7f3b695024fd" 32 | } 33 | }, 34 | "value": { 35 | "commandId": "testQuery", 36 | "parameters": [ 37 | { 38 | "name": "selectedQueryJson", 39 | "value": "Value" 40 | } 41 | ] 42 | } 43 | } -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.AuditBot/Program.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Teams.AuditBot 6 | { 7 | using Microsoft.AspNetCore; 8 | using Microsoft.AspNetCore.Hosting; 9 | 10 | /// 11 | /// Start up class for the application. 12 | /// 13 | public class Program 14 | { 15 | /// 16 | /// Defines the entry point of the application. 17 | /// 18 | /// The arguments. 19 | public static void Main(string[] args) 20 | { 21 | CreateWebHostBuilder(args).Build().Run(); 22 | } 23 | 24 | /// 25 | /// Creates the web host builder. 26 | /// 27 | /// The arguments. 28 | /// Web host builder. 29 | public static IWebHostBuilder CreateWebHostBuilder(string[] args) => 30 | WebHost.CreateDefaultBuilder(args) 31 | .UseStartup(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.FileBot/Program.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Teams.FileBot 6 | { 7 | using Microsoft.AspNetCore; 8 | using Microsoft.AspNetCore.Hosting; 9 | 10 | /// 11 | /// Start up class for the application. 12 | /// 13 | public class Program 14 | { 15 | /// 16 | /// Defines the entry point of the application. 17 | /// 18 | /// The arguments. 19 | public static void Main(string[] args) 20 | { 21 | CreateWebHostBuilder(args).Build().Run(); 22 | } 23 | 24 | /// 25 | /// Creates the web host builder. 26 | /// 27 | /// The arguments. 28 | /// Web host builder. 29 | public static IWebHostBuilder CreateWebHostBuilder(string[] args) => 30 | WebHost.CreateDefaultBuilder(args) 31 | .UseStartup(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.RemindMeBot/Program.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Teams.RemindMeBot 6 | { 7 | using Microsoft.AspNetCore; 8 | using Microsoft.AspNetCore.Hosting; 9 | 10 | /// 11 | /// Start up class for the application. 12 | /// 13 | public class Program 14 | { 15 | /// 16 | /// Defines the entry point of the application. 17 | /// 18 | /// The arguments. 19 | public static void Main(string[] args) 20 | { 21 | CreateWebHostBuilder(args).Build().Run(); 22 | } 23 | 24 | /// 25 | /// Creates the web host builder. 26 | /// 27 | /// The arguments. 28 | /// Web host builder. 29 | public static IWebHostBuilder CreateWebHostBuilder(string[] args) => 30 | WebHost.CreateDefaultBuilder(args) 31 | .UseStartup(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.TeamEchoBot/Program.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Teams.TeamEchoBot 6 | { 7 | using Microsoft.AspNetCore; 8 | using Microsoft.AspNetCore.Hosting; 9 | 10 | /// 11 | /// Start up class for the application. 12 | /// 13 | public class Program 14 | { 15 | /// 16 | /// Defines the entry point of the application. 17 | /// 18 | /// The arguments. 19 | public static void Main(string[] args) 20 | { 21 | CreateWebHostBuilder(args).Build().Run(); 22 | } 23 | 24 | /// 25 | /// Creates the web host builder. 26 | /// 27 | /// The arguments. 28 | /// Web host builder. 29 | public static IWebHostBuilder CreateWebHostBuilder(string[] args) => 30 | WebHost.CreateDefaultBuilder(args) 31 | .UseStartup(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Builder.Teams/TeamsContext.IncomingChannelAccount.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Teams.Internal 6 | { 7 | using System; 8 | using Microsoft.Bot.Schema; 9 | using Microsoft.Bot.Schema.Teams; 10 | 11 | /// 12 | /// Channel account operations. 13 | /// 14 | public partial class TeamsContext 15 | { 16 | /// 17 | /// Gets teams channel account data. 18 | /// 19 | /// Converts into . 20 | /// Teams channel account data. 21 | public TeamsChannelAccount AsTeamsChannelAccount(ChannelAccount channelAccount) 22 | { 23 | if (channelAccount == null) 24 | { 25 | throw new ArgumentNullException(nameof(channelAccount)); 26 | } 27 | 28 | return channelAccount.AsJObject().ToObject(); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.MessagingExtensionBot/Program.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Teams.MessagingExtensionBot 6 | { 7 | using Microsoft.AspNetCore; 8 | using Microsoft.AspNetCore.Hosting; 9 | 10 | /// 11 | /// Start up class for the application. 12 | /// 13 | public class Program 14 | { 15 | /// 16 | /// Defines the entry point of the application. 17 | /// 18 | /// The arguments. 19 | public static void Main(string[] args) 20 | { 21 | CreateWebHostBuilder(args).Build().Run(); 22 | } 23 | 24 | /// 25 | /// Creates the web host builder. 26 | /// 27 | /// The arguments. 28 | /// Web host builder. 29 | public static IWebHostBuilder CreateWebHostBuilder(string[] args) => 30 | WebHost.CreateDefaultBuilder(args) 31 | .UseStartup(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.WikipediaMessagingExtension/Program.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Teams.WikipediaMessagingExtension 6 | { 7 | using Microsoft.AspNetCore; 8 | using Microsoft.AspNetCore.Hosting; 9 | 10 | /// 11 | /// Start up class for the application. 12 | /// 13 | public class Program 14 | { 15 | /// 16 | /// Defines the entry point of the application. 17 | /// 18 | /// The arguments. 19 | public static void Main(string[] args) 20 | { 21 | CreateWebHostBuilder(args).Build().Run(); 22 | } 23 | 24 | /// 25 | /// Creates the web host builder. 26 | /// 27 | /// The arguments. 28 | /// Web host builder. 29 | public static IWebHostBuilder CreateWebHostBuilder(string[] args) => 30 | WebHost.CreateDefaultBuilder(args) 31 | .UseStartup(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE 22 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.FileBot/TeamsAppManifest/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.3/MicrosoftTeams.schema.json", 3 | "manifestVersion": "1.3", 4 | "version": "1.0", 5 | "id": "--YOURAPPIDHERE--", 6 | "packageName": "com.microsoft.teams.samples.v4bot", 7 | "developer": { 8 | "name": "Microsoft Corp", 9 | "websiteUrl": "https://example.azurewebsites.net", 10 | "privacyUrl": "https://example.azurewebsites.net/privacy", 11 | "termsOfUseUrl": "https://example.azurewebsites.net/termsofuse" 12 | }, 13 | "name": { 14 | "short": "V4 Sample", 15 | "full": "Microsoft Teams V4 Sample Bot" 16 | }, 17 | "description": { 18 | "short": "Sample bot using V4 SDK to demo bot file features", 19 | "full": "Sample bot using V4 Bot Builder SDK and V4 Microsoft Teams Extension SDK to demo bot file features" 20 | }, 21 | "icons": { 22 | "outline": "icon-outline.png", 23 | "color": "icon-color.png" 24 | }, 25 | "accentColor": "#abcdef", 26 | "bots": [ 27 | { 28 | "botId": "--YOURBOTIDHERE--", 29 | "scopes": [ 30 | "personal", 31 | "team" 32 | ], 33 | "supportsFiles": true 34 | } 35 | ], 36 | "validDomains": [ 37 | "*.azurewebsites.net" 38 | ] 39 | } -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.TeamEchoBot/ReadMe.md: -------------------------------------------------------------------------------- 1 | ### Microsoft.Bot.Builder.Teams.TeamsEchoBot 2 | 3 | This sample showcases a basic bot which access TeamsExtensions. 4 | 5 | ##### Setup 6 | ###### WebApiConfig.cs 7 | Startup.cs sets up the bot. Since this bot only works in Channels in Microsoft Teams, we will be adding following 3 middlewares 8 | - **DropNonTeamsActivitiesMiddleware** - To drop all activities not coming from Microsoft Teams 9 | - **TeamsMiddleware** - To access Microsoft Teams's constructs 10 | 11 | To store turn count we are adding storage. Additionally since we want one counter to be maintained for the whole team, we are adding a conversation state handler which understands the whole Team as once single conversation. 12 | 13 | ```cs 14 | IStorage dataStore = new MemoryStorage(); 15 | 16 | // --> Adding conversation state handler which understands a team as single conversation. 17 | options.State.Add(new TeamSpecificConversationState(dataStore)); 18 | ``` 19 | 20 | ##### Code execution 21 | ###### EchoBot 22 | For every message sent, EchoBot stores a turn counter. Every message will show the number of messages received from a particular chat or team. 23 | 24 | #### How to test 25 | Use the [sample manifest](TeamsAppManifest/manifest.json) and change the botId at --YOURBOTIDHERE-- and use your bot Id. -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.AuditBot/TeamsAppManifest/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.7/MicrosoftTeams.schema.json", 3 | "manifestVersion": "1.7", 4 | "version": "1.0.0", 5 | "id": "61be556c-3f62-489d-ae2b-e8408f020824", 6 | "packageName": "com.teams.samples.auditbot", 7 | "developer": { 8 | "name": "TeamsAuditBot", 9 | "websiteUrl": "https://www.microsoft.com", 10 | "privacyUrl": "https://www.teams.com/privacy", 11 | "termsOfUseUrl": "https://www.teams.com/termsofuse" 12 | }, 13 | "icons": { 14 | "color": "color.png", 15 | "outline": "outline.png" 16 | }, 17 | "name": { 18 | "short": "AuditBot", 19 | "full": "AuditBot" 20 | }, 21 | "description": { 22 | "short": "Audit bot for Team", 23 | "full": "Audits events in Team" 24 | }, 25 | "accentColor": "#FFFFFF", 26 | "bots": [ 27 | { 28 | "botId": "--YOURBOTIDHERE--", 29 | "scopes": [ 30 | "team" 31 | ], 32 | "supportsFiles": false, 33 | "isNotificationOnly": false 34 | } 35 | ], 36 | "permissions": [ 37 | "identity", 38 | "messageTeamMembers" 39 | ], 40 | "validDomains": [] 41 | } 42 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.AuditBot.AspNet/TeamsAppManifest/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.7/MicrosoftTeams.schema.json", 3 | "manifestVersion": "1.7", 4 | "version": "1.0.0", 5 | "id": "61be556c-3f62-489d-ae2b-e8408f020824", 6 | "packageName": "com.teams.samples.auditbot", 7 | "developer": { 8 | "name": "TeamsAuditBot", 9 | "websiteUrl": "https://www.microsoft.com", 10 | "privacyUrl": "https://www.teams.com/privacy", 11 | "termsOfUseUrl": "https://www.teams.com/termsofuse" 12 | }, 13 | "icons": { 14 | "color": "color.png", 15 | "outline": "outline.png" 16 | }, 17 | "name": { 18 | "short": "AuditBot", 19 | "full": "AuditBot" 20 | }, 21 | "description": { 22 | "short": "Audit bot for Team", 23 | "full": "Audits events in Team" 24 | }, 25 | "accentColor": "#FFFFFF", 26 | "bots": [ 27 | { 28 | "botId": "--YOURBOTIDHERE--", 29 | "scopes": [ 30 | "team" 31 | ], 32 | "supportsFiles": false, 33 | "isNotificationOnly": false 34 | } 35 | ], 36 | "permissions": [ 37 | "identity", 38 | "messageTeamMembers" 39 | ], 40 | "validDomains": [] 41 | } 42 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.RemindMeBot/TeamsAppManifest/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.7/MicrosoftTeams.schema.json", 3 | "manifestVersion": "1.7", 4 | "version": "1.0.0", 5 | "id": "172b9393-0bf7-4bcf-807d-ce0f189d3e17", 6 | "packageName": "com.teams.samples.remindme", 7 | "developer": { 8 | "name": "RemindMeBotSample", 9 | "websiteUrl": "https://www.microsoft.com", 10 | "privacyUrl": "https://www.teams.com/privacy", 11 | "termsOfUseUrl": "https://www.teams.com/termsofuse" 12 | }, 13 | "icons": { 14 | "color": "color.png", 15 | "outline": "outline.png" 16 | }, 17 | "name": { 18 | "short": "RemindMeBot", 19 | "full": "RemindMeBot" 20 | }, 21 | "description": { 22 | "short": "Sends reminders", 23 | "full": "Sends reminders" 24 | }, 25 | "accentColor": "#FFFFFF", 26 | "bots": [ 27 | { 28 | "botId": "--YOURBOTIDHERE--", 29 | "scopes": [ 30 | "personal" 31 | ], 32 | "supportsFiles": false, 33 | "isNotificationOnly": false 34 | } 35 | ], 36 | "permissions": [ 37 | "identity", 38 | "messageTeamMembers" 39 | ], 40 | "validDomains": [] 41 | } 42 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.TeamEchoBot/TeamsAppManifest/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.7/MicrosoftTeams.schema.json", 3 | "manifestVersion": "1.7", 4 | "version": "1.0.0", 5 | "id": "1a5509bb-7e2f-406e-8106-909ca92a8325", 6 | "packageName": "com.teams.sample.echobot", 7 | "developer": { 8 | "name": "TeamsEchoBot", 9 | "websiteUrl": "https://www.microsoft.com", 10 | "privacyUrl": "https://www.teams.com/privacy", 11 | "termsOfUseUrl": "https://www.teams.com/termsofuser" 12 | }, 13 | "icons": { 14 | "color": "color.png", 15 | "outline": "outline.png" 16 | }, 17 | "name": { 18 | "short": "TeamsEcho", 19 | "full": "TeamsEcho" 20 | }, 21 | "description": { 22 | "short": "Echoes what you say", 23 | "full": "Echoes what you say" 24 | }, 25 | "accentColor": "#FFFFFF", 26 | "bots": [ 27 | { 28 | "botId": "1a5509bb-7e2f-406e-8106-909ca92a8325", 29 | "scopes": [ 30 | "personal", 31 | "team" 32 | ], 33 | "supportsFiles": false, 34 | "isNotificationOnly": false 35 | } 36 | ], 37 | "permissions": [ 38 | "identity", 39 | "messageTeamMembers" 40 | ], 41 | "validDomains": [] 42 | } 43 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.WikipediaMessagingExtension/TeamsAppManifest/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.7/MicrosoftTeams.schema.json", 3 | "manifestVersion": "1.7", 4 | "version": "1.0.0", 5 | "id": "b60496b1-2740-4c49-9759-3ae72b060dfe", 6 | "packageName": "com.teams.samples.wikipedia", 7 | "developer": { 8 | "name": "TeamsSamples", 9 | "websiteUrl": "https://github.com/OfficeDev/BotBuilder-MicrosoftTeams-dotnet", 10 | "privacyUrl": "https://www.teams.com/privacy", 11 | "termsOfUseUrl": "https://www.teams.com/teamsofuser" 12 | }, 13 | "icons": { 14 | "color": "color.png", 15 | "outline": "outline.png" 16 | }, 17 | "name": { 18 | "short": "Wikipedia", 19 | "full": "WikipediaMessagingExtensionSample" 20 | }, 21 | "description": { 22 | "short": "Wikipedia Messaging Extension", 23 | "full": "Wikipedia Messaging Extension to search Wikipedia" 24 | }, 25 | "accentColor": "#FFFFFF", 26 | "composeExtensions": [ 27 | { 28 | "botId": "--YOURBOTIDHERE--", 29 | "canUpdateConfiguration": true, 30 | "commands": [] 31 | } 32 | ], 33 | "permissions": [ 34 | "identity", 35 | "messageTeamMembers" 36 | ], 37 | "validDomains": [] 38 | } 39 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.AuditBot.AspNet/Web.Debug.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Builder.Teams/Middlewares/DropChannelActivitiesMiddleware.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Teams.Middlewares 6 | { 7 | using System.Threading; 8 | using System.Threading.Tasks; 9 | using Microsoft.Bot.Schema.Teams; 10 | 11 | /// 12 | /// Automatically drops all messages from channels. 13 | /// 14 | /// 15 | public class DropChannelActivitiesMiddleware : IMiddleware 16 | { 17 | /// 18 | /// Called in the activity processing pipeline to process incoming activity. 19 | /// 20 | /// The context. 21 | /// The next delegate to execute. 22 | /// The cancellation token. 23 | /// Task tracking operation. 24 | public async Task OnTurnAsync(ITurnContext context, NextDelegate next, CancellationToken cancellationToken = default(CancellationToken)) 25 | { 26 | TeamsChannelData teamsChannelData = context.Activity.GetChannelData(); 27 | 28 | if (teamsChannelData.Team == null) 29 | { 30 | await next(cancellationToken).ConfigureAwait(false); 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Builder.Teams/Middlewares/DropChatActivitiesMiddleware.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Teams.Middlewares 6 | { 7 | using System.Threading; 8 | using System.Threading.Tasks; 9 | using Microsoft.Bot.Schema.Teams; 10 | 11 | /// 12 | /// Automatically drops all one on one and group chat messages. 13 | /// 14 | /// 15 | public class DropChatActivitiesMiddleware : IMiddleware 16 | { 17 | /// 18 | /// Called in the activity processing pipeline to process incoming activity. 19 | /// 20 | /// The context. 21 | /// The next delegate to execute. 22 | /// The cancellation token. 23 | /// Task tracking operation. 24 | public async Task OnTurnAsync(ITurnContext context, NextDelegate next, CancellationToken cancellationToken = default(CancellationToken)) 25 | { 26 | TeamsChannelData teamsChannelData = context.Activity.GetChannelData(); 27 | 28 | if (!string.IsNullOrEmpty(teamsChannelData.Team?.Id)) 29 | { 30 | await next(cancellationToken).ConfigureAwait(false); 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.AuditBot.AspNet/Web.Release.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Abstractions/Microsoft.Bot.Builder.Abstractions.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | $([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Microsoft.Bot.Builder.Teams.sln))\Build\Analyzer.ruleset 9 | bin\$(Configuration)\$(Platform)\$(AssemblyName).xml 10 | Full 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | all 21 | runtime; build; native; contentfiles; analyzers 22 | 23 | 24 | 25 | all 26 | runtime; build; native; contentfiles; analyzers 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /CSharp/UnitTests/Microsoft.Bot.Builder.Teams.Tests/Jsons/SampleActivityAtMention.json: -------------------------------------------------------------------------------- 1 | { 2 | "text": "Test Message", 3 | "textFormat": "plain", 4 | "attachments": [ 5 | { 6 | "contentType": "text/html", 7 | "content": "
TestBot Test Message
" 8 | } 9 | ], 10 | "type": "message", 11 | "timestamp": "2017-03-31T00:12:59.893Z", 12 | "id": "1400900100700", 13 | "channelId": "msteams", 14 | "serviceUrl": "https://smba.trafficmanager.net/amer-client-ss.msg/", 15 | "from": { 16 | "id": "29:SAMPLEID", 17 | "name": "SAMPLE USER" 18 | }, 19 | "conversation": { 20 | "isGroup": true, 21 | "id": "19:ThreadID@thread.skype;messageid=1400900100700" 22 | }, 23 | "recipient": { 24 | "id": "28:f7c72d1a-9892-42b7-8fe0-6fb6e7c85851", 25 | "name": "TestBot" 26 | }, 27 | "entities": [ 28 | { 29 | "mentioned": { 30 | "id": "28:f7c72d1a-9892-42b7-8fe0-6fb6e7c85851", 31 | "name": "TestBot" 32 | }, 33 | "text": "TestBot", 34 | "type": "mention" 35 | }, 36 | { 37 | "locale": "en-US", 38 | "country": "US", 39 | "platform": "Windows", 40 | "type": "clientInfo" 41 | } 42 | ], 43 | "channelData": { 44 | "channel": { 45 | "id": "19:ThreadID@thread.skype" 46 | }, 47 | "team": { 48 | "id": "19:ThreadID@thread.skype" 49 | }, 50 | "tenant": { 51 | "id": "3b9e9fbb-ed2f-415b-b776-cf788e573366" 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Schema.Teams/TaskModuleAction.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Schema.Teams 6 | { 7 | using AdaptiveCards; 8 | using Newtonsoft.Json; 9 | using Newtonsoft.Json.Linq; 10 | 11 | /// 12 | /// Adapter class to represent BotBuilder card action as adaptive card action (in type of Action.Submit). 13 | /// 14 | public class TaskModuleAction : CardAction 15 | { 16 | /// 17 | /// Initializes a new instance of the class. 18 | /// 19 | /// Button title 20 | /// Free hidden value binding with button. The value will be sent out with "task/fetch" invoke event. 21 | public TaskModuleAction(string title, object value) 22 | : base("invoke", title) 23 | { 24 | JsonSerializerSettings serializerSettings = new JsonSerializerSettings(); 25 | serializerSettings.NullValueHandling = NullValueHandling.Ignore; 26 | 27 | JToken data; 28 | if (value is string) 29 | { 30 | data = JObject.Parse(value as string); 31 | } 32 | else 33 | { 34 | data = JObject.FromObject(value, JsonSerializer.Create(serializerSettings)); 35 | } 36 | 37 | data["type"] = "task/fetch"; 38 | this.Value = data.ToString(); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Schema.Teams/Generated/TaskModuleRequestContext.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // Licensed under the MIT License. See License.txt in the project root for 4 | // license information. 5 | // 6 | // Code generated by Microsoft (R) AutoRest Code Generator. 7 | // Changes may cause incorrect behavior and will be lost if the code is 8 | // regenerated. 9 | // 10 | 11 | namespace Microsoft.Bot.Schema.Teams 12 | { 13 | using Newtonsoft.Json; 14 | using System.Linq; 15 | 16 | /// 17 | /// Current user context, i.e., the current theme 18 | /// 19 | public partial class TaskModuleRequestContext 20 | { 21 | /// 22 | /// Initializes a new instance of the TaskModuleRequestContext class. 23 | /// 24 | public TaskModuleRequestContext() 25 | { 26 | CustomInit(); 27 | } 28 | 29 | /// 30 | /// Initializes a new instance of the TaskModuleRequestContext class. 31 | /// 32 | public TaskModuleRequestContext(string theme = default(string)) 33 | { 34 | Theme = theme; 35 | CustomInit(); 36 | } 37 | 38 | /// 39 | /// An initialization method that performs custom operations like setting defaults 40 | /// 41 | partial void CustomInit(); 42 | 43 | /// 44 | /// 45 | [JsonProperty(PropertyName = "theme")] 46 | public string Theme { get; set; } 47 | 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Schema.Teams/Generated/TenantInfo.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // Licensed under the MIT License. See License.txt in the project root for 4 | // license information. 5 | // 6 | // Code generated by Microsoft (R) AutoRest Code Generator. 7 | // Changes may cause incorrect behavior and will be lost if the code is 8 | // regenerated. 9 | // 10 | 11 | namespace Microsoft.Bot.Schema.Teams 12 | { 13 | using Newtonsoft.Json; 14 | using System.Linq; 15 | 16 | /// 17 | /// Describes a tenant 18 | /// 19 | public partial class TenantInfo 20 | { 21 | /// 22 | /// Initializes a new instance of the TenantInfo class. 23 | /// 24 | public TenantInfo() 25 | { 26 | CustomInit(); 27 | } 28 | 29 | /// 30 | /// Initializes a new instance of the TenantInfo class. 31 | /// 32 | /// Unique identifier representing a tenant 33 | public TenantInfo(string id = default(string)) 34 | { 35 | Id = id; 36 | CustomInit(); 37 | } 38 | 39 | /// 40 | /// An initialization method that performs custom operations like setting defaults 41 | /// 42 | partial void CustomInit(); 43 | 44 | /// 45 | /// Gets or sets unique identifier representing a tenant 46 | /// 47 | [JsonProperty(PropertyName = "id")] 48 | public string Id { get; set; } 49 | 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.RemindMeBot/ReadMe.md: -------------------------------------------------------------------------------- 1 | ### Microsoft.Bot.Builder.Teams.RemindMeBot 2 | 3 | This sample show cases how to proactively create conversation and send messages to them. 4 | 5 | ##### Setup 6 | ###### Startup.cs 7 | Startup.cs sets up the bot. Since this bot only works in Channels in Microsoft Teams, we will be adding following 3 middlewares 8 | - **DropNonTeamsActivitiesMiddleware** - To drop all activities not coming from Microsoft Teams 9 | - **DropChannelActivitiesMiddleware** - To drop all messages coming from 1on1 and Group Chats 10 | 11 | To process incoming text we have added a custom text recognizer ```ReminderTextRecognizer``` 12 | ```cs 13 | services.AddTransient(); 14 | ``` 15 | 16 | We also have registered a class to handle proactive scenarios for us. 17 | 18 | ```cs 19 | services.AddTransient(); 20 | ``` 21 | 22 | ##### Code execution 23 | ###### RemindMeBot 24 | Calls into ```IRecognizer``` to get back intents sent by the user and then calls into I```ProactiveMessageManager``` instance to queue a work item which will be executed at a later point. 25 | 26 | ###### ProactiveMessageManager 27 | Queues a work item, once the timer expires creates a conversation and then send message to it. Since we are already in the context of the same message, we don't need to store the ```botId``` which received the message. For scenarios where messages are sent after a long time ```botId``` might need to be persisted. 28 | 29 | #### How to test 30 | Use the [sample manifest](TeamsAppManifest/manifest.json) and change the botId at --YOURBOTIDHERE-- and use your bot Id. -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.AuditBot.AspNet/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | using System.Reflection; 6 | using System.Runtime.InteropServices; 7 | 8 | // General Information about an assembly is controlled through the following 9 | // set of attributes. Change these attribute values to modify the information 10 | // associated with an assembly. 11 | [assembly: AssemblyTitle("Microsoft.Bot.Builder.Teams.AuditBot.AspNet")] 12 | [assembly: AssemblyDescription("")] 13 | [assembly: AssemblyConfiguration("")] 14 | [assembly: AssemblyCompany("")] 15 | [assembly: AssemblyProduct("Microsoft.Bot.Builder.Teams.AuditBot.AspNet")] 16 | [assembly: AssemblyCopyright("Copyright © 2018")] 17 | [assembly: AssemblyTrademark("")] 18 | [assembly: AssemblyCulture("")] 19 | 20 | // Setting ComVisible to false makes the types in this assembly not visible 21 | // to COM components. If you need to access a type in this assembly from 22 | // COM, set the ComVisible attribute to true on that type. 23 | [assembly: ComVisible(false)] 24 | 25 | // The following GUID is for the ID of the typelib if this project is exposed to COM 26 | [assembly: Guid("732f6086-455e-41ff-9187-c030c70a1ec4")] 27 | 28 | // Version information for an assembly consists of the following four values: 29 | // 30 | // Major Version 31 | // Minor Version 32 | // Build Number 33 | // Revision 34 | // 35 | // You can specify all the values or you can default the Revision and Build Numbers 36 | // by using the '*' as shown below: 37 | [assembly: AssemblyVersion("1.0.0.0")] 38 | [assembly: AssemblyFileVersion("1.0.0.0")] 39 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Schema.Teams/Generated/AppBasedLinkQuery.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // Licensed under the MIT License. See License.txt in the project root for 4 | // license information. 5 | // 6 | // Code generated by Microsoft (R) AutoRest Code Generator. 7 | // Changes may cause incorrect behavior and will be lost if the code is 8 | // regenerated. 9 | // 10 | 11 | namespace Microsoft.Bot.Schema.Teams 12 | { 13 | using Newtonsoft.Json; 14 | using System.Linq; 15 | 16 | /// 17 | /// Invoke request body type for app-based link query. 18 | /// 19 | public partial class AppBasedLinkQuery 20 | { 21 | /// 22 | /// Initializes a new instance of the AppBasedLinkQuery class. 23 | /// 24 | public AppBasedLinkQuery() 25 | { 26 | CustomInit(); 27 | } 28 | 29 | /// 30 | /// Initializes a new instance of the AppBasedLinkQuery class. 31 | /// 32 | /// Url queried by user 33 | public AppBasedLinkQuery(string url = default(string)) 34 | { 35 | Url = url; 36 | CustomInit(); 37 | } 38 | 39 | /// 40 | /// An initialization method that performs custom operations like setting defaults 41 | /// 42 | partial void CustomInit(); 43 | 44 | /// 45 | /// Gets or sets url queried by user 46 | /// 47 | [JsonProperty(PropertyName = "url")] 48 | public string Url { get; set; } 49 | 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Schema.Teams/Generated/ConversationList.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // Licensed under the MIT License. See License.txt in the project root for 4 | // license information. 5 | // 6 | // Code generated by Microsoft (R) AutoRest Code Generator. 7 | // Changes may cause incorrect behavior and will be lost if the code is 8 | // regenerated. 9 | // 10 | 11 | namespace Microsoft.Bot.Schema.Teams 12 | { 13 | using Newtonsoft.Json; 14 | using System.Collections; 15 | using System.Collections.Generic; 16 | using System.Linq; 17 | 18 | /// 19 | /// List of channels under a team 20 | /// 21 | public partial class ConversationList 22 | { 23 | /// 24 | /// Initializes a new instance of the ConversationList class. 25 | /// 26 | public ConversationList() 27 | { 28 | CustomInit(); 29 | } 30 | 31 | /// 32 | /// Initializes a new instance of the ConversationList class. 33 | /// 34 | public ConversationList(IList conversations = default(IList)) 35 | { 36 | Conversations = conversations; 37 | CustomInit(); 38 | } 39 | 40 | /// 41 | /// An initialization method that performs custom operations like setting defaults 42 | /// 43 | partial void CustomInit(); 44 | 45 | /// 46 | /// 47 | [JsonProperty(PropertyName = "conversations")] 48 | public IList Conversations { get; set; } 49 | 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Schema.Teams/Generated/MessagingExtensionResponse.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // Licensed under the MIT License. See License.txt in the project root for 4 | // license information. 5 | // 6 | // Code generated by Microsoft (R) AutoRest Code Generator. 7 | // Changes may cause incorrect behavior and will be lost if the code is 8 | // regenerated. 9 | // 10 | 11 | namespace Microsoft.Bot.Schema.Teams 12 | { 13 | using Newtonsoft.Json; 14 | using System.Linq; 15 | 16 | /// 17 | /// Messaging extension response 18 | /// 19 | public partial class MessagingExtensionResponse 20 | { 21 | /// 22 | /// Initializes a new instance of the MessagingExtensionResponse class. 23 | /// 24 | public MessagingExtensionResponse() 25 | { 26 | CustomInit(); 27 | } 28 | 29 | /// 30 | /// Initializes a new instance of the MessagingExtensionResponse class. 31 | /// 32 | public MessagingExtensionResponse(MessagingExtensionResult composeExtension = default(MessagingExtensionResult)) 33 | { 34 | ComposeExtension = composeExtension; 35 | CustomInit(); 36 | } 37 | 38 | /// 39 | /// An initialization method that performs custom operations like setting defaults 40 | /// 41 | partial void CustomInit(); 42 | 43 | /// 44 | /// 45 | [JsonProperty(PropertyName = "composeExtension")] 46 | public MessagingExtensionResult ComposeExtension { get; set; } 47 | 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Abstractions.Teams/Microsoft.Bot.Builder.Abstractions.Teams.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | $([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Microsoft.Bot.Builder.Teams.sln))\Build\Analyzer.ruleset 9 | bin\$(Configuration)\$(Platform)\$(AssemblyName).xml 10 | Full 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | all 20 | runtime; build; native; contentfiles; analyzers 21 | 22 | 23 | all 24 | runtime; build; native; contentfiles; analyzers 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Schema.Teams/AttachmentExtensions.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Schema.Teams 6 | { 7 | using Microsoft.Bot.Schema; 8 | using Newtonsoft.Json.Linq; 9 | 10 | /// 11 | /// Attachment extensions. 12 | /// 13 | public static class AttachmentExtensions 14 | { 15 | /// 16 | /// Converts normal attachment into the messaging extension attachment. 17 | /// 18 | /// The attachment. 19 | /// The preview attachment. 20 | /// Messaging extension attachment. 21 | public static MessagingExtensionAttachment ToMessagingExtensionAttachment(this Attachment attachment, Attachment previewAttachment = null) 22 | { 23 | // We are recreating the attachment so that JsonSerializerSettings with ReferenceLoopHandling set to Error does not generate error 24 | // while serializing. Refer to issue - https://github.com/OfficeDev/BotBuilder-MicrosoftTeams/issues/52. 25 | return new MessagingExtensionAttachment 26 | { 27 | Content = attachment.Content, 28 | ContentType = attachment.ContentType, 29 | ContentUrl = attachment.ContentUrl, 30 | Name = attachment.Name, 31 | ThumbnailUrl = attachment.ThumbnailUrl, 32 | Preview = previewAttachment == null ? 33 | JObject.FromObject(attachment).ToObject() : 34 | previewAttachment, 35 | }; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.TeamEchoBot/Microsoft.Bot.Builder.Teams.TeamEchoBot.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.1 5 | 6 | 7 | 8 | $([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Microsoft.Bot.Builder.Teams.sln))\Build\Analyzer.ruleset 9 | bin\$(Configuration)\$(Platform)\$(AssemblyName).xml 10 | Full 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | all 24 | runtime; build; native; contentfiles; analyzers 25 | 26 | 27 | 28 | 29 | all 30 | runtime; build; native; contentfiles; analyzers 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Schema.Teams/Generated/NotificationInfo.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // Licensed under the MIT License. See License.txt in the project root for 4 | // license information. 5 | // 6 | // Code generated by Microsoft (R) AutoRest Code Generator. 7 | // Changes may cause incorrect behavior and will be lost if the code is 8 | // regenerated. 9 | // 10 | 11 | namespace Microsoft.Bot.Schema.Teams 12 | { 13 | using Newtonsoft.Json; 14 | using System.Linq; 15 | 16 | /// 17 | /// Specifies if a notification is to be sent for the mentions. 18 | /// 19 | public partial class NotificationInfo 20 | { 21 | /// 22 | /// Initializes a new instance of the NotificationInfo class. 23 | /// 24 | public NotificationInfo() 25 | { 26 | CustomInit(); 27 | } 28 | 29 | /// 30 | /// Initializes a new instance of the NotificationInfo class. 31 | /// 32 | /// true if notification is to be sent to the user, 33 | /// false otherwise. 34 | public NotificationInfo(bool? alert = default(bool?)) 35 | { 36 | Alert = alert; 37 | CustomInit(); 38 | } 39 | 40 | /// 41 | /// An initialization method that performs custom operations like setting defaults 42 | /// 43 | partial void CustomInit(); 44 | 45 | /// 46 | /// Gets or sets true if notification is to be sent to the user, false 47 | /// otherwise. 48 | /// 49 | [JsonProperty(PropertyName = "alert")] 50 | public bool? Alert { get; set; } 51 | 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Builder.Teams/TeamsContext.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Teams.Internal 6 | { 7 | using Microsoft.Bot.Connector.Teams; 8 | 9 | /// 10 | /// Teams extension class. 11 | /// 12 | public partial class TeamsContext : ITeamsContext 13 | { 14 | /// 15 | /// Turn context created by adapter and sent over through middlewares. 16 | /// 17 | private readonly ITurnContext turnContext; 18 | 19 | /// 20 | /// Teams connector client instance. This is used to make calls to BotFramework APIs which are only supported by MsTeams. 21 | /// 22 | private readonly ITeamsConnectorClient teamsConnectorClient; 23 | 24 | /// 25 | /// Initializes a new instance of the class. 26 | /// 27 | /// Turn context created by adapter and sent over through middlewares. 28 | /// Teams connector client instance. 29 | internal TeamsContext(ITurnContext turnContext, ITeamsConnectorClient teamsConnectorClient) 30 | { 31 | this.turnContext = turnContext; 32 | this.teamsConnectorClient = teamsConnectorClient; 33 | } 34 | 35 | /// 36 | /// Gets the teams operations. These are extended set of operations available only for 'MsTeams' channel. 37 | /// 38 | public ITeamsOperations Operations 39 | { 40 | get 41 | { 42 | return this.teamsConnectorClient.Teams; 43 | } 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Schema.Teams/Generated/TaskModuleResponse.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // Licensed under the MIT License. See License.txt in the project root for 4 | // license information. 5 | // 6 | // Code generated by Microsoft (R) AutoRest Code Generator. 7 | // Changes may cause incorrect behavior and will be lost if the code is 8 | // regenerated. 9 | // 10 | 11 | namespace Microsoft.Bot.Schema.Teams 12 | { 13 | using Newtonsoft.Json; 14 | using System.Linq; 15 | 16 | /// 17 | /// Envelope for Task Module Response. 18 | /// 19 | public partial class TaskModuleResponse 20 | { 21 | /// 22 | /// Initializes a new instance of the TaskModuleResponse class. 23 | /// 24 | public TaskModuleResponse() 25 | { 26 | CustomInit(); 27 | } 28 | 29 | /// 30 | /// Initializes a new instance of the TaskModuleResponse class. 31 | /// 32 | /// The JSON for the Adaptive card to appear in the 33 | /// task module. 34 | public TaskModuleResponse(TaskModuleResponseBase task = default(TaskModuleResponseBase)) 35 | { 36 | Task = task; 37 | CustomInit(); 38 | } 39 | 40 | /// 41 | /// An initialization method that performs custom operations like setting defaults 42 | /// 43 | partial void CustomInit(); 44 | 45 | /// 46 | /// Gets or sets the JSON for the Adaptive card to appear in the task 47 | /// module. 48 | /// 49 | [JsonProperty(PropertyName = "task")] 50 | public TaskModuleResponseBase Task { get; set; } 51 | 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Schema.Teams/Generated/MessagingExtensionSuggestedAction.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // Licensed under the MIT License. See License.txt in the project root for 4 | // license information. 5 | // 6 | // Code generated by Microsoft (R) AutoRest Code Generator. 7 | // Changes may cause incorrect behavior and will be lost if the code is 8 | // regenerated. 9 | // 10 | 11 | namespace Microsoft.Bot.Schema.Teams 12 | { 13 | using Newtonsoft.Json; 14 | using System.Collections; 15 | using System.Collections.Generic; 16 | using System.Linq; 17 | 18 | /// 19 | /// Messaging extension Actions (Only when type is auth or config) 20 | /// 21 | public partial class MessagingExtensionSuggestedAction 22 | { 23 | /// 24 | /// Initializes a new instance of the MessagingExtensionSuggestedAction 25 | /// class. 26 | /// 27 | public MessagingExtensionSuggestedAction() 28 | { 29 | CustomInit(); 30 | } 31 | 32 | /// 33 | /// Initializes a new instance of the MessagingExtensionSuggestedAction 34 | /// class. 35 | /// 36 | /// Actions 37 | public MessagingExtensionSuggestedAction(IList actions = default(IList)) 38 | { 39 | Actions = actions; 40 | CustomInit(); 41 | } 42 | 43 | /// 44 | /// An initialization method that performs custom operations like setting defaults 45 | /// 46 | partial void CustomInit(); 47 | 48 | /// 49 | /// Gets or sets actions 50 | /// 51 | [JsonProperty(PropertyName = "actions")] 52 | public IList Actions { get; set; } 53 | 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Schema.Teams/Generated/TeamInfo.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // Licensed under the MIT License. See License.txt in the project root for 4 | // license information. 5 | // 6 | // Code generated by Microsoft (R) AutoRest Code Generator. 7 | // Changes may cause incorrect behavior and will be lost if the code is 8 | // regenerated. 9 | // 10 | 11 | namespace Microsoft.Bot.Schema.Teams 12 | { 13 | using Newtonsoft.Json; 14 | using System.Linq; 15 | 16 | /// 17 | /// Describes a team 18 | /// 19 | public partial class TeamInfo 20 | { 21 | /// 22 | /// Initializes a new instance of the TeamInfo class. 23 | /// 24 | public TeamInfo() 25 | { 26 | CustomInit(); 27 | } 28 | 29 | /// 30 | /// Initializes a new instance of the TeamInfo class. 31 | /// 32 | /// Unique identifier representing a team 33 | /// Name of team. 34 | public TeamInfo(string id = default(string), string name = default(string)) 35 | { 36 | Id = id; 37 | Name = name; 38 | CustomInit(); 39 | } 40 | 41 | /// 42 | /// An initialization method that performs custom operations like setting defaults 43 | /// 44 | partial void CustomInit(); 45 | 46 | /// 47 | /// Gets or sets unique identifier representing a team 48 | /// 49 | [JsonProperty(PropertyName = "id")] 50 | public string Id { get; set; } 51 | 52 | /// 53 | /// Gets or sets name of team. 54 | /// 55 | [JsonProperty(PropertyName = "name")] 56 | public string Name { get; set; } 57 | 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Schema.Teams/Generated/TaskModuleResponseBase.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // Licensed under the MIT License. See License.txt in the project root for 4 | // license information. 5 | // 6 | // Code generated by Microsoft (R) AutoRest Code Generator. 7 | // Changes may cause incorrect behavior and will be lost if the code is 8 | // regenerated. 9 | // 10 | 11 | namespace Microsoft.Bot.Schema.Teams 12 | { 13 | using Newtonsoft.Json; 14 | using System.Linq; 15 | 16 | /// 17 | /// Base class for Task Module responses 18 | /// 19 | public partial class TaskModuleResponseBase 20 | { 21 | /// 22 | /// Initializes a new instance of the TaskModuleResponseBase class. 23 | /// 24 | public TaskModuleResponseBase() 25 | { 26 | CustomInit(); 27 | } 28 | 29 | /// 30 | /// Initializes a new instance of the TaskModuleResponseBase class. 31 | /// 32 | /// Choice of action options when responding to the 33 | /// task/submit message. Possible values include: 'message', 34 | /// 'continue' 35 | public TaskModuleResponseBase(string type = default(string)) 36 | { 37 | Type = type; 38 | CustomInit(); 39 | } 40 | 41 | /// 42 | /// An initialization method that performs custom operations like setting defaults 43 | /// 44 | partial void CustomInit(); 45 | 46 | /// 47 | /// Gets or sets choice of action options when responding to the 48 | /// task/submit message. Possible values include: 'message', 'continue' 49 | /// 50 | [JsonProperty(PropertyName = "type")] 51 | public string Type { get; set; } 52 | 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /CSharp/UnitTests/Microsoft.Bot.Builder.Teams.Tests/TestDelegatingHandler.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Teams.Tests 6 | { 7 | using System; 8 | using System.Net.Http; 9 | using System.Threading; 10 | using System.Threading.Tasks; 11 | 12 | /// 13 | /// Test delegating handler. 14 | /// 15 | public class TestDelegatingHandler : DelegatingHandler 16 | { 17 | /// 18 | /// The send function to be executed on request. 19 | /// 20 | private Func> sendFunc; 21 | 22 | /// 23 | /// Initializes a new instance of the class. 24 | /// 25 | /// Function to be executed when request is made. 26 | public TestDelegatingHandler(Func> sendAsyncFunc) 27 | { 28 | this.sendFunc = sendAsyncFunc; 29 | } 30 | 31 | /// 32 | /// Sends an HTTP request to the inner handler to send to the server as an asynchronous operation. 33 | /// 34 | /// The HTTP request message to send to the server. 35 | /// A cancellation token to cancel operation. 36 | /// 37 | /// Returns . The task object representing the asynchronous operation. 38 | /// 39 | protected async override Task SendAsync( 40 | HttpRequestMessage request, 41 | CancellationToken cancellationToken) 42 | { 43 | return await this.sendFunc.Invoke(request).ConfigureAwait(false); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.AuditBot.AspNet/Web.config: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Schema.Teams/MessageActionsPayloadBodyExtensions.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Schema.Teams 6 | { 7 | using System.Collections.Generic; 8 | using HtmlAgilityPack; 9 | 10 | /// 11 | /// MessageActionsPayloadBody extensions. 12 | /// 13 | 14 | public static class MessageActionsPayloadBodyExtensions 15 | { 16 | private static readonly HashSet textRestrictedHtmlTags = new HashSet { "at", "attachment" }; 17 | 18 | /// 19 | /// Strip HTML tags from MessageActionsPayloadBody content. 20 | /// 21 | /// The MessageActionsPayloadBody. 22 | /// Plain text content. 23 | public static string GetPlainTextContent(this MessageActionsPayloadBody body) 24 | { 25 | var doc = new HtmlDocument(); 26 | doc.LoadHtml(body.content); 27 | return StripHtmlTags(doc.DocumentNode, textRestrictedHtmlTags); 28 | } 29 | 30 | private static string StripHtmlTags(HtmlNode node, ISet tags) 31 | { 32 | string result = ""; 33 | if (tags.Contains(node.Name)) 34 | { 35 | result += node.OuterHtml; 36 | } 37 | else 38 | { 39 | foreach (HtmlNode childNode in node.ChildNodes) 40 | { 41 | if (childNode.NodeType == HtmlNodeType.Text) 42 | { 43 | result += childNode.InnerText; 44 | } 45 | else 46 | { 47 | result += StripHtmlTags(childNode, tags); 48 | } 49 | } 50 | } 51 | return result; 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Abstractions.Teams/ConversationUpdate/TeamEventBase.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Abstractions.Teams.ConversationUpdate 6 | { 7 | using Microsoft.Bot.Schema.Teams; 8 | 9 | /// 10 | /// Type of team event. 11 | /// 12 | public enum TeamEventType 13 | { 14 | /// 15 | /// Members added. 16 | /// 17 | MembersAdded, 18 | 19 | /// 20 | /// Members removed. 21 | /// 22 | MembersRemoved, 23 | 24 | /// 25 | /// New channel created in a team. 26 | /// 27 | ChannelCreated, 28 | 29 | /// 30 | /// Channel deleted from a team. 31 | /// 32 | ChannelDeleted, 33 | 34 | /// 35 | /// Channel was renamed. 36 | /// 37 | ChannelRenamed, 38 | 39 | /// 40 | /// Team was renamed. 41 | /// 42 | TeamRenamed, 43 | } 44 | 45 | /// 46 | /// Base class for events generated for teams. 47 | /// 48 | public abstract class TeamEventBase 49 | { 50 | /// 51 | /// Gets the event type. 52 | /// 53 | public abstract TeamEventType EventType { get; } 54 | 55 | /// 56 | /// Gets the team for the event. 57 | /// 58 | public TeamInfo Team { get; internal set; } 59 | 60 | /// 61 | /// Gets the tenant for the team. 62 | /// 63 | public TenantInfo Tenant { get; internal set; } 64 | 65 | /// 66 | /// Gets the original activity. 67 | /// 68 | public ITurnContext TurnContext { get; internal set; } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Schema.Teams/Generated/ChannelInfo.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // Licensed under the MIT License. See License.txt in the project root for 4 | // license information. 5 | // 6 | // Code generated by Microsoft (R) AutoRest Code Generator. 7 | // Changes may cause incorrect behavior and will be lost if the code is 8 | // regenerated. 9 | // 10 | 11 | namespace Microsoft.Bot.Schema.Teams 12 | { 13 | using Newtonsoft.Json; 14 | using System.Linq; 15 | 16 | /// 17 | /// A channel info object which describes the channel. 18 | /// 19 | public partial class ChannelInfo 20 | { 21 | /// 22 | /// Initializes a new instance of the ChannelInfo class. 23 | /// 24 | public ChannelInfo() 25 | { 26 | CustomInit(); 27 | } 28 | 29 | /// 30 | /// Initializes a new instance of the ChannelInfo class. 31 | /// 32 | /// Unique identifier representing a channel 33 | /// Name of the channel 34 | public ChannelInfo(string id = default(string), string name = default(string)) 35 | { 36 | Id = id; 37 | Name = name; 38 | CustomInit(); 39 | } 40 | 41 | /// 42 | /// An initialization method that performs custom operations like setting defaults 43 | /// 44 | partial void CustomInit(); 45 | 46 | /// 47 | /// Gets or sets unique identifier representing a channel 48 | /// 49 | [JsonProperty(PropertyName = "id")] 50 | public string Id { get; set; } 51 | 52 | /// 53 | /// Gets or sets name of the channel 54 | /// 55 | [JsonProperty(PropertyName = "name")] 56 | public string Name { get; set; } 57 | 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /CSharp/UnitTests/Microsoft.Bot.Builder.Teams.Tests/Jsons/SampleActivity2AtMentions.json: -------------------------------------------------------------------------------- 1 | { 2 | "text": "Test Bot 1   TestBot2  TestMessage", 3 | "textFormat": "plain", 4 | "attachments": [ 5 | { 6 | "contentType": "text/html", 7 | "content": "
Test Bot 1 TestBot2 TestMessage
" 8 | } 9 | ], 10 | "type": "message", 11 | "timestamp": "2017-04-25T22:14:10.626Z", 12 | "id": "1493158451219", 13 | "channelId": "msteams", 14 | "serviceUrl": "https://smba.trafficmanager.net/amer-client-ss.msg/", 15 | "from": { 16 | "id": "29:15WjgbDbuckdlwGz_Maqg6r0H3tKwOhZaj9VCKO4O20VD-hULRlwweUaiXT_dimbE6tEjtkfJPhav6pC8Eh9tbQ", 17 | "name": "Test" 18 | }, 19 | "conversation": { 20 | "isGroup": true, 21 | "id": "19:ChannelID@thread.skype;messageid=1493158451000" 22 | }, 23 | "recipient": { 24 | "id": "28:310f9d19-f5e7-4b13-a535-75f25f36232e", 25 | "name": "TestBot2" 26 | }, 27 | "entities": [ 28 | { 29 | "mentioned": { 30 | "id": "28:e2f318df-469d-4494-8efd-d6e16da873be", 31 | "name": "Test Bot 1" 32 | }, 33 | "text": "Test Bot 1", 34 | "type": "mention" 35 | }, 36 | { 37 | "mentioned": { 38 | "id": "28:310f9d19-f5e7-4b13-a535-75f25f36232e", 39 | "name": "TestBot2" 40 | }, 41 | "text": "TestBot2", 42 | "type": "mention" 43 | }, 44 | { 45 | "locale": "en-US", 46 | "country": "US", 47 | "platform": "Windows", 48 | "type": "clientInfo" 49 | } 50 | ], 51 | "channelData": { 52 | "channel": { 53 | "id": "19:ChannelID@thread.skype" 54 | }, 55 | "team": { 56 | "id": "19:TeamID@thread.skype" 57 | }, 58 | "tenant": { 59 | "id": "b401cedf-7465-4c41-8f52-9b31a19f6826" 60 | } 61 | } 62 | } -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.RemindMeBot/Microsoft.Bot.Builder.Teams.RemindMeBot.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.1 5 | 6 | 7 | 8 | $([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Microsoft.Bot.Builder.Teams.sln))\Build\Analyzer.ruleset 9 | bin\$(Configuration)\$(Platform)\$(AssemblyName).xml 10 | Full 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | all 24 | runtime; build; native; contentfiles; analyzers 25 | 26 | 27 | 28 | 29 | 30 | all 31 | runtime; build; native; contentfiles; analyzers 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | PreserveNewest 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Schema.Teams/Generated/O365ConnectorCardFact.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // Licensed under the MIT License. See License.txt in the project root for 4 | // license information. 5 | // 6 | // Code generated by Microsoft (R) AutoRest Code Generator. 7 | // Changes may cause incorrect behavior and will be lost if the code is 8 | // regenerated. 9 | // 10 | 11 | namespace Microsoft.Bot.Schema.Teams 12 | { 13 | using Newtonsoft.Json; 14 | using System.Linq; 15 | 16 | /// 17 | /// O365 connector card fact 18 | /// 19 | public partial class O365ConnectorCardFact 20 | { 21 | /// 22 | /// Initializes a new instance of the O365ConnectorCardFact class. 23 | /// 24 | public O365ConnectorCardFact() 25 | { 26 | CustomInit(); 27 | } 28 | 29 | /// 30 | /// Initializes a new instance of the O365ConnectorCardFact class. 31 | /// 32 | /// Display name of the fact 33 | /// Display value for the fact 34 | public O365ConnectorCardFact(string name = default(string), string value = default(string)) 35 | { 36 | Name = name; 37 | Value = value; 38 | CustomInit(); 39 | } 40 | 41 | /// 42 | /// An initialization method that performs custom operations like setting defaults 43 | /// 44 | partial void CustomInit(); 45 | 46 | /// 47 | /// Gets or sets display name of the fact 48 | /// 49 | [JsonProperty(PropertyName = "name")] 50 | public string Name { get; set; } 51 | 52 | /// 53 | /// Gets or sets display value for the fact 54 | /// 55 | [JsonProperty(PropertyName = "value")] 56 | public string Value { get; set; } 57 | 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.FileBot/FileBot.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Teams.FileBot 6 | { 7 | using System.Threading; 8 | using System.Threading.Tasks; 9 | using Microsoft.Bot.Builder.Abstractions; 10 | 11 | /// 12 | /// Wikipedia messaging extension. 13 | /// 14 | /// 15 | public class FileBot : IBot 16 | { 17 | /// 18 | /// The activity processor. 19 | /// 20 | private readonly IActivityProcessor activityProcessor; 21 | 22 | /// 23 | /// Initializes a new instance of the class. 24 | /// 25 | /// The activity processor. 26 | public FileBot(IActivityProcessor activityProcessor) 27 | { 28 | this.activityProcessor = activityProcessor; 29 | } 30 | 31 | /// 32 | /// When implemented in a bot, handles an incoming activity. 33 | /// 34 | /// The context object for this turn. 35 | /// The cancellation token. 36 | /// 37 | /// A task that represents the work queued to execute. 38 | /// 39 | /// 40 | /// The provides information about the 41 | /// incoming activity, and other data needed to process the activity. 42 | /// 43 | /// 44 | /// 45 | public async Task OnTurnAsync(ITurnContext turnContext, CancellationToken cancellationToken = default(CancellationToken)) 46 | { 47 | await this.activityProcessor.ProcessIncomingActivityAsync(turnContext).ConfigureAwait(false); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Schema.Teams/Generated/O365ConnectorCardImage.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // Licensed under the MIT License. See License.txt in the project root for 4 | // license information. 5 | // 6 | // Code generated by Microsoft (R) AutoRest Code Generator. 7 | // Changes may cause incorrect behavior and will be lost if the code is 8 | // regenerated. 9 | // 10 | 11 | namespace Microsoft.Bot.Schema.Teams 12 | { 13 | using Newtonsoft.Json; 14 | using System.Linq; 15 | 16 | /// 17 | /// O365 connector card image 18 | /// 19 | public partial class O365ConnectorCardImage 20 | { 21 | /// 22 | /// Initializes a new instance of the O365ConnectorCardImage class. 23 | /// 24 | public O365ConnectorCardImage() 25 | { 26 | CustomInit(); 27 | } 28 | 29 | /// 30 | /// Initializes a new instance of the O365ConnectorCardImage class. 31 | /// 32 | /// URL for the image 33 | /// Alternative text for the image 34 | public O365ConnectorCardImage(string image = default(string), string title = default(string)) 35 | { 36 | Image = image; 37 | Title = title; 38 | CustomInit(); 39 | } 40 | 41 | /// 42 | /// An initialization method that performs custom operations like setting defaults 43 | /// 44 | partial void CustomInit(); 45 | 46 | /// 47 | /// Gets or sets URL for the image 48 | /// 49 | [JsonProperty(PropertyName = "image")] 50 | public string Image { get; set; } 51 | 52 | /// 53 | /// Gets or sets alternative text for the image 54 | /// 55 | [JsonProperty(PropertyName = "title")] 56 | public string Title { get; set; } 57 | 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.AuditBot/AuditBot.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Teams.AuditBot 6 | { 7 | using System.Threading; 8 | using System.Threading.Tasks; 9 | using Microsoft.Bot.Builder.Abstractions; 10 | 11 | /// 12 | /// Teams Team operation audit bot. 13 | /// 14 | /// 15 | public class AuditBot : IBot 16 | { 17 | /// 18 | /// The incoming activity processor. 19 | /// 20 | private readonly IActivityProcessor activityProcessor; 21 | 22 | /// 23 | /// Initializes a new instance of the class. 24 | /// 25 | /// The incoming activity processor. 26 | public AuditBot(IActivityProcessor activityProcessor) 27 | { 28 | this.activityProcessor = activityProcessor; 29 | } 30 | 31 | /// 32 | /// When implemented in a bot, handles an incoming activity. 33 | /// 34 | /// The context object for this turn. 35 | /// The cancellation token. 36 | /// 37 | /// A task that represents the work queued to execute. 38 | /// 39 | /// 40 | /// The provides information about the 41 | /// incoming activity, and other data needed to process the activity. 42 | /// 43 | /// 44 | /// 45 | public async Task OnTurnAsync(ITurnContext turnContext, CancellationToken cancellationToken = default(CancellationToken)) 46 | { 47 | await this.activityProcessor.ProcessIncomingActivityAsync(turnContext).ConfigureAwait(false); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Schema.Teams/Generated/MessagingExtensionParameter.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // Licensed under the MIT License. See License.txt in the project root for 4 | // license information. 5 | // 6 | // Code generated by Microsoft (R) AutoRest Code Generator. 7 | // Changes may cause incorrect behavior and will be lost if the code is 8 | // regenerated. 9 | // 10 | 11 | namespace Microsoft.Bot.Schema.Teams 12 | { 13 | using Newtonsoft.Json; 14 | using System.Linq; 15 | 16 | /// 17 | /// Messaging extension query parameters 18 | /// 19 | public partial class MessagingExtensionParameter 20 | { 21 | /// 22 | /// Initializes a new instance of the MessagingExtensionParameter 23 | /// class. 24 | /// 25 | public MessagingExtensionParameter() 26 | { 27 | CustomInit(); 28 | } 29 | 30 | /// 31 | /// Initializes a new instance of the MessagingExtensionParameter 32 | /// class. 33 | /// 34 | /// Name of the parameter 35 | /// Value of the parameter 36 | public MessagingExtensionParameter(string name = default(string), object value = default(object)) 37 | { 38 | Name = name; 39 | Value = value; 40 | CustomInit(); 41 | } 42 | 43 | /// 44 | /// An initialization method that performs custom operations like setting defaults 45 | /// 46 | partial void CustomInit(); 47 | 48 | /// 49 | /// Gets or sets name of the parameter 50 | /// 51 | [JsonProperty(PropertyName = "name")] 52 | public string Name { get; set; } 53 | 54 | /// 55 | /// Gets or sets value of the parameter 56 | /// 57 | [JsonProperty(PropertyName = "value")] 58 | public object Value { get; set; } 59 | 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Schema.Teams/Generated/TaskModuleMessageResponse.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // Licensed under the MIT License. See License.txt in the project root for 4 | // license information. 5 | // 6 | // Code generated by Microsoft (R) AutoRest Code Generator. 7 | // Changes may cause incorrect behavior and will be lost if the code is 8 | // regenerated. 9 | // 10 | 11 | namespace Microsoft.Bot.Schema.Teams 12 | { 13 | using Newtonsoft.Json; 14 | using System.Linq; 15 | 16 | /// 17 | /// Task Module response with message action. 18 | /// 19 | public partial class TaskModuleMessageResponse : TaskModuleResponseBase 20 | { 21 | /// 22 | /// Initializes a new instance of the TaskModuleMessageResponse class. 23 | /// 24 | public TaskModuleMessageResponse() 25 | { 26 | CustomInit(); 27 | } 28 | 29 | /// 30 | /// Initializes a new instance of the TaskModuleMessageResponse class. 31 | /// 32 | /// Choice of action options when responding to the 33 | /// task/submit message. Possible values include: 'message', 34 | /// 'continue' 35 | /// Teams will display the value of value in a 36 | /// popup message box. 37 | public TaskModuleMessageResponse(string type = default(string), string value = default(string)) 38 | : base(type) 39 | { 40 | Value = value; 41 | CustomInit(); 42 | } 43 | 44 | /// 45 | /// An initialization method that performs custom operations like setting defaults 46 | /// 47 | partial void CustomInit(); 48 | 49 | /// 50 | /// Gets or sets teams will display the value of value in a popup 51 | /// message box. 52 | /// 53 | [JsonProperty(PropertyName = "value")] 54 | public string Value { get; set; } 55 | 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.TeamEchoBot/EchoStateAccessor.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Teams.TeamEchoBot 6 | { 7 | using System; 8 | using Microsoft.Bot.Builder.Teams.StateStorage; 9 | 10 | /// 11 | /// Echo state accessor. 12 | /// 13 | public class EchoStateAccessor 14 | { 15 | /// 16 | /// Initializes a new instance of the class. 17 | /// Contains the and associated . 18 | /// 19 | /// The state object that stores the counter. 20 | public EchoStateAccessor(TeamSpecificConversationState conversationState) 21 | { 22 | this.ConversationState = conversationState ?? throw new ArgumentNullException(nameof(conversationState)); 23 | } 24 | 25 | /// 26 | /// Gets the name used for the accessor. 27 | /// 28 | /// Accessors require a unique name. 29 | /// The accessor name for the counter accessor. 30 | public static string CounterStateName { get; } = $"{nameof(EchoStateAccessor)}.EchoState"; 31 | 32 | /// 33 | /// Gets or sets the for EchoState. 34 | /// 35 | /// 36 | /// The accessor stores the turn count for the conversation. 37 | /// 38 | public IStatePropertyAccessor CounterState { get; set; } 39 | 40 | /// 41 | /// Gets the object for the conversation. 42 | /// 43 | /// The object. 44 | public TeamSpecificConversationState ConversationState { get; } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Schema.Teams/Generated/MessagingExtensionQueryOptions.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // Licensed under the MIT License. See License.txt in the project root for 4 | // license information. 5 | // 6 | // Code generated by Microsoft (R) AutoRest Code Generator. 7 | // Changes may cause incorrect behavior and will be lost if the code is 8 | // regenerated. 9 | // 10 | 11 | namespace Microsoft.Bot.Schema.Teams 12 | { 13 | using Newtonsoft.Json; 14 | using System.Linq; 15 | 16 | /// 17 | /// Messaging extension query options 18 | /// 19 | public partial class MessagingExtensionQueryOptions 20 | { 21 | /// 22 | /// Initializes a new instance of the MessagingExtensionQueryOptions 23 | /// class. 24 | /// 25 | public MessagingExtensionQueryOptions() 26 | { 27 | CustomInit(); 28 | } 29 | 30 | /// 31 | /// Initializes a new instance of the MessagingExtensionQueryOptions 32 | /// class. 33 | /// 34 | /// Number of entities to skip 35 | /// Number of entities to fetch 36 | public MessagingExtensionQueryOptions(int? skip = default(int?), int? count = default(int?)) 37 | { 38 | Skip = skip; 39 | Count = count; 40 | CustomInit(); 41 | } 42 | 43 | /// 44 | /// An initialization method that performs custom operations like setting defaults 45 | /// 46 | partial void CustomInit(); 47 | 48 | /// 49 | /// Gets or sets number of entities to skip 50 | /// 51 | [JsonProperty(PropertyName = "skip")] 52 | public int? Skip { get; set; } 53 | 54 | /// 55 | /// Gets or sets number of entities to fetch 56 | /// 57 | [JsonProperty(PropertyName = "count")] 58 | public int? Count { get; set; } 59 | 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.MessagingExtensionBot/MessagingExtensionBot.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Teams.MessagingExtensionBot 6 | { 7 | using System.Threading; 8 | using System.Threading.Tasks; 9 | using Microsoft.Bot.Builder.Abstractions; 10 | 11 | /// 12 | /// Wikipedia messaging extension. 13 | /// 14 | /// 15 | public class MessagingExtensionBot : IBot 16 | { 17 | /// 18 | /// The activity processor. 19 | /// 20 | private readonly IActivityProcessor activityProcessor; 21 | 22 | /// 23 | /// Initializes a new instance of the class. 24 | /// 25 | /// The activity processor. 26 | public MessagingExtensionBot(IActivityProcessor activityProcessor) 27 | { 28 | this.activityProcessor = activityProcessor; 29 | } 30 | 31 | /// 32 | /// When implemented in a bot, handles an incoming activity. 33 | /// 34 | /// The context object for this turn. 35 | /// The cancellation token. 36 | /// 37 | /// A task that represents the work queued to execute. 38 | /// 39 | /// 40 | /// The provides information about the 41 | /// incoming activity, and other data needed to process the activity. 42 | /// 43 | /// 44 | /// 45 | public async Task OnTurnAsync(ITurnContext turnContext, CancellationToken cancellationToken = default(CancellationToken)) 46 | { 47 | await this.activityProcessor.ProcessIncomingActivityAsync(turnContext).ConfigureAwait(false); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.AuditBot/AuditLogAccessor.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Teams.AuditBot 6 | { 7 | using System; 8 | using Microsoft.Bot.Builder.Teams.StateStorage; 9 | 10 | /// 11 | /// Accessor to read and write audit logs to storage. 12 | /// 13 | public class AuditLogAccessor 14 | { 15 | /// 16 | /// Initializes a new instance of the class. 17 | /// Contains the and associated . 18 | /// 19 | /// The state object that stores the logs. 20 | public AuditLogAccessor(TeamSpecificConversationState conversationState) 21 | { 22 | this.ConversationState = conversationState ?? throw new ArgumentNullException(nameof(conversationState)); 23 | } 24 | 25 | /// 26 | /// Gets the name used for the accessor. 27 | /// 28 | /// Accessors require a unique name. 29 | /// The accessor name for the counter accessor. 30 | public static string AuditLogName { get; } = $"{nameof(AuditLogAccessor)}.AuditLog"; 31 | 32 | /// 33 | /// Gets or sets the for EchoState. 34 | /// 35 | /// 36 | /// The accessor stores the turn count for the conversation. 37 | /// 38 | public IStatePropertyAccessor AuditLog { get; set; } 39 | 40 | /// 41 | /// Gets the object for the conversation. 42 | /// 43 | /// The object. 44 | public TeamSpecificConversationState ConversationState { get; } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.FileBot/Microsoft.Bot.Builder.Teams.FileBot.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.1 5 | 6 | 7 | 8 | $([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Microsoft.Bot.Builder.Teams.sln))\Build\Analyzer.ruleset 9 | bin\$(Configuration)\$(Platform)\$(AssemblyName).xml 10 | Full 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | all 24 | runtime; build; native; contentfiles; analyzers 25 | 26 | 27 | 28 | 29 | 30 | all 31 | runtime; build; native; contentfiles; analyzers 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | PreserveNewest 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Builder.Teams/StateStorage/TeamSpecificConversationState.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Teams.StateStorage 6 | { 7 | using Microsoft.Bot.Schema.Teams; 8 | 9 | /// 10 | /// Teams specific conversation state management. 11 | /// 12 | /// 13 | public class TeamSpecificConversationState : BotState 14 | { 15 | /// 16 | /// The key to use to read and write this conversation state object to storage. 17 | /// 18 | private static string propertyName = $"TeamSpecificConversationState:{typeof(TeamSpecificConversationState).Namespace}.{typeof(TeamSpecificConversationState).Name}"; 19 | 20 | /// 21 | /// Initializes a new instance of the class. 22 | /// Creates a new object. 23 | /// 24 | /// The storage provider to use. 25 | public TeamSpecificConversationState(IStorage storage) 26 | : base(storage, propertyName) 27 | { 28 | } 29 | 30 | /// 31 | /// Gets the key to use when reading and writing state to and from storage. 32 | /// 33 | /// The context object for this turn. 34 | /// The storage key. 35 | protected override string GetStorageKey(ITurnContext turnContext) 36 | { 37 | TeamsChannelData teamsChannelData = turnContext.Activity.GetChannelData(); 38 | 39 | if (string.IsNullOrEmpty(teamsChannelData.Team?.Id)) 40 | { 41 | return $"chat/{turnContext.Activity.ChannelId}/{turnContext.Activity.Conversation.Id}"; 42 | } 43 | else 44 | { 45 | return $"team/{turnContext.Activity.ChannelId}/{teamsChannelData.Team.Id}"; 46 | } 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Schema.Teams/Generated/TaskModuleContinueResponse.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // Licensed under the MIT License. See License.txt in the project root for 4 | // license information. 5 | // 6 | // Code generated by Microsoft (R) AutoRest Code Generator. 7 | // Changes may cause incorrect behavior and will be lost if the code is 8 | // regenerated. 9 | // 10 | 11 | namespace Microsoft.Bot.Schema.Teams 12 | { 13 | using Newtonsoft.Json; 14 | using System.Linq; 15 | 16 | /// 17 | /// Task Module Response with continue action. 18 | /// 19 | public partial class TaskModuleContinueResponse : TaskModuleResponseBase 20 | { 21 | /// 22 | /// Initializes a new instance of the TaskModuleContinueResponse class. 23 | /// 24 | public TaskModuleContinueResponse() 25 | { 26 | CustomInit(); 27 | } 28 | 29 | /// 30 | /// Initializes a new instance of the TaskModuleContinueResponse class. 31 | /// 32 | /// Choice of action options when responding to the 33 | /// task/submit message. Possible values include: 'message', 34 | /// 'continue' 35 | /// The JSON for the Adaptive card to appear in the 36 | /// task module. 37 | public TaskModuleContinueResponse(string type = default(string), TaskModuleTaskInfo value = default(TaskModuleTaskInfo)) 38 | : base(type) 39 | { 40 | Value = value; 41 | CustomInit(); 42 | } 43 | 44 | /// 45 | /// An initialization method that performs custom operations like setting defaults 46 | /// 47 | partial void CustomInit(); 48 | 49 | /// 50 | /// Gets or sets the JSON for the Adaptive card to appear in the task 51 | /// module. 52 | /// 53 | [JsonProperty(PropertyName = "value")] 54 | public TaskModuleTaskInfo Value { get; set; } 55 | 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.WikipediaMessagingExtension/ReadMe.md: -------------------------------------------------------------------------------- 1 | ### Microsoft.Bot.Builder.Teams.WikipediaMessagingExtension 2 | 3 | This sample showcases how to build a Messaging extension with new v4 SDK. 4 | 5 | ##### Setup 6 | ###### WebApiConfig.cs 7 | Startup.cs sets up the bot. Since this bot only works in Channels in Microsoft Teams, we will be adding following 3 middlewares 8 | - **DropNonTeamsActivitiesMiddleware** - To drop all activities not coming from Microsoft Teams 9 | - **TeamsMiddleware** - To access Microsoft Teams's constructs 10 | 11 | Optionally to simplify handling Messaging extensions only we are utilizing following 3 constructs 12 | 13 | ```cs 14 | // Process all incoming activities and figure out which ones are for invoke activities 15 | services.AddTransient(); 16 | 17 | // Process all invokes and then figure out the ones which have messaging extension payload. 18 | services.AddTransient(); 19 | 20 | // Call into Wikipedia and get the required details. 21 | services.AddSingleton(); 22 | ``` 23 | 24 | ##### Code execution 25 | ###### WikipediaSearchHandler 26 | Handles contacting Wikipedia and gives back a Messaging extension result. 27 | 28 | ###### TeamsInvokeActivityHandler 29 | Handles incoming invoke activities and sends back responses. Invoke handler returns an ```InvokeResponse``` object 30 | ```cs 31 | return new InvokeResponse 32 | { 33 | Body = new MessagingExtensionResponse 34 | { 35 | ComposeExtension = await this.searchHandler.GetSearchResultAsync(messagingExtensionAction).ConfigureAwait(false), 36 | }, 37 | Status = 200, 38 | }; 39 | ``` 40 | this is then sent to ```TeamsActivityProcessor``` which then sends it over the wire 41 | ```cs 42 | await turnContext.SendActivityAsync( 43 | new Activity 44 | { 45 | Value = invokeResponse, 46 | Type = ActivityTypesEx.InvokeResponse, 47 | }).ConfigureAwait(false); 48 | ``` 49 | 50 | #### How to test 51 | Use the [sample manifest](TeamsAppManifest/manifest.json) and change the botId at --YOURBOTIDHERE-- and use your bot Id. -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.MessagingExtensionBot/Microsoft.Bot.Builder.Teams.MessagingExtensionBot.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.1 5 | 6 | 7 | 8 | $([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Microsoft.Bot.Builder.Teams.sln))\Build\Analyzer.ruleset 9 | bin\$(Configuration)\$(Platform)\$(AssemblyName).xml 10 | Full 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | all 24 | runtime; build; native; contentfiles; analyzers 25 | 26 | 27 | 28 | 29 | 30 | all 31 | runtime; build; native; contentfiles; analyzers 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | PreserveNewest 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Schema.Teams/Generated/SigninStateVerificationQuery.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // Licensed under the MIT License. See License.txt in the project root for 4 | // license information. 5 | // 6 | // Code generated by Microsoft (R) AutoRest Code Generator. 7 | // Changes may cause incorrect behavior and will be lost if the code is 8 | // regenerated. 9 | // 10 | 11 | namespace Microsoft.Bot.Schema.Teams 12 | { 13 | using Newtonsoft.Json; 14 | using System.Linq; 15 | 16 | /// 17 | /// Signin state (part of signin action auth flow) verification invoke 18 | /// query 19 | /// 20 | public partial class SigninStateVerificationQuery 21 | { 22 | /// 23 | /// Initializes a new instance of the SigninStateVerificationQuery 24 | /// class. 25 | /// 26 | public SigninStateVerificationQuery() 27 | { 28 | CustomInit(); 29 | } 30 | 31 | /// 32 | /// Initializes a new instance of the SigninStateVerificationQuery 33 | /// class. 34 | /// 35 | /// The state string originally received when the 36 | /// signin web flow is finished with a state posted back to client via 37 | /// tab SDK microsoftTeams.authentication.notifySuccess(state) 38 | public SigninStateVerificationQuery(string state = default(string)) 39 | { 40 | State = state; 41 | CustomInit(); 42 | } 43 | 44 | /// 45 | /// An initialization method that performs custom operations like setting defaults 46 | /// 47 | partial void CustomInit(); 48 | 49 | /// 50 | /// Gets or sets The state string originally received when the signin 51 | /// web flow is finished with a state posted back to client via tab SDK 52 | /// microsoftTeams.authentication.notifySuccess(state) 53 | /// 54 | [JsonProperty(PropertyName = "state")] 55 | public string State { get; set; } 56 | 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.WikipediaMessagingExtension/WikipediaMessagingExtensionBot.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Teams.WikipediaMessagingExtension 6 | { 7 | using System.Threading; 8 | using System.Threading.Tasks; 9 | using Microsoft.Bot.Builder.Abstractions; 10 | 11 | /// 12 | /// Wikipedia messaging extension. 13 | /// 14 | /// 15 | public class WikipediaMessagingExtensionBot : IBot 16 | { 17 | /// 18 | /// The activity processor. 19 | /// 20 | private readonly IActivityProcessor activityProcessor; 21 | 22 | /// 23 | /// Initializes a new instance of the class. 24 | /// 25 | /// The activity processor. 26 | public WikipediaMessagingExtensionBot(IActivityProcessor activityProcessor) 27 | { 28 | this.activityProcessor = activityProcessor; 29 | } 30 | 31 | /// 32 | /// When implemented in a bot, handles an incoming activity. 33 | /// 34 | /// The context object for this turn. 35 | /// The cancellation token. 36 | /// 37 | /// A task that represents the work queued to execute. 38 | /// 39 | /// 40 | /// The provides information about the 41 | /// incoming activity, and other data needed to process the activity. 42 | /// 43 | /// 44 | /// 45 | public async Task OnTurnAsync(ITurnContext turnContext, CancellationToken cancellationToken = default(CancellationToken)) 46 | { 47 | await this.activityProcessor.ProcessIncomingActivityAsync(turnContext).ConfigureAwait(false); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.WikipediaMessagingExtension/Microsoft.Bot.Builder.Teams.WikipediaMessagingExtension.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.1 5 | 6 | 7 | 8 | $([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Microsoft.Bot.Builder.Teams.sln))\Build\Analyzer.ruleset 9 | bin\$(Configuration)\$(Platform)\$(AssemblyName).xml 10 | Full 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | all 24 | runtime; build; native; contentfiles; analyzers 25 | 26 | 27 | 28 | 29 | 30 | all 31 | runtime; build; native; contentfiles; analyzers 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | PreserveNewest 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Schema.Teams/Generated/TaskModuleRequest.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // Licensed under the MIT License. See License.txt in the project root for 4 | // license information. 5 | // 6 | // Code generated by Microsoft (R) AutoRest Code Generator. 7 | // Changes may cause incorrect behavior and will be lost if the code is 8 | // regenerated. 9 | // 10 | 11 | namespace Microsoft.Bot.Schema.Teams 12 | { 13 | using Newtonsoft.Json; 14 | using System.Linq; 15 | 16 | /// 17 | /// Task module invoke request value payload 18 | /// 19 | public partial class TaskModuleRequest 20 | { 21 | /// 22 | /// Initializes a new instance of the TaskModuleRequest class. 23 | /// 24 | public TaskModuleRequest() 25 | { 26 | CustomInit(); 27 | } 28 | 29 | /// 30 | /// Initializes a new instance of the TaskModuleRequest class. 31 | /// 32 | /// User input data. Free payload with key-value 33 | /// pairs. 34 | /// Current user context, i.e., the current 35 | /// theme 36 | public TaskModuleRequest(object data = default(object), TaskModuleRequestContext context = default(TaskModuleRequestContext)) 37 | { 38 | Data = data; 39 | Context = context; 40 | CustomInit(); 41 | } 42 | 43 | /// 44 | /// An initialization method that performs custom operations like setting defaults 45 | /// 46 | partial void CustomInit(); 47 | 48 | /// 49 | /// Gets or sets user input data. Free payload with key-value pairs. 50 | /// 51 | [JsonProperty(PropertyName = "data")] 52 | public object Data { get; set; } 53 | 54 | /// 55 | /// Gets or sets current user context, i.e., the current theme 56 | /// 57 | [JsonProperty(PropertyName = "context")] 58 | public TaskModuleRequestContext Context { get; set; } 59 | 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Schema.Teams/Generated/O365ConnectorCardOpenUriTarget.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // Licensed under the MIT License. See License.txt in the project root for 4 | // license information. 5 | // 6 | // Code generated by Microsoft (R) AutoRest Code Generator. 7 | // Changes may cause incorrect behavior and will be lost if the code is 8 | // regenerated. 9 | // 10 | 11 | namespace Microsoft.Bot.Schema.Teams 12 | { 13 | using Newtonsoft.Json; 14 | using System.Linq; 15 | 16 | /// 17 | /// O365 connector card OpenUri target 18 | /// 19 | public partial class O365ConnectorCardOpenUriTarget 20 | { 21 | /// 22 | /// Initializes a new instance of the O365ConnectorCardOpenUriTarget 23 | /// class. 24 | /// 25 | public O365ConnectorCardOpenUriTarget() 26 | { 27 | CustomInit(); 28 | } 29 | 30 | /// 31 | /// Initializes a new instance of the O365ConnectorCardOpenUriTarget 32 | /// class. 33 | /// 34 | /// Target operating system. Possible values include: 35 | /// 'default', 'iOS', 'android', 'windows' 36 | /// Target url 37 | public O365ConnectorCardOpenUriTarget(string os = default(string), string uri = default(string)) 38 | { 39 | Os = os; 40 | Uri = uri; 41 | CustomInit(); 42 | } 43 | 44 | /// 45 | /// An initialization method that performs custom operations like setting defaults 46 | /// 47 | partial void CustomInit(); 48 | 49 | /// 50 | /// Gets or sets target operating system. Possible values include: 51 | /// 'default', 'iOS', 'android', 'windows' 52 | /// 53 | [JsonProperty(PropertyName = "os")] 54 | public string Os { get; set; } 55 | 56 | /// 57 | /// Gets or sets target url 58 | /// 59 | [JsonProperty(PropertyName = "uri")] 60 | public string Uri { get; set; } 61 | 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Schema.Teams/Generated/O365ConnectorCardMultichoiceInputChoice.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // Licensed under the MIT License. See License.txt in the project root for 4 | // license information. 5 | // 6 | // Code generated by Microsoft (R) AutoRest Code Generator. 7 | // Changes may cause incorrect behavior and will be lost if the code is 8 | // regenerated. 9 | // 10 | 11 | namespace Microsoft.Bot.Schema.Teams 12 | { 13 | using Newtonsoft.Json; 14 | using System.Linq; 15 | 16 | /// 17 | /// O365O365 connector card multiple choice input item 18 | /// 19 | public partial class O365ConnectorCardMultichoiceInputChoice 20 | { 21 | /// 22 | /// Initializes a new instance of the 23 | /// O365ConnectorCardMultichoiceInputChoice class. 24 | /// 25 | public O365ConnectorCardMultichoiceInputChoice() 26 | { 27 | CustomInit(); 28 | } 29 | 30 | /// 31 | /// Initializes a new instance of the 32 | /// O365ConnectorCardMultichoiceInputChoice class. 33 | /// 34 | /// The text rendered on ActionCard. 35 | /// The value received as results. 36 | public O365ConnectorCardMultichoiceInputChoice(string display = default(string), string value = default(string)) 37 | { 38 | Display = display; 39 | Value = value; 40 | CustomInit(); 41 | } 42 | 43 | /// 44 | /// An initialization method that performs custom operations like setting defaults 45 | /// 46 | partial void CustomInit(); 47 | 48 | /// 49 | /// Gets or sets the text rendered on ActionCard. 50 | /// 51 | [JsonProperty(PropertyName = "display")] 52 | public string Display { get; set; } 53 | 54 | /// 55 | /// Gets or sets the value received as results. 56 | /// 57 | [JsonProperty(PropertyName = "value")] 58 | public string Value { get; set; } 59 | 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Schema.Teams/Generated/MessageActionsPayloadBody.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // Licensed under the MIT License. See License.txt in the project root for 4 | // license information. 5 | // 6 | // Code generated by Microsoft (R) AutoRest Code Generator. 7 | // Changes may cause incorrect behavior and will be lost if the code is 8 | // regenerated. 9 | // 10 | 11 | namespace Microsoft.Bot.Schema.Teams 12 | { 13 | using Newtonsoft.Json; 14 | using System.Linq; 15 | 16 | /// 17 | /// Plaintext/HTML representation of the content of the message. 18 | /// 19 | public partial class MessageActionsPayloadBody 20 | { 21 | /// 22 | /// Initializes a new instance of the MessageActionsPayloadBody class. 23 | /// 24 | public MessageActionsPayloadBody() 25 | { 26 | CustomInit(); 27 | } 28 | 29 | /// 30 | /// Initializes a new instance of the MessageActionsPayloadBody class. 31 | /// 32 | /// Type of the content. Possible values 33 | /// include: 'html', 'text' 34 | /// The content of the body. 35 | public MessageActionsPayloadBody(string contentType = default(string), string content = default(string)) 36 | { 37 | ContentType = contentType; 38 | Content = content; 39 | CustomInit(); 40 | } 41 | 42 | /// 43 | /// An initialization method that performs custom operations like setting defaults 44 | /// 45 | partial void CustomInit(); 46 | 47 | /// 48 | /// Gets or sets type of the content. Possible values include: 'html', 49 | /// 'text' 50 | /// 51 | [JsonProperty(PropertyName = "contentType")] 52 | public string ContentType { get; set; } 53 | 54 | /// 55 | /// Gets or sets the content of the body. 56 | /// 57 | [JsonProperty(PropertyName = "content")] 58 | public string Content { get; set; } 59 | 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Schema.Teams/Generated/O365ConnectorCardHttpPOST.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // Licensed under the MIT License. See License.txt in the project root for 4 | // license information. 5 | // 6 | // Code generated by Microsoft (R) AutoRest Code Generator. 7 | // Changes may cause incorrect behavior and will be lost if the code is 8 | // regenerated. 9 | // 10 | 11 | namespace Microsoft.Bot.Schema.Teams 12 | { 13 | using Newtonsoft.Json; 14 | using System.Linq; 15 | 16 | /// 17 | /// O365 connector card HttpPOST action 18 | /// 19 | public partial class O365ConnectorCardHttpPOST : O365ConnectorCardActionBase 20 | { 21 | /// 22 | /// Initializes a new instance of the O365ConnectorCardHttpPOST class. 23 | /// 24 | public O365ConnectorCardHttpPOST() 25 | { 26 | CustomInit(); 27 | } 28 | 29 | /// 30 | /// Initializes a new instance of the O365ConnectorCardHttpPOST class. 31 | /// 32 | /// Type of the action. Possible values include: 33 | /// 'ViewAction', 'OpenUri', 'HttpPOST', 'ActionCard' 34 | /// Name of the action that will be used as button 35 | /// title 36 | /// Action Id 37 | /// Content to be posted back to bots via 38 | /// invoke 39 | public O365ConnectorCardHttpPOST(string type = default(string), string name = default(string), string id = default(string), string body = default(string)) 40 | : base(type, name, id) 41 | { 42 | Body = body; 43 | CustomInit(); 44 | } 45 | 46 | /// 47 | /// An initialization method that performs custom operations like setting defaults 48 | /// 49 | partial void CustomInit(); 50 | 51 | /// 52 | /// Gets or sets content to be posted back to bots via invoke 53 | /// 54 | [JsonProperty(PropertyName = "body")] 55 | public string Body { get; set; } 56 | 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.AuditBot/Microsoft.Bot.Builder.Teams.AuditBot.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netcoreapp2.1 5 | 6 | 7 | 8 | $([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Microsoft.Bot.Builder.Teams.sln))\Build\Analyzer.ruleset 9 | bin\$(Configuration)\$(Platform)\$(AssemblyName).xml 10 | Full 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | all 24 | runtime; build; native; contentfiles; analyzers 25 | 26 | 27 | 28 | 29 | 30 | all 31 | runtime; build; native; contentfiles; analyzers 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | PreserveNewest 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Schema.Teams/Generated/MessagingExtensionActionResponse.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // Licensed under the MIT License. See License.txt in the project root for 4 | // license information. 5 | // 6 | // Code generated by Microsoft (R) AutoRest Code Generator. 7 | // Changes may cause incorrect behavior and will be lost if the code is 8 | // regenerated. 9 | // 10 | 11 | namespace Microsoft.Bot.Schema.Teams 12 | { 13 | using Newtonsoft.Json; 14 | using System.Linq; 15 | 16 | /// 17 | /// Response of messaging extension action 18 | /// 19 | public partial class MessagingExtensionActionResponse 20 | { 21 | /// 22 | /// Initializes a new instance of the MessagingExtensionActionResponse 23 | /// class. 24 | /// 25 | public MessagingExtensionActionResponse() 26 | { 27 | CustomInit(); 28 | } 29 | 30 | /// 31 | /// Initializes a new instance of the MessagingExtensionActionResponse 32 | /// class. 33 | /// 34 | /// The JSON for the Adaptive card to appear in the 35 | /// task module. 36 | public MessagingExtensionActionResponse(TaskModuleResponseBase task = default(TaskModuleResponseBase), MessagingExtensionResult composeExtension = default(MessagingExtensionResult)) 37 | { 38 | Task = task; 39 | ComposeExtension = composeExtension; 40 | CustomInit(); 41 | } 42 | 43 | /// 44 | /// An initialization method that performs custom operations like setting defaults 45 | /// 46 | partial void CustomInit(); 47 | 48 | /// 49 | /// Gets or sets the JSON for the Adaptive card to appear in the task 50 | /// module. 51 | /// 52 | [JsonProperty(PropertyName = "task")] 53 | public TaskModuleResponseBase Task { get; set; } 54 | 55 | /// 56 | /// 57 | [JsonProperty(PropertyName = "composeExtension")] 58 | public MessagingExtensionResult ComposeExtension { get; set; } 59 | 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Schema.Teams/Generated/FileInfoCard.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // Licensed under the MIT License. See License.txt in the project root for 4 | // license information. 5 | // 6 | // Code generated by Microsoft (R) AutoRest Code Generator. 7 | // Changes may cause incorrect behavior and will be lost if the code is 8 | // regenerated. 9 | // 10 | 11 | namespace Microsoft.Bot.Schema.Teams 12 | { 13 | using Newtonsoft.Json; 14 | using System.Linq; 15 | 16 | /// 17 | /// File info card. 18 | /// 19 | public partial class FileInfoCard 20 | { 21 | /// 22 | /// Initializes a new instance of the FileInfoCard class. 23 | /// 24 | public FileInfoCard() 25 | { 26 | CustomInit(); 27 | } 28 | 29 | /// 30 | /// Initializes a new instance of the FileInfoCard class. 31 | /// 32 | /// Unique Id for the file. 33 | /// Type of file. 34 | /// ETag for the file. 35 | public FileInfoCard(string uniqueId = default(string), string fileType = default(string), object etag = default(object)) 36 | { 37 | UniqueId = uniqueId; 38 | FileType = fileType; 39 | Etag = etag; 40 | CustomInit(); 41 | } 42 | 43 | /// 44 | /// An initialization method that performs custom operations like setting defaults 45 | /// 46 | partial void CustomInit(); 47 | 48 | /// 49 | /// Gets or sets unique Id for the file. 50 | /// 51 | [JsonProperty(PropertyName = "uniqueId")] 52 | public string UniqueId { get; set; } 53 | 54 | /// 55 | /// Gets or sets type of file. 56 | /// 57 | [JsonProperty(PropertyName = "fileType")] 58 | public string FileType { get; set; } 59 | 60 | /// 61 | /// Gets or sets eTag for the file. 62 | /// 63 | [JsonProperty(PropertyName = "etag")] 64 | public object Etag { get; set; } 65 | 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /CSharp/UnitTests/Microsoft.Bot.Builder.Teams.Tests/SigninAuthTests.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Teams.Tests 6 | { 7 | using System.IO; 8 | using System.Threading.Tasks; 9 | using Microsoft.Bot.Schema; 10 | using Microsoft.VisualStudio.TestTools.UnitTesting; 11 | using Newtonsoft.Json; 12 | 13 | /// 14 | /// Signin card auth flow tests. 15 | /// 16 | [TestClass] 17 | public class SigninAuthTests 18 | { 19 | /// 20 | /// Tests IsRequestSigninStateVerificationQuery logic by providing a file where the invoke payload is valid. 21 | /// 22 | /// Task tracking operation. 23 | [TestMethod] 24 | public async Task SigninAuthTests_IsSigninAuthValidStateVerificationInvokeAsync() 25 | { 26 | Activity sampleActivity = JsonConvert.DeserializeObject(File.ReadAllText(@"Jsons\SampleActivitySigninAuthStateVerification.json")); 27 | await TestHelpers.RunTestPipelineWithActivityAsync( 28 | sampleActivity, 29 | (teamsContext) => 30 | { 31 | Assert.IsTrue(teamsContext.IsRequestSigninStateVerificationQuery()); 32 | return Task.CompletedTask; 33 | }).ConfigureAwait(false); 34 | } 35 | 36 | /// 37 | /// Tests IsRequestSigninStateVerificationQuery logic by providing a file where the invoke payload is invalid. 38 | /// 39 | /// Task tracking operation. 40 | [TestMethod] 41 | public async Task SigninAuthTests_IsSigninAuthInvalidStateVerificationInvokeAsync() 42 | { 43 | Activity sampleActivity = JsonConvert.DeserializeObject(File.ReadAllText(@"Jsons\SampleActivityInvoke.json")); 44 | await TestHelpers.RunTestPipelineWithActivityAsync( 45 | sampleActivity, 46 | (teamsContext) => 47 | { 48 | Assert.IsFalse(teamsContext.IsRequestSigninStateVerificationQuery()); 49 | return Task.CompletedTask; 50 | }).ConfigureAwait(false); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Schema.Teams/Generated/MessagingExtensionAttachment.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // Licensed under the MIT License. See License.txt in the project root for 4 | // license information. 5 | // 6 | // Code generated by Microsoft (R) AutoRest Code Generator. 7 | // Changes may cause incorrect behavior and will be lost if the code is 8 | // regenerated. 9 | // 10 | 11 | namespace Microsoft.Bot.Schema.Teams 12 | { 13 | using Newtonsoft.Json; 14 | using System.Linq; 15 | 16 | /// 17 | /// Messaging extension attachment. 18 | /// 19 | public partial class MessagingExtensionAttachment : Attachment 20 | { 21 | /// 22 | /// Initializes a new instance of the MessagingExtensionAttachment 23 | /// class. 24 | /// 25 | public MessagingExtensionAttachment() 26 | { 27 | CustomInit(); 28 | } 29 | 30 | /// 31 | /// Initializes a new instance of the MessagingExtensionAttachment 32 | /// class. 33 | /// 34 | /// mimetype/Contenttype for the file 35 | /// Content Url 36 | /// Embedded content 37 | /// (OPTIONAL) The name of the attachment 38 | /// (OPTIONAL) Thumbnail associated with 39 | /// attachment 40 | public MessagingExtensionAttachment(string contentType = default(string), string contentUrl = default(string), object content = default(object), string name = default(string), string thumbnailUrl = default(string), Attachment preview = default(Attachment)) 41 | : base(contentType, contentUrl, content, name, thumbnailUrl) 42 | { 43 | Preview = preview; 44 | CustomInit(); 45 | } 46 | 47 | /// 48 | /// An initialization method that performs custom operations like setting defaults 49 | /// 50 | partial void CustomInit(); 51 | 52 | /// 53 | /// 54 | [JsonProperty(PropertyName = "preview")] 55 | public Attachment Preview { get; set; } 56 | 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Schema.Teams/Generated/O365ConnectorCardOpenUri.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // Licensed under the MIT License. See License.txt in the project root for 4 | // license information. 5 | // 6 | // Code generated by Microsoft (R) AutoRest Code Generator. 7 | // Changes may cause incorrect behavior and will be lost if the code is 8 | // regenerated. 9 | // 10 | 11 | namespace Microsoft.Bot.Schema.Teams 12 | { 13 | using Newtonsoft.Json; 14 | using System.Collections; 15 | using System.Collections.Generic; 16 | using System.Linq; 17 | 18 | /// 19 | /// O365 connector card OpenUri action 20 | /// 21 | public partial class O365ConnectorCardOpenUri : O365ConnectorCardActionBase 22 | { 23 | /// 24 | /// Initializes a new instance of the O365ConnectorCardOpenUri class. 25 | /// 26 | public O365ConnectorCardOpenUri() 27 | { 28 | CustomInit(); 29 | } 30 | 31 | /// 32 | /// Initializes a new instance of the O365ConnectorCardOpenUri class. 33 | /// 34 | /// Type of the action. Possible values include: 35 | /// 'ViewAction', 'OpenUri', 'HttpPOST', 'ActionCard' 36 | /// Name of the action that will be used as button 37 | /// title 38 | /// Action Id 39 | /// Target os / urls 40 | public O365ConnectorCardOpenUri(string type = default(string), string name = default(string), string id = default(string), IList targets = default(IList)) 41 | : base(type, name, id) 42 | { 43 | Targets = targets; 44 | CustomInit(); 45 | } 46 | 47 | /// 48 | /// An initialization method that performs custom operations like setting defaults 49 | /// 50 | partial void CustomInit(); 51 | 52 | /// 53 | /// Gets or sets target os / urls 54 | /// 55 | [JsonProperty(PropertyName = "targets")] 56 | public IList Targets { get; set; } 57 | 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Builder.Teams/Middlewares/DropNonTeamsActivitiesMiddleware.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Teams.Middlewares 6 | { 7 | using System; 8 | using System.Threading; 9 | using System.Threading.Tasks; 10 | using Microsoft.Bot.Connector; 11 | 12 | /// 13 | /// Automatically drop all messages received from any channel except Microsoft Teams. 14 | /// 15 | public class DropNonTeamsActivitiesMiddleware : IMiddleware 16 | { 17 | /// 18 | /// When implemented in middleware, processess an incoming activity. 19 | /// 20 | /// The context object for this turn. 21 | /// The delegate to call to continue the bot middleware pipeline. 22 | /// A cancellation token that can be used by other objects 23 | /// or threads to receive notice of cancellation. 24 | /// 25 | /// A task that represents the work queued to execute. 26 | /// 27 | /// 28 | /// Middleware calls the delegate to pass control to 29 | /// the next middleware in the pipeline. If middleware doesn’t call the next delegate, 30 | /// the adapter does not call any of the subsequent middleware’s request handlers or the 31 | /// bot’s receive handler, and the pipeline short circuits. 32 | /// The provides information about the 33 | /// incoming activity, and other data needed to process the activity. 34 | /// 35 | /// 36 | /// 37 | public async Task OnTurnAsync(ITurnContext turnContext, NextDelegate next, CancellationToken cancellationToken = default(CancellationToken)) 38 | { 39 | BotAssert.ContextNotNull(turnContext); 40 | 41 | if (turnContext.Activity.ChannelId.Equals(Channels.Msteams, StringComparison.OrdinalIgnoreCase)) 42 | { 43 | await next(cancellationToken).ConfigureAwait(false); 44 | } 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Schema.Teams/Generated/TeamDetails.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // Licensed under the MIT License. See License.txt in the project root for 4 | // license information. 5 | // 6 | // Code generated by Microsoft (R) AutoRest Code Generator. 7 | // Changes may cause incorrect behavior and will be lost if the code is 8 | // regenerated. 9 | // 10 | 11 | namespace Microsoft.Bot.Schema.Teams 12 | { 13 | using Newtonsoft.Json; 14 | using System.Linq; 15 | 16 | /// 17 | /// Details related to a team 18 | /// 19 | public partial class TeamDetails 20 | { 21 | /// 22 | /// Initializes a new instance of the TeamDetails class. 23 | /// 24 | public TeamDetails() 25 | { 26 | CustomInit(); 27 | } 28 | 29 | /// 30 | /// Initializes a new instance of the TeamDetails class. 31 | /// 32 | /// Unique identifier representing a team 33 | /// Name of team. 34 | /// Azure Active Directory (AAD) Group Id for 35 | /// the team. 36 | public TeamDetails(string id = default(string), string name = default(string), string aadGroupId = default(string)) 37 | { 38 | Id = id; 39 | Name = name; 40 | AadGroupId = aadGroupId; 41 | CustomInit(); 42 | } 43 | 44 | /// 45 | /// An initialization method that performs custom operations like setting defaults 46 | /// 47 | partial void CustomInit(); 48 | 49 | /// 50 | /// Gets or sets unique identifier representing a team 51 | /// 52 | [JsonProperty(PropertyName = "id")] 53 | public string Id { get; set; } 54 | 55 | /// 56 | /// Gets or sets name of team. 57 | /// 58 | [JsonProperty(PropertyName = "name")] 59 | public string Name { get; set; } 60 | 61 | /// 62 | /// Gets or sets azure Active Directory (AAD) Group Id for the team. 63 | /// 64 | [JsonProperty(PropertyName = "aadGroupId")] 65 | public string AadGroupId { get; set; } 66 | 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Schema.Teams/Generated/O365ConnectorCardViewAction.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // Licensed under the MIT License. See License.txt in the project root for 4 | // license information. 5 | // 6 | // Code generated by Microsoft (R) AutoRest Code Generator. 7 | // Changes may cause incorrect behavior and will be lost if the code is 8 | // regenerated. 9 | // 10 | 11 | namespace Microsoft.Bot.Schema.Teams 12 | { 13 | using Newtonsoft.Json; 14 | using System.Collections; 15 | using System.Collections.Generic; 16 | using System.Linq; 17 | 18 | /// 19 | /// O365 connector card ViewAction action 20 | /// 21 | public partial class O365ConnectorCardViewAction : O365ConnectorCardActionBase 22 | { 23 | /// 24 | /// Initializes a new instance of the O365ConnectorCardViewAction 25 | /// class. 26 | /// 27 | public O365ConnectorCardViewAction() 28 | { 29 | CustomInit(); 30 | } 31 | 32 | /// 33 | /// Initializes a new instance of the O365ConnectorCardViewAction 34 | /// class. 35 | /// 36 | /// Type of the action. Possible values include: 37 | /// 'ViewAction', 'OpenUri', 'HttpPOST', 'ActionCard' 38 | /// Name of the action that will be used as button 39 | /// title 40 | /// Action Id 41 | /// Target urls, only the first url effective for 42 | /// card button 43 | public O365ConnectorCardViewAction(string type = default(string), string name = default(string), string id = default(string), IList target = default(IList)) 44 | : base(type, name, id) 45 | { 46 | Target = target; 47 | CustomInit(); 48 | } 49 | 50 | /// 51 | /// An initialization method that performs custom operations like setting defaults 52 | /// 53 | partial void CustomInit(); 54 | 55 | /// 56 | /// Gets or sets target urls, only the first url effective for card 57 | /// button 58 | /// 59 | [JsonProperty(PropertyName = "target")] 60 | public IList Target { get; set; } 61 | 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Schema.Teams/Generated/O365ConnectorCardActionQuery.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // Licensed under the MIT License. See License.txt in the project root for 4 | // license information. 5 | // 6 | // Code generated by Microsoft (R) AutoRest Code Generator. 7 | // Changes may cause incorrect behavior and will be lost if the code is 8 | // regenerated. 9 | // 10 | 11 | namespace Microsoft.Bot.Schema.Teams 12 | { 13 | using Newtonsoft.Json; 14 | using System.Linq; 15 | 16 | /// 17 | /// O365 connector card HttpPOST invoke query 18 | /// 19 | public partial class O365ConnectorCardActionQuery 20 | { 21 | /// 22 | /// Initializes a new instance of the O365ConnectorCardActionQuery 23 | /// class. 24 | /// 25 | public O365ConnectorCardActionQuery() 26 | { 27 | CustomInit(); 28 | } 29 | 30 | /// 31 | /// Initializes a new instance of the O365ConnectorCardActionQuery 32 | /// class. 33 | /// 34 | /// The results of body string defined in 35 | /// IO365ConnectorCardHttpPOST with substituted input values 36 | /// Action Id associated with the HttpPOST 37 | /// action button triggered, defined in 38 | /// O365ConnectorCardActionBase. 39 | public O365ConnectorCardActionQuery(string body = default(string), string actionId = default(string)) 40 | { 41 | Body = body; 42 | ActionId = actionId; 43 | CustomInit(); 44 | } 45 | 46 | /// 47 | /// An initialization method that performs custom operations like setting defaults 48 | /// 49 | partial void CustomInit(); 50 | 51 | /// 52 | /// Gets or sets the results of body string defined in 53 | /// IO365ConnectorCardHttpPOST with substituted input values 54 | /// 55 | [JsonProperty(PropertyName = "body")] 56 | public string Body { get; set; } 57 | 58 | /// 59 | /// Gets or sets action Id associated with the HttpPOST action button 60 | /// triggered, defined in O365ConnectorCardActionBase. 61 | /// 62 | [JsonProperty(PropertyName = "actionId")] 63 | public string ActionId { get; set; } 64 | 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Schema.Teams/Generated/O365ConnectorCardActionBase.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // Licensed under the MIT License. See License.txt in the project root for 4 | // license information. 5 | // 6 | // Code generated by Microsoft (R) AutoRest Code Generator. 7 | // Changes may cause incorrect behavior and will be lost if the code is 8 | // regenerated. 9 | // 10 | 11 | namespace Microsoft.Bot.Schema.Teams 12 | { 13 | using Newtonsoft.Json; 14 | using System.Linq; 15 | 16 | /// 17 | /// O365 connector card action base 18 | /// 19 | public partial class O365ConnectorCardActionBase 20 | { 21 | /// 22 | /// Initializes a new instance of the O365ConnectorCardActionBase 23 | /// class. 24 | /// 25 | public O365ConnectorCardActionBase() 26 | { 27 | CustomInit(); 28 | } 29 | 30 | /// 31 | /// Initializes a new instance of the O365ConnectorCardActionBase 32 | /// class. 33 | /// 34 | /// Type of the action. Possible values include: 35 | /// 'ViewAction', 'OpenUri', 'HttpPOST', 'ActionCard' 36 | /// Name of the action that will be used as button 37 | /// title 38 | /// Action Id 39 | public O365ConnectorCardActionBase(string type = default(string), string name = default(string), string id = default(string)) 40 | { 41 | Type = type; 42 | Name = name; 43 | Id = id; 44 | CustomInit(); 45 | } 46 | 47 | /// 48 | /// An initialization method that performs custom operations like setting defaults 49 | /// 50 | partial void CustomInit(); 51 | 52 | /// 53 | /// Gets or sets type of the action. Possible values include: 54 | /// 'ViewAction', 'OpenUri', 'HttpPOST', 'ActionCard' 55 | /// 56 | [JsonProperty(PropertyName = "@type")] 57 | public string Type { get; set; } 58 | 59 | /// 60 | /// Gets or sets name of the action that will be used as button title 61 | /// 62 | [JsonProperty(PropertyName = "name")] 63 | public string Name { get; set; } 64 | 65 | /// 66 | /// Gets or sets action Id 67 | /// 68 | [JsonProperty(PropertyName = "@id")] 69 | public string Id { get; set; } 70 | 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Schema.Teams/Generated/O365ConnectorCardDateInput.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // Licensed under the MIT License. See License.txt in the project root for 4 | // license information. 5 | // 6 | // Code generated by Microsoft (R) AutoRest Code Generator. 7 | // Changes may cause incorrect behavior and will be lost if the code is 8 | // regenerated. 9 | // 10 | 11 | namespace Microsoft.Bot.Schema.Teams 12 | { 13 | using Newtonsoft.Json; 14 | using System.Linq; 15 | 16 | /// 17 | /// O365 connector card date input 18 | /// 19 | public partial class O365ConnectorCardDateInput : O365ConnectorCardInputBase 20 | { 21 | /// 22 | /// Initializes a new instance of the O365ConnectorCardDateInput class. 23 | /// 24 | public O365ConnectorCardDateInput() 25 | { 26 | CustomInit(); 27 | } 28 | 29 | /// 30 | /// Initializes a new instance of the O365ConnectorCardDateInput class. 31 | /// 32 | /// Input type name. Possible values include: 33 | /// 'textInput', 'dateInput', 'multichoiceInput' 34 | /// Input Id. It must be unique per entire O365 35 | /// connector card. 36 | /// Define if this input is a required field. 37 | /// Default value is false. 38 | /// Input title that will be shown as the 39 | /// placeholder 40 | /// Default value for this input field 41 | /// Include time input field. Default value 42 | /// is false (date only). 43 | public O365ConnectorCardDateInput(string type = default(string), string id = default(string), bool? isRequired = default(bool?), string title = default(string), string value = default(string), bool? includeTime = default(bool?)) 44 | : base(type, id, isRequired, title, value) 45 | { 46 | IncludeTime = includeTime; 47 | CustomInit(); 48 | } 49 | 50 | /// 51 | /// An initialization method that performs custom operations like setting defaults 52 | /// 53 | partial void CustomInit(); 54 | 55 | /// 56 | /// Gets or sets include time input field. Default value is false 57 | /// (date only). 58 | /// 59 | [JsonProperty(PropertyName = "includeTime")] 60 | public bool? IncludeTime { get; set; } 61 | 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Schema.Teams/Generated/FileDownloadInfo.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // Licensed under the MIT License. See License.txt in the project root for 4 | // license information. 5 | // 6 | // Code generated by Microsoft (R) AutoRest Code Generator. 7 | // Changes may cause incorrect behavior and will be lost if the code is 8 | // regenerated. 9 | // 10 | 11 | namespace Microsoft.Bot.Schema.Teams 12 | { 13 | using Newtonsoft.Json; 14 | using System.Linq; 15 | 16 | /// 17 | /// File download info attachment. 18 | /// 19 | public partial class FileDownloadInfo 20 | { 21 | /// 22 | /// Initializes a new instance of the FileDownloadInfo class. 23 | /// 24 | public FileDownloadInfo() 25 | { 26 | CustomInit(); 27 | } 28 | 29 | /// 30 | /// Initializes a new instance of the FileDownloadInfo class. 31 | /// 32 | /// File download url. 33 | /// Unique Id for the file. 34 | /// Type of file. 35 | /// ETag for the file. 36 | public FileDownloadInfo(string downloadUrl = default(string), string uniqueId = default(string), string fileType = default(string), object etag = default(object)) 37 | { 38 | DownloadUrl = downloadUrl; 39 | UniqueId = uniqueId; 40 | FileType = fileType; 41 | Etag = etag; 42 | CustomInit(); 43 | } 44 | 45 | /// 46 | /// An initialization method that performs custom operations like setting defaults 47 | /// 48 | partial void CustomInit(); 49 | 50 | /// 51 | /// Gets or sets file download url. 52 | /// 53 | [JsonProperty(PropertyName = "downloadUrl")] 54 | public string DownloadUrl { get; set; } 55 | 56 | /// 57 | /// Gets or sets unique Id for the file. 58 | /// 59 | [JsonProperty(PropertyName = "uniqueId")] 60 | public string UniqueId { get; set; } 61 | 62 | /// 63 | /// Gets or sets type of file. 64 | /// 65 | [JsonProperty(PropertyName = "fileType")] 66 | public string FileType { get; set; } 67 | 68 | /// 69 | /// Gets or sets eTag for the file. 70 | /// 71 | [JsonProperty(PropertyName = "etag")] 72 | public object Etag { get; set; } 73 | 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Schema.Teams/Generated/MessageActionsPayloadMention.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // Licensed under the MIT License. See License.txt in the project root for 4 | // license information. 5 | // 6 | // Code generated by Microsoft (R) AutoRest Code Generator. 7 | // Changes may cause incorrect behavior and will be lost if the code is 8 | // regenerated. 9 | // 10 | 11 | namespace Microsoft.Bot.Schema.Teams 12 | { 13 | using Newtonsoft.Json; 14 | using System.Linq; 15 | 16 | /// 17 | /// Represents the entity that was mentioned in the message. 18 | /// 19 | public partial class MessageActionsPayloadMention 20 | { 21 | /// 22 | /// Initializes a new instance of the MessageActionsPayloadMention 23 | /// class. 24 | /// 25 | public MessageActionsPayloadMention() 26 | { 27 | CustomInit(); 28 | } 29 | 30 | /// 31 | /// Initializes a new instance of the MessageActionsPayloadMention 32 | /// class. 33 | /// 34 | /// The id of the mentioned entity. 35 | /// The plaintext display name of the 36 | /// mentioned entity. 37 | /// Provides more details on the mentioned 38 | /// entity. 39 | public MessageActionsPayloadMention(int? id = default(int?), string mentionText = default(string), MessageActionsPayloadFrom mentioned = default(MessageActionsPayloadFrom)) 40 | { 41 | Id = id; 42 | MentionText = mentionText; 43 | Mentioned = mentioned; 44 | CustomInit(); 45 | } 46 | 47 | /// 48 | /// An initialization method that performs custom operations like setting defaults 49 | /// 50 | partial void CustomInit(); 51 | 52 | /// 53 | /// Gets or sets the id of the mentioned entity. 54 | /// 55 | [JsonProperty(PropertyName = "id")] 56 | public int? Id { get; set; } 57 | 58 | /// 59 | /// Gets or sets the plaintext display name of the mentioned entity. 60 | /// 61 | [JsonProperty(PropertyName = "mentionText")] 62 | public string MentionText { get; set; } 63 | 64 | /// 65 | /// Gets or sets provides more details on the mentioned entity. 66 | /// 67 | [JsonProperty(PropertyName = "mentioned")] 68 | public MessageActionsPayloadFrom Mentioned { get; set; } 69 | 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Connector.Teams/ITeamsConnectorClient.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // Licensed under the MIT License. See License.txt in the project root for 4 | // license information. 5 | // 6 | // Code generated by Microsoft (R) AutoRest Code Generator. 7 | // Changes may cause incorrect behavior and will be lost if the code is 8 | // regenerated. 9 | // 10 | 11 | namespace Microsoft.Bot.Connector.Teams 12 | { 13 | using Microsoft.Rest; 14 | using Microsoft.Bot.Schema.Teams; 15 | using Newtonsoft.Json; 16 | 17 | /// 18 | /// The Bot Connector REST API extension for Microsoft Teams allows your 19 | /// bot to perform extended operations on to Microsoft Teams channel 20 | /// configured in the 21 | /// [Bot Framework Developer Portal](https://dev.botframework.com). The 22 | /// Connector service uses industry-standard REST and JSON over HTTPS. 23 | /// 24 | /// Client libraries for this REST API are available. See below for a list. 25 | /// 26 | /// 27 | /// 28 | /// Authentication for both the Bot Connector and Bot State REST APIs is 29 | /// accomplished with JWT Bearer tokens, and is 30 | /// described in detail in the [Connector 31 | /// Authentication](https://docs.botframework.com/en-us/restapi/authentication) 32 | /// document. 33 | /// 34 | /// # Client Libraries for the Bot Connector REST API 35 | /// 36 | /// * [Bot Builder for 37 | /// C#](https://docs.botframework.com/en-us/csharp/builder/sdkreference/) 38 | /// * [Bot Builder for 39 | /// Node.js](https://docs.botframework.com/en-us/node/builder/overview/) 40 | /// 41 | /// © 2016 Microsoft 42 | /// 43 | public partial interface ITeamsConnectorClient : System.IDisposable 44 | { 45 | /// 46 | /// The base URI of the service. 47 | /// 48 | System.Uri BaseUri { get; set; } 49 | 50 | /// 51 | /// Gets or sets json serialization settings. 52 | /// 53 | JsonSerializerSettings SerializationSettings { get; } 54 | 55 | /// 56 | /// Gets or sets json deserialization settings. 57 | /// 58 | JsonSerializerSettings DeserializationSettings { get; } 59 | 60 | /// 61 | /// Subscription credentials which uniquely identify client 62 | /// subscription. 63 | /// 64 | ServiceClientCredentials Credentials { get; } 65 | 66 | 67 | /// 68 | /// Gets the ITeamsOperations. 69 | /// 70 | ITeamsOperations Teams { get; } 71 | 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /CSharp/Samples/Microsoft.Bot.Builder.Teams.WikipediaMessagingExtension/Engine/TeamsInvokeActivityHandler.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Licensed under the MIT License. 3 | // 4 | 5 | namespace Microsoft.Bot.Builder.Teams.WikipediaMessagingExtension.Engine 6 | { 7 | using System; 8 | using System.Threading.Tasks; 9 | using Microsoft.Bot.Builder.Abstractions.Teams; 10 | using Microsoft.Bot.Schema.Teams; 11 | 12 | /// 13 | /// Handles Teams invoke activity. 14 | /// 15 | /// 16 | public class TeamsInvokeActivityHandler : TeamsInvokeActivityHandlerBase 17 | { 18 | /// 19 | /// The search handler 20 | /// 21 | private readonly ISearchHandler searchHandler; 22 | 23 | /// 24 | /// Initializes a new instance of the class. 25 | /// 26 | /// The search handler. 27 | public TeamsInvokeActivityHandler(ISearchHandler searchHandler) 28 | { 29 | this.searchHandler = searchHandler; 30 | } 31 | 32 | /// 33 | /// Handles the messaging extension action asynchronously. 34 | /// 35 | /// The turn context 36 | /// The invoke query object 37 | /// 38 | /// Task tracking operation. 39 | /// 40 | public async Task HandleMessagingExtensionQueryAsync(TurnContext turnContext, MessagingExtensionQuery query) 41 | { 42 | try 43 | { 44 | return new InvokeResponse 45 | { 46 | Body = new MessagingExtensionResponse 47 | { 48 | ComposeExtension = await this.searchHandler.GetSearchResultAsync(query).ConfigureAwait(false), 49 | }, 50 | Status = 200, 51 | }; 52 | } 53 | catch (Exception ex) 54 | { 55 | return new InvokeResponse 56 | { 57 | Body = new MessagingExtensionResponse 58 | { 59 | ComposeExtension = new MessagingExtensionResult 60 | { 61 | Text = "Failed to search " + ex.Message, 62 | Type = "message", 63 | }, 64 | }, 65 | Status = 200, 66 | }; 67 | } 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /CSharp/Microsoft.Bot.Schema.Teams/Generated/MessageActionsPayloadUser.cs: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // Licensed under the MIT License. See License.txt in the project root for 4 | // license information. 5 | // 6 | // Code generated by Microsoft (R) AutoRest Code Generator. 7 | // Changes may cause incorrect behavior and will be lost if the code is 8 | // regenerated. 9 | // 10 | 11 | namespace Microsoft.Bot.Schema.Teams 12 | { 13 | using Newtonsoft.Json; 14 | using System.Linq; 15 | 16 | /// 17 | /// Represents a user entity. 18 | /// 19 | public partial class MessageActionsPayloadUser 20 | { 21 | /// 22 | /// Initializes a new instance of the MessageActionsPayloadUser class. 23 | /// 24 | public MessageActionsPayloadUser() 25 | { 26 | CustomInit(); 27 | } 28 | 29 | /// 30 | /// Initializes a new instance of the MessageActionsPayloadUser class. 31 | /// 32 | /// The identity type of the user. 33 | /// Possible values include: 'aadUser', 'onPremiseAadUser', 34 | /// 'anonymousGuest', 'federatedUser' 35 | /// The id of the user. 36 | /// The plaintext display name of the 37 | /// user. 38 | public MessageActionsPayloadUser(string userIdentityType = default(string), string id = default(string), string displayName = default(string)) 39 | { 40 | UserIdentityType = userIdentityType; 41 | Id = id; 42 | DisplayName = displayName; 43 | CustomInit(); 44 | } 45 | 46 | /// 47 | /// An initialization method that performs custom operations like setting defaults 48 | /// 49 | partial void CustomInit(); 50 | 51 | /// 52 | /// Gets or sets the identity type of the user. Possible values 53 | /// include: 'aadUser', 'onPremiseAadUser', 'anonymousGuest', 54 | /// 'federatedUser' 55 | /// 56 | [JsonProperty(PropertyName = "userIdentityType")] 57 | public string UserIdentityType { get; set; } 58 | 59 | /// 60 | /// Gets or sets the id of the user. 61 | /// 62 | [JsonProperty(PropertyName = "id")] 63 | public string Id { get; set; } 64 | 65 | /// 66 | /// Gets or sets the plaintext display name of the user. 67 | /// 68 | [JsonProperty(PropertyName = "displayName")] 69 | public string DisplayName { get; set; } 70 | 71 | } 72 | } 73 | --------------------------------------------------------------------------------