opened
ceciliaavila
username_0
## Proposed Changes
Add a new Functional test for _SlackTestBot_.


## Details
- Add the new **_SlackClientTest_** to FunctionalTests project to test sending a message to the _SlackTestBot_ deployed in Azure with ARM Templates and check its response.
- Update the `template-with-new-rg.json` and the `template-with-preexisting-rg.json` in the _SlackTestBot_ to take the Slack credentials that will be used to deploy the bot on Azure.
- Add the class **_SlackHistoryRetrieve_** to manage the retrieving of Slack Messages.

### Steps to configure the Nightly Build Pipeline:
1- Define the following environment variables:

**BotGroup**: It's the name for the resource group.
**SlackBotName**: It's the name of the bot
**SlackBotToken**: It's the Bot User OAuth Access Token  from the Slack App ( * )
**SlackClientSigningSecret**: It's the Signing Secret from the Slack App ( * )
**SlackVerificationToken**: It's the Verification Token from the Slack App ( * )
**SlackChannel**: It's the channel ID from the application

( * ) Mark these variables as secret.

2- A NETCore task to **publish** the _SlackTestBot_.

![image](https://user-images.githubusercontent.com/44245136/70443141-64edf180-1a76-11ea-8a7b-509daf3451a2.png)

The arguments are:
```PowerShell
--output $(System.DefaultWorkingDirectory)\tests\Adapters\Microsoft.Bot.Builder.Adapters.Slack.TestBot\PublishedBot --framework netcoreapp2.1
```
3- An Azure CLI task to **create the resources in Azure** and deploy the bot.

![image](https://user-images.githubusercontent.com/44245136/70449312-88b63500-1a80-11ea-89d5-776db49438d9.png)

The inline script is the following:
```PowerShell
call az deployment create --name "$(BotGroup)" --template-file "$(System.DefaultWorkingDirectory)\tests\Adapters\Microsoft.Bot.Builder.Adapters.Slack.TestBot\DeploymentTemplates\template-with-new-rg.json" --location "westus" --parameters appId="$(AppId)" appSecret="$(AppSecret)" botId="$(SlackBotName)" botSku=F0 newAppServicePlanName="$(SlackBotName)" newWebAppName="$(SlackBotName)" groupName="$(BotGroup)" groupLocation="westus" newAppServicePlanLocation="westus" slackVerificationToken="$(SlackVerificationToken)" slackBotToken="$(SlackBotToken)" slackClientSigningSecret="$(SlackClientSigningSecret)"

call az webapp deployment source config-zip --resource-group "$(BotGroup)" --name "$(SlackBotName)" --src "$(System.DefaultWorkingDirectory)\tests\Adapters\Microsoft.Bot.Builder.Adapters.Slack.TestBot\PublishedBot\PublishedBot.zip"
```

4- A PowerShell task to **set the environment variables** needed to run the test

![image](https://user-images.githubusercontent.com/44245136/70443369-c7df8880-1a76-11ea-812b-15d41b3c85f3.png)

The script is:
```PowerShell
echo '##vso[task.setvariable variable=SLACK_CHANNEL]$(SlackChannel)'
echo '##vso[task.setvariable variable=SLACK_BOT_TOKEN]$(SlackBotToken)'
```

Finally, the new test will run with the rest of the functional tests and the bot should be deleted with the other resources deployed in the pipeline.

_**Note**: As a pre-requisite, the SlackTestBot must be previously connected with a Slack App._
[Slack Adapters] Add Slack Functional Test
issue
created
fuselabs
username_1
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Builder.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Builder/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Builder.AI.Luis.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Builder.AI.Luis/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Builder.AI.QnA.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Builder.AI.QnA/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Builder.ApplicationInsights.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Builder.ApplicationInsights/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Builder.Azure.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Builder.Azure/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Builder.Dialogs.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Builder.Dialogs/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Builder.Integration.ApplicationInsights.Core.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Builder.Integration.ApplicationInsights.Core/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Builder.Integration.AspNet.Core.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Builder.Integration.AspNet.Core/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Builder.TemplateManager.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Builder.TemplateManager/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Builder.Testing.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Builder.Testing/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Configuration.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Configuration/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Connector.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Connector/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Schema.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Schema/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Streaming.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Streaming/4.6.3)
comment
created
fuselabs
username_1
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Builder.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Builder/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Builder.AI.Luis.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Builder.AI.Luis/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Builder.AI.QnA.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Builder.AI.QnA/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Builder.ApplicationInsights.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Builder.ApplicationInsights/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Builder.Azure.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Builder.Azure/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Builder.Dialogs.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Builder.Dialogs/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Builder.Integration.ApplicationInsights.Core.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Builder.Integration.ApplicationInsights.Core/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Builder.Integration.AspNet.Core.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Builder.Integration.AspNet.Core/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Builder.TemplateManager.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Builder.TemplateManager/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Builder.Testing.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Builder.Testing/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Configuration.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Configuration/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Connector.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Connector/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Schema.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Schema/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Streaming.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Streaming/4.6.3)
comment
created
fuselabs
username_1
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Builder.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Builder/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Builder.AI.Luis.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Builder.AI.Luis/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Builder.AI.QnA.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Builder.AI.QnA/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Builder.ApplicationInsights.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Builder.ApplicationInsights/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Builder.Azure.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Builder.Azure/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Builder.Dialogs.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Builder.Dialogs/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Builder.Integration.ApplicationInsights.Core.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Builder.Integration.ApplicationInsights.Core/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Builder.Integration.AspNet.Core.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Builder.Integration.AspNet.Core/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Builder.TemplateManager.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Builder.TemplateManager/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Builder.Testing.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Builder.Testing/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Configuration.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Configuration/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Connector.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Connector/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Schema.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Schema/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Streaming.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Streaming/4.6.3)
comment
created
cleemullins
username_2
My concerns(s) with this are all around how we manage the UserID for slack. I thinkthis PR abstracts it out and we simply add it as a secure variable via DevOps.
comment
created
ceciliaavila
username_0
@username_2, There's no need to set up a UserID. We post the message using the **_BotToken_** and the flag **_as_user_** to send it as a [BotUser](https://api.slack.com/messaging/sending#bot_users). This way, the bot deployed in Azure sees the message as it would be sent by a user and answers it.
As you mentioned, the BotToken is configured as a secure variable of the pipeline.
comment
created
fuselabs
username_1
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Builder.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Builder/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Builder.AI.Luis.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Builder.AI.Luis/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Builder.AI.QnA.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Builder.AI.QnA/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Builder.ApplicationInsights.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Builder.ApplicationInsights/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Builder.Azure.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Builder.Azure/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Builder.Dialogs.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Builder.Dialogs/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Builder.Integration.ApplicationInsights.Core.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Builder.Integration.ApplicationInsights.Core/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Builder.Integration.AspNet.Core.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Builder.Integration.AspNet.Core/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Builder.TemplateManager.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Builder.TemplateManager/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Builder.Testing.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Builder.Testing/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Configuration.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Configuration/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Connector.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Connector/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Schema.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Schema/4.6.3)
:heavy_check_mark: No Binary Compatibility issues for **Microsoft.Bot.Streaming.dll** compared against [version 4.6.3](https://www.nuget.org/packages/Microsoft.Bot.Streaming/4.6.3)
comment
created
garypretty
username_3
Hey @BruceHaley. I am happy for this to be merged and see you approved too.  Once merged, will it be you who updates the nightly build as per the instructions in the PR?
comment