From 54624302cdd316e6bfbd3c6de95f1eccbdaf8b46 Mon Sep 17 00:00:00 2001
From: Emilio Munoz
Date: Fri, 24 Apr 2020 15:12:16 -0700
Subject: [PATCH 1/4] Adding sample 58
---
.../LICENSE | 21 +
.../README.md | 60 +++
.../new-rg-parameters.json | 42 ++
.../preexisting-rg-parameters.json | 39 ++
.../template-with-new-rg.json | 191 ++++++++
.../template-with-preexisting-rg.json | 158 +++++++
.../pom.xml | 318 +++++++++++++
.../teamsstartnewthread/Application.java | 47 ++
.../TeamsStartNewThreadBot.java | 85 ++++
.../src/main/resources/application.properties | 2 +
.../src/main/resources/log4j2.json | 18 +
.../src/main/webapp/META-INF/MANIFEST.MF | 3 +
.../src/main/webapp/WEB-INF/web.xml | 12 +
.../src/main/webapp/index.html | 418 ++++++++++++++++++
.../teamsstartnewthread/ApplicationTests.java | 19 +
.../teamsAppManifest/icon-color.png | Bin 0 -> 1229 bytes
.../teamsAppManifest/icon-outline.png | Bin 0 -> 383 bytes
.../teamsAppManifest/manifest.json | 41 ++
18 files changed, 1474 insertions(+)
create mode 100644 samples/58.teams-start-new-thread-in-channel/LICENSE
create mode 100644 samples/58.teams-start-new-thread-in-channel/README.md
create mode 100644 samples/58.teams-start-new-thread-in-channel/deploymentTemplates/new-rg-parameters.json
create mode 100644 samples/58.teams-start-new-thread-in-channel/deploymentTemplates/preexisting-rg-parameters.json
create mode 100644 samples/58.teams-start-new-thread-in-channel/deploymentTemplates/template-with-new-rg.json
create mode 100644 samples/58.teams-start-new-thread-in-channel/deploymentTemplates/template-with-preexisting-rg.json
create mode 100644 samples/58.teams-start-new-thread-in-channel/pom.xml
create mode 100644 samples/58.teams-start-new-thread-in-channel/src/main/java/com/microsoft/bot/sample/teamsstartnewthread/Application.java
create mode 100644 samples/58.teams-start-new-thread-in-channel/src/main/java/com/microsoft/bot/sample/teamsstartnewthread/TeamsStartNewThreadBot.java
create mode 100644 samples/58.teams-start-new-thread-in-channel/src/main/resources/application.properties
create mode 100644 samples/58.teams-start-new-thread-in-channel/src/main/resources/log4j2.json
create mode 100644 samples/58.teams-start-new-thread-in-channel/src/main/webapp/META-INF/MANIFEST.MF
create mode 100644 samples/58.teams-start-new-thread-in-channel/src/main/webapp/WEB-INF/web.xml
create mode 100644 samples/58.teams-start-new-thread-in-channel/src/main/webapp/index.html
create mode 100644 samples/58.teams-start-new-thread-in-channel/src/test/java/com/microsoft/bot/sample/teamsstartnewthread/ApplicationTests.java
create mode 100644 samples/58.teams-start-new-thread-in-channel/teamsAppManifest/icon-color.png
create mode 100644 samples/58.teams-start-new-thread-in-channel/teamsAppManifest/icon-outline.png
create mode 100644 samples/58.teams-start-new-thread-in-channel/teamsAppManifest/manifest.json
diff --git a/samples/58.teams-start-new-thread-in-channel/LICENSE b/samples/58.teams-start-new-thread-in-channel/LICENSE
new file mode 100644
index 000000000..21071075c
--- /dev/null
+++ b/samples/58.teams-start-new-thread-in-channel/LICENSE
@@ -0,0 +1,21 @@
+ MIT License
+
+ Copyright (c) Microsoft Corporation. All rights reserved.
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE
diff --git a/samples/58.teams-start-new-thread-in-channel/README.md b/samples/58.teams-start-new-thread-in-channel/README.md
new file mode 100644
index 000000000..bd926f830
--- /dev/null
+++ b/samples/58.teams-start-new-thread-in-channel/README.md
@@ -0,0 +1,60 @@
+# Teams Task Module
+
+Bot Framework Teams Task Module sample.
+
+ This sample shows how to incorporate basic conversational flow into a Teams application. It also illustrates a few of the Teams specific calls you can make from your bot.
+
+## Prerequisites
+
+- Microsoft Teams is installed and you have an account
+- [ngrok](https://ngrok.com/) or equivalent tunnelling solution
+
+## To try this sample
+
+> Note these instructions are for running the sample on your local machine, the tunnelling solution is required because
+the Teams service needs to call into the bot.
+
+1) Clone the repository
+
+ ```bash
+ git clone https://github.com/Microsoft/botbuilder-java.git
+ ```
+
+1) Run ngrok - point to port 8080
+
+ ```bash
+ ngrok http -host-header=rewrite 8080
+ ```
+
+1) Create [Bot Framework registration resource](https://docs.microsoft.com/en-us/azure/bot-service/bot-service-quickstart-registration) in Azure
+ - Use the current `https` URL you were given by running ngrok. Append with the path `/api/messages` used by this sample
+ - Ensure that you've [enabled the Teams Channel](https://docs.microsoft.com/en-us/azure/bot-service/channel-connect-teams?view=azure-bot-service-4.0)
+ - __*If you don't have an Azure account*__ you can use this [Bot Framework registration](https://docs.microsoft.com/en-us/microsoftteams/platform/bots/how-to/create-a-bot-for-teams#register-your-web-service-with-the-bot-framework)
+
+1) Update the `resources/application.properties` configuration for the bot to use the Microsoft App Id and App Password from the Bot Framework registration. (Note the App Password is referred to as the "client secret" in the azure portal and you can always create a new client secret anytime.)
+
+1) __*This step is specific to Teams.*__
+ - **Edit** the `manifest.json` contained in the `teamsAppManifest` folder to replace your Microsoft App Id (that was created when you registered your bot earlier) *everywhere* you see the place holder string `<>` (depending on the scenario the Microsoft App Id may occur multiple times in the `manifest.json`)
+ - **Zip** up the contents of the `teamsAppManifest` folder to create a `manifest.zip`
+ - **Upload** the `manifest.zip` to Teams (in the Apps view click "Upload a custom app")
+
+1) From the root of this project folder:
+ - Build the sample using `mvn package`
+ - Unless done previously, install the packages in the local cache by using `mvn install`
+ - Run it by using `java -jar .\target\bot-teams-task-module-sample.jar`
+
+
+## Interacting with the bot in Teams
+
+> Note this `manifest.json` specified that the bot will be installed in "personal", "team" and "groupchat" scope which is why you immediately entered a one on one chat conversation with the bot. You can at mention the bot in a group chat or in a Channel in the Team you installed it in. Please refer to Teams documentation for more details.
+
+You can interact with this bot by sending it a message. The bot will respond by creating a new thread in the channel and replying to that new thread.
+
+## Deploy the bot to Azure
+
+To learn more about deploying a bot to Azure, see [Deploy your bot to Azure](https://aka.ms/azuredeployment) for a complete list of deployment instructions.
+
+## Further reading
+
+- [How Microsoft Teams bots work](https://docs.microsoft.com/en-us/azure/bot-service/bot-builder-basics-teams?view=azure-bot-service-4.0&tabs=javascript)
+
diff --git a/samples/58.teams-start-new-thread-in-channel/deploymentTemplates/new-rg-parameters.json b/samples/58.teams-start-new-thread-in-channel/deploymentTemplates/new-rg-parameters.json
new file mode 100644
index 000000000..ead339093
--- /dev/null
+++ b/samples/58.teams-start-new-thread-in-channel/deploymentTemplates/new-rg-parameters.json
@@ -0,0 +1,42 @@
+{
+ "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
+ "contentVersion": "1.0.0.0",
+ "parameters": {
+ "groupLocation": {
+ "value": ""
+ },
+ "groupName": {
+ "value": ""
+ },
+ "appId": {
+ "value": ""
+ },
+ "appSecret": {
+ "value": ""
+ },
+ "botId": {
+ "value": ""
+ },
+ "botSku": {
+ "value": ""
+ },
+ "newAppServicePlanName": {
+ "value": ""
+ },
+ "newAppServicePlanSku": {
+ "value": {
+ "name": "S1",
+ "tier": "Standard",
+ "size": "S1",
+ "family": "S",
+ "capacity": 1
+ }
+ },
+ "newAppServicePlanLocation": {
+ "value": ""
+ },
+ "newWebAppName": {
+ "value": ""
+ }
+ }
+}
\ No newline at end of file
diff --git a/samples/58.teams-start-new-thread-in-channel/deploymentTemplates/preexisting-rg-parameters.json b/samples/58.teams-start-new-thread-in-channel/deploymentTemplates/preexisting-rg-parameters.json
new file mode 100644
index 000000000..b6f5114fc
--- /dev/null
+++ b/samples/58.teams-start-new-thread-in-channel/deploymentTemplates/preexisting-rg-parameters.json
@@ -0,0 +1,39 @@
+{
+ "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
+ "contentVersion": "1.0.0.0",
+ "parameters": {
+ "appId": {
+ "value": ""
+ },
+ "appSecret": {
+ "value": ""
+ },
+ "botId": {
+ "value": ""
+ },
+ "botSku": {
+ "value": ""
+ },
+ "newAppServicePlanName": {
+ "value": ""
+ },
+ "newAppServicePlanSku": {
+ "value": {
+ "name": "S1",
+ "tier": "Standard",
+ "size": "S1",
+ "family": "S",
+ "capacity": 1
+ }
+ },
+ "appServicePlanLocation": {
+ "value": ""
+ },
+ "existingAppServicePlan": {
+ "value": ""
+ },
+ "newWebAppName": {
+ "value": ""
+ }
+ }
+}
\ No newline at end of file
diff --git a/samples/58.teams-start-new-thread-in-channel/deploymentTemplates/template-with-new-rg.json b/samples/58.teams-start-new-thread-in-channel/deploymentTemplates/template-with-new-rg.json
new file mode 100644
index 000000000..dcd6260a5
--- /dev/null
+++ b/samples/58.teams-start-new-thread-in-channel/deploymentTemplates/template-with-new-rg.json
@@ -0,0 +1,191 @@
+{
+ "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
+ "contentVersion": "1.0.0.0",
+ "parameters": {
+ "groupLocation": {
+ "defaultValue": "",
+ "type": "string",
+ "metadata": {
+ "description": "Specifies the location of the Resource Group."
+ }
+ },
+ "groupName": {
+ "type": "string",
+ "metadata": {
+ "description": "Specifies the name of the Resource Group."
+ }
+ },
+ "appId": {
+ "type": "string",
+ "metadata": {
+ "description": "Active Directory App ID, set as MicrosoftAppId in the Web App's Application Settings."
+ }
+ },
+ "appSecret": {
+ "type": "string",
+ "metadata": {
+ "description": "Active Directory App Password, set as MicrosoftAppPassword in the Web App's Application Settings."
+ }
+ },
+ "botId": {
+ "type": "string",
+ "metadata": {
+ "description": "The globally unique and immutable bot ID. Also used to configure the displayName of the bot, which is mutable."
+ }
+ },
+ "botSku": {
+ "defaultValue": "F0",
+ "type": "string",
+ "metadata": {
+ "description": "The pricing tier of the Bot Service Registration. Acceptable values are F0 and S1."
+ }
+ },
+ "newAppServicePlanName": {
+ "defaultValue": "",
+ "type": "string",
+ "metadata": {
+ "description": "The name of the App Service Plan."
+ }
+ },
+ "newAppServicePlanSku": {
+ "type": "object",
+ "defaultValue": {
+ "name": "P1v2",
+ "tier": "PremiumV2",
+ "size": "P1v2",
+ "family": "Pv2",
+ "capacity": 1
+ },
+ "metadata": {
+ "description": "The SKU of the App Service Plan. Defaults to Standard values."
+ }
+ },
+ "newAppServicePlanLocation": {
+ "defaultValue": "",
+ "type": "string",
+ "metadata": {
+ "description": "The location of the App Service Plan. Defaults to \"westus\"."
+ }
+ },
+ "newWebAppName": {
+ "type": "string",
+ "defaultValue": "",
+ "metadata": {
+ "description": "The globally unique name of the Web App. Defaults to the value passed in for \"botId\"."
+ }
+ }
+ },
+ "variables": {
+ "resourcesLocation": "[deployment().location]",
+ "effectiveGroupLocation": "[if(empty(parameters('groupLocation')), variables('resourcesLocation'), parameters('groupLocation'))]",
+ "effectivePlanLocation": "[if(empty(parameters('newAppServicePlanLocation')), variables('resourcesLocation'), parameters('newAppServicePlanLocation'))]",
+ "appServicePlanName": "[if(empty(parameters('newAppServicePlanName')), concat(parameters('botId'), 'ServicePlan'), parameters('newAppServicePlanName'))]",
+ "webAppName": "[if(empty(parameters('newWebAppName')), parameters('botId'), parameters('newWebAppName'))]",
+ "siteHost": "[concat(variables('webAppName'), '.azurewebsites.net')]",
+ "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]"
+ },
+ "resources": [
+ {
+ "name": "[parameters('groupName')]",
+ "type": "Microsoft.Resources/resourceGroups",
+ "apiVersion": "2018-05-01",
+ "location": "[variables('effectiveGroupLocation')]",
+ "properties": {
+ }
+ },
+ {
+ "type": "Microsoft.Resources/deployments",
+ "apiVersion": "2018-05-01",
+ "name": "storageDeployment",
+ "resourceGroup": "[parameters('groupName')]",
+ "dependsOn": [
+ "[resourceId('Microsoft.Resources/resourceGroups/', parameters('groupName'))]"
+ ],
+ "properties": {
+ "mode": "Incremental",
+ "template": {
+ "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
+ "contentVersion": "1.0.0.0",
+ "parameters": {},
+ "variables": {},
+ "resources": [
+ {
+ "comments": "Create a new App Service Plan",
+ "type": "Microsoft.Web/serverfarms",
+ "name": "[variables('appServicePlanName')]",
+ "apiVersion": "2018-02-01",
+ "location": "[variables('effectivePlanLocation')]",
+ "sku": "[parameters('newAppServicePlanSku')]",
+ "kind": "linux",
+ "properties": {
+ "name": "[variables('appServicePlanName')]",
+ "reserved":true
+ }
+ },
+ {
+ "comments": "Create a Web App using the new App Service Plan",
+ "type": "Microsoft.Web/sites",
+ "apiVersion": "2015-08-01",
+ "location": "[variables('resourcesLocation')]",
+ "kind": "app",
+ "dependsOn": [
+ "[resourceId('Microsoft.Web/serverfarms/', variables('appServicePlanName'))]"
+ ],
+ "name": "[variables('webAppName')]",
+ "properties": {
+ "name": "[variables('webAppName')]",
+ "serverFarmId": "[variables('appServicePlanName')]",
+ "siteConfig": {
+ "appSettings": [
+ {
+ "name": "JAVA_OPTS",
+ "value": "-Dserver.port=80"
+ },
+ {
+ "name": "MicrosoftAppId",
+ "value": "[parameters('appId')]"
+ },
+ {
+ "name": "MicrosoftAppPassword",
+ "value": "[parameters('appSecret')]"
+ }
+ ],
+ "cors": {
+ "allowedOrigins": [
+ "https://botservice.hosting.portal.azure.net",
+ "https://hosting.onecloud.azure-test.net/"
+ ]
+ }
+ }
+ }
+ },
+ {
+ "apiVersion": "2017-12-01",
+ "type": "Microsoft.BotService/botServices",
+ "name": "[parameters('botId')]",
+ "location": "global",
+ "kind": "bot",
+ "sku": {
+ "name": "[parameters('botSku')]"
+ },
+ "properties": {
+ "name": "[parameters('botId')]",
+ "displayName": "[parameters('botId')]",
+ "endpoint": "[variables('botEndpoint')]",
+ "msaAppId": "[parameters('appId')]",
+ "developerAppInsightsApplicationId": null,
+ "developerAppInsightKey": null,
+ "publishingCredentials": null,
+ "storageResourceId": null
+ },
+ "dependsOn": [
+ "[resourceId('Microsoft.Web/sites/', variables('webAppName'))]"
+ ]
+ }
+ ],
+ "outputs": {}
+ }
+ }
+ }
+ ]
+}
\ No newline at end of file
diff --git a/samples/58.teams-start-new-thread-in-channel/deploymentTemplates/template-with-preexisting-rg.json b/samples/58.teams-start-new-thread-in-channel/deploymentTemplates/template-with-preexisting-rg.json
new file mode 100644
index 000000000..b790d2bdc
--- /dev/null
+++ b/samples/58.teams-start-new-thread-in-channel/deploymentTemplates/template-with-preexisting-rg.json
@@ -0,0 +1,158 @@
+{
+ "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
+ "contentVersion": "1.0.0.0",
+ "parameters": {
+ "appId": {
+ "type": "string",
+ "metadata": {
+ "description": "Active Directory App ID, set as MicrosoftAppId in the Web App's Application Settings."
+ }
+ },
+ "appSecret": {
+ "type": "string",
+ "metadata": {
+ "description": "Active Directory App Password, set as MicrosoftAppPassword in the Web App's Application Settings. Defaults to \"\"."
+ }
+ },
+ "botId": {
+ "type": "string",
+ "metadata": {
+ "description": "The globally unique and immutable bot ID. Also used to configure the displayName of the bot, which is mutable."
+ }
+ },
+ "botSku": {
+ "defaultValue": "S1",
+ "type": "string",
+ "metadata": {
+ "description": "The pricing tier of the Bot Service Registration. Acceptable values are F0 and S1."
+ }
+ },
+ "newAppServicePlanName": {
+ "type": "string",
+ "defaultValue": "",
+ "metadata": {
+ "description": "The name of the new App Service Plan."
+ }
+ },
+ "newAppServicePlanSku": {
+ "type": "object",
+ "defaultValue": {
+ "name": "P1v2",
+ "tier": "PremiumV2",
+ "size": "P1v2",
+ "family": "Pv2",
+ "capacity": 1
+ },
+ "metadata": {
+ "description": "The SKU of the App Service Plan. Defaults to Standard values."
+ }
+ },
+ "appServicePlanLocation": {
+ "type": "string",
+ "defaultValue": "",
+ "metadata": {
+ "description": "The location of the App Service Plan."
+ }
+ },
+ "existingAppServicePlan": {
+ "type": "string",
+ "defaultValue": "",
+ "metadata": {
+ "description": "Name of the existing App Service Plan used to create the Web App for the bot."
+ }
+ },
+ "newWebAppName": {
+ "type": "string",
+ "defaultValue": "",
+ "metadata": {
+ "description": "The globally unique name of the Web App. Defaults to the value passed in for \"botId\"."
+ }
+ }
+ },
+ "variables": {
+ "defaultAppServicePlanName": "[if(empty(parameters('existingAppServicePlan')), 'createNewAppServicePlan', parameters('existingAppServicePlan'))]",
+ "useExistingAppServicePlan": "[not(equals(variables('defaultAppServicePlanName'), 'createNewAppServicePlan'))]",
+ "servicePlanName": "[if(variables('useExistingAppServicePlan'), parameters('existingAppServicePlan'), if(empty(parameters('newAppServicePlanName')),concat(parameters('botId'), 'ServicePlan'),parameters('newAppServicePlanName')))]",
+ "resourcesLocation": "[if(empty(parameters('appServicePlanLocation')), resourceGroup().location, parameters('appServicePlanLocation'))]",
+ "webAppName": "[if(empty(parameters('newWebAppName')), parameters('botId'), parameters('newWebAppName'))]",
+ "siteHost": "[concat(variables('webAppName'), '.azurewebsites.net')]",
+ "botEndpoint": "[concat('https://', variables('siteHost'), '/api/messages')]"
+ },
+ "resources": [
+ {
+ "comments": "Create a new App Service Plan if no existing App Service Plan name was passed in.",
+ "type": "Microsoft.Web/serverfarms",
+ "condition": "[not(variables('useExistingAppServicePlan'))]",
+ "name": "[variables('servicePlanName')]",
+ "apiVersion": "2018-02-01",
+ "location": "[variables('resourcesLocation')]",
+ "sku": "[parameters('newAppServicePlanSku')]",
+ "kind": "linux",
+ "properties": {
+ "name": "[variables('servicePlanName')]",
+ "reserved":true
+ }
+ },
+ {
+ "comments": "Create a Web App using an App Service Plan",
+ "type": "Microsoft.Web/sites",
+ "apiVersion": "2016-08-01",
+ "location": "[variables('resourcesLocation')]",
+ "kind": "app",
+ "dependsOn": [
+ "[resourceId('Microsoft.Web/serverfarms/', variables('servicePlanName'))]"
+ ],
+ "name": "[variables('webAppName')]",
+ "properties": {
+ "name": "[variables('webAppName')]",
+ "serverFarmId": "[variables('servicePlanName')]",
+ "siteConfig": {
+ "linuxFxVersion": "JAVA|8-jre8",
+ "appSettings": [
+ {
+ "name": "JAVA_OPTS",
+ "value": "-Dserver.port=80"
+ },
+ {
+ "name": "MicrosoftAppId",
+ "value": "[parameters('appId')]"
+ },
+ {
+ "name": "MicrosoftAppPassword",
+ "value": "[parameters('appSecret')]"
+ }
+ ],
+ "cors": {
+ "allowedOrigins": [
+ "https://botservice.hosting.portal.azure.net",
+ "https://hosting.onecloud.azure-test.net/"
+ ]
+ }
+ }
+ }
+ },
+ {
+ "apiVersion": "2017-12-01",
+ "type": "Microsoft.BotService/botServices",
+ "name": "[parameters('botId')]",
+ "location": "global",
+ "kind": "bot",
+ "sku": {
+ "name": "[parameters('botSku')]"
+ },
+ "properties": {
+ "name": "[parameters('botId')]",
+ "displayName": "[parameters('botId')]",
+ "endpoint": "[variables('botEndpoint')]",
+ "msaAppId": "[parameters('appId')]",
+ "developerAppInsightsApplicationId": null,
+ "developerAppInsightKey": null,
+ "publishingCredentials": null,
+ "storageResourceId": null
+ },
+ "dependsOn": [
+ "[resourceId('Microsoft.Web/sites/', variables('webAppName'))]"
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/samples/58.teams-start-new-thread-in-channel/pom.xml b/samples/58.teams-start-new-thread-in-channel/pom.xml
new file mode 100644
index 000000000..f00bee9d6
--- /dev/null
+++ b/samples/58.teams-start-new-thread-in-channel/pom.xml
@@ -0,0 +1,318 @@
+
+
+
+ 4.0.0
+
+ com.microsoft.bot.sample
+ bot-teams-start-new-thread
+ sample
+ jar
+
+ ${project.groupId}:${project.artifactId}
+ This package contains a Java Teams Start New Thread sample using Spring Boot.
+ http://maven.apache.org
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 2.1.7.RELEASE
+
+
+
+
+
+ MIT License
+ http://www.opensource.org/licenses/mit-license.php
+
+
+
+
+
+ Bot Framework Development
+
+ Microsoft
+ https://dev.botframework.com/
+
+
+
+
+ UTF-8
+ UTF-8
+ 1.8
+ 1.8
+ 1.8
+ com.microsoft.bot.sample.teamsstartnewthread.Application
+ https://botbuilder.myget.org/F/botbuilder-v4-java-daily/maven/
+
+
+
+
+ junit
+ junit
+ 4.12
+ test
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ 2.1.8.RELEASE
+ test
+
+
+ org.slf4j
+ slf4j-api
+
+
+ org.apache.logging.log4j
+ log4j-api
+ 2.11.0
+
+
+ org.apache.logging.log4j
+ log4j-core
+ 2.11.0
+
+
+ com.microsoft.bot
+ bot-integration-spring
+ 4.0.0-SNAPSHOT
+ compile
+
+
+ org.json
+ json
+ 20190722
+
+
+
+
+
+ MyGet
+ ${repo.url}
+
+
+
+
+
+ ossrh
+
+ https://oss.sonatype.org/
+
+
+
+
+
+
+ build
+
+ true
+
+
+
+
+ maven-compiler-plugin
+ 3.8.1
+
+
+ 1.8
+
+
+
+ maven-war-plugin
+ 3.2.3
+
+ src/main/webapp
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ repackage
+
+
+ com.microsoft.bot.sample.teamstaskmodule.Application
+
+
+
+
+
+ com.microsoft.azure
+ azure-webapp-maven-plugin
+ 1.7.0
+
+ V2
+ {groupname}
+ {botname}
+
+
+ JAVA_OPTS
+ -Dserver.port=80
+
+
+
+ linux
+ jre8
+ jre8
+
+
+
+
+ ${project.basedir}/target
+
+ *.jar
+
+
+
+
+
+
+
+ org.eluder.coveralls
+ coveralls-maven-plugin
+ 4.3.0
+
+ yourcoverallsprojectrepositorytoken
+
+
+
+ org.codehaus.mojo
+ cobertura-maven-plugin
+ 2.7
+
+ ../../cobertura-report/spring-teamstaskmodule-sample
+ xml
+ 256m
+
+ true
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-site-plugin
+ 3.7.1
+
+
+ org.apache.maven.plugins
+ maven-project-info-reports-plugin
+ 3.0.0
+
+
+
+
+
+
+
+ publish
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+
+
+
+ org.sonatype.plugins
+ nexus-staging-maven-plugin
+ 1.6.8
+ true
+
+ true
+ ossrh
+ https://oss.sonatype.org/
+ true
+
+
+
+
+ org.apache.maven.plugins
+ maven-gpg-plugin
+
+
+ sign-artifacts
+ verify
+
+ sign
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-source-plugin
+
+
+ attach-sources
+
+ jar
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+
+
+ false
+
+
+
+ attach-javadocs
+
+ jar
+
+
+
+
+
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-pmd-plugin
+ 3.12.0
+
+
+ org.apache.maven.plugins
+ maven-checkstyle-plugin
+ 3.1.0
+
+
+
+ checkstyle
+
+
+
+
+
+
+
+
diff --git a/samples/58.teams-start-new-thread-in-channel/src/main/java/com/microsoft/bot/sample/teamsstartnewthread/Application.java b/samples/58.teams-start-new-thread-in-channel/src/main/java/com/microsoft/bot/sample/teamsstartnewthread/Application.java
new file mode 100644
index 000000000..6415a327d
--- /dev/null
+++ b/samples/58.teams-start-new-thread-in-channel/src/main/java/com/microsoft/bot/sample/teamsstartnewthread/Application.java
@@ -0,0 +1,47 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.microsoft.bot.sample.teamsstartnewthread;
+
+import com.microsoft.bot.integration.AdapterWithErrorHandler;
+import com.microsoft.bot.integration.BotFrameworkHttpAdapter;
+import com.microsoft.bot.integration.Configuration;
+import com.microsoft.bot.integration.spring.BotController;
+import com.microsoft.bot.integration.spring.BotDependencyConfiguration;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.Import;
+
+/**
+ * This is the starting point of the Sprint Boot Bot application.
+ *
+ * This class also provides overrides for dependency injections. A class that extends the {@link
+ * com.microsoft.bot.builder.Bot} interface should be annotated with @Component.
+ *
+ * @see TeamsStartNewThreadBot
+ */
+@SpringBootApplication
+
+// Use the default BotController to receive incoming Channel messages. A custom controller
+// could be used by eliminating this import and creating a new RestController. The default
+// controller is created by the Spring Boot container using dependency injection. The
+// default route is /api/messages.
+@Import({BotController.class})
+
+public class Application extends BotDependencyConfiguration {
+
+ public static void main(String[] args) {
+ SpringApplication.run(Application.class, args);
+ }
+
+ /**
+ * Returns a custom Adapter that provides error handling.
+ *
+ * @param configuration The Configuration object to use.
+ * @return An error handling BotFrameworkHttpAdapter.
+ */
+ @Override
+ public BotFrameworkHttpAdapter getBotFrameworkHttpAdaptor(Configuration configuration) {
+ return new AdapterWithErrorHandler(configuration);
+ }
+}
diff --git a/samples/58.teams-start-new-thread-in-channel/src/main/java/com/microsoft/bot/sample/teamsstartnewthread/TeamsStartNewThreadBot.java b/samples/58.teams-start-new-thread-in-channel/src/main/java/com/microsoft/bot/sample/teamsstartnewthread/TeamsStartNewThreadBot.java
new file mode 100644
index 000000000..2628e6c09
--- /dev/null
+++ b/samples/58.teams-start-new-thread-in-channel/src/main/java/com/microsoft/bot/sample/teamsstartnewthread/TeamsStartNewThreadBot.java
@@ -0,0 +1,85 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+package com.microsoft.bot.sample.teamsstartnewthread;
+
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.microsoft.bot.builder.BotFrameworkAdapter;
+import com.microsoft.bot.builder.MessageFactory;
+import com.microsoft.bot.builder.TurnContext;
+import com.microsoft.bot.builder.teams.TeamsActivityHandler;
+import com.microsoft.bot.connector.authentication.MicrosoftAppCredentials;
+import com.microsoft.bot.integration.Configuration;
+import com.microsoft.bot.schema.Activity;
+import com.microsoft.bot.schema.ConversationParameters;
+import com.microsoft.bot.schema.ConversationReference;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+
+/**
+ * This class implements the functionality of the Bot.
+ *
+ *
This is where application specific logic for interacting with the users would be
+ * added. For this sample, the {@link #onMessageActivity(TurnContext)} echos the text back to the
+ * user. The {@link #onMembersAdded(List, TurnContext)} will send a greeting to new conversation
+ * participants.
This is where application specific logic for interacting with the users would be
- * added. For this sample, the {@link #onMessageActivity(TurnContext)} echos the text back to the
- * user. The {@link #onMembersAdded(List, TurnContext)} will send a greeting to new conversation
- * participants.
+ * added. For this sample, the {@link #onMessageActivity(TurnContext)} creates a thread in a Teams channel.
+ *
*/
@Component
public class TeamsStartNewThreadBot extends TeamsActivityHandler {
From b88058deedbb1d77a7f6518e8e7bd54263f814c0 Mon Sep 17 00:00:00 2001
From: Emilio Munoz
Date: Mon, 27 Apr 2020 03:40:15 -0400
Subject: [PATCH 3/4] Fixing README.md file
---
samples/58.teams-start-new-thread-in-channel/README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/samples/58.teams-start-new-thread-in-channel/README.md b/samples/58.teams-start-new-thread-in-channel/README.md
index bd926f830..7fd504675 100644
--- a/samples/58.teams-start-new-thread-in-channel/README.md
+++ b/samples/58.teams-start-new-thread-in-channel/README.md
@@ -41,7 +41,7 @@ the Teams service needs to call into the bot.
1) From the root of this project folder:
- Build the sample using `mvn package`
- Unless done previously, install the packages in the local cache by using `mvn install`
- - Run it by using `java -jar .\target\bot-teams-task-module-sample.jar`
+ - Run it by using `java -jar .\target\bot-teams-start-new-thread-sample-.jar`
## Interacting with the bot in Teams
From c45b1ce39cf678348e1d843c0a2a85051e747b84 Mon Sep 17 00:00:00 2001
From: Emilio Munoz
Date: Tue, 28 Apr 2020 11:16:43 -0400
Subject: [PATCH 4/4] Fixing README.md
---
samples/58.teams-start-new-thread-in-channel/README.md | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/samples/58.teams-start-new-thread-in-channel/README.md b/samples/58.teams-start-new-thread-in-channel/README.md
index 7fd504675..04bc249c8 100644
--- a/samples/58.teams-start-new-thread-in-channel/README.md
+++ b/samples/58.teams-start-new-thread-in-channel/README.md
@@ -1,8 +1,9 @@
-# Teams Task Module
+# Teams Start Thread In A Team
-Bot Framework Teams Task Module sample.
+Bot Framework v4 Conversation Bot sample for Teams.
- This sample shows how to incorporate basic conversational flow into a Teams application. It also illustrates a few of the Teams specific calls you can make from your bot.
+This bot has been created using [Bot Framework](https://dev.botframework.com). This sample shows
+how to incorporate basic conversational flow into a Teams application. It also illustrates a few of the Teams specific calls you can make from your bot.
## Prerequisites