- Code Sample
Improving quality of care depends on many things – process, patient care, and research planning. Huddle developer templates built on the Microsoft Teams platform, help drive quality and care outcomes by enabling collaboration with more effective huddle teams. With the huddle sample solutions, you can:
- Measure and visualize impactful best practices across your organization.
- Identify patient care issues and potential causes.
- Share ideas with your health team using natural conversations.
Table of content
Foreword
Enable and Create Microsoft Teams
- Enable Microsoft Teams feature
- Create Teams
- Update Each Team
Import and publish LUIS App
Create SharePoint Site and Lists
- Create a site collection
- Provision Lists
Create App Registrations in AAD
- Register App in AAD
- Consent Permissions
Deploy Azure Components with ARM Template
- GitHub Authorize
- Deploy Azure Components
- Handle Errors
Follow-up Steps
- Customize and Configure the Bot
- Authorize Planner API Connection
- Authorize Teams API Connection
- Authorize Microsoft Graph API Connection
Configure Teams App
- Create Teams App Package and Side-load It
- Add Metric Input Tab
- Add Idea Board Tab
- Start Conversation with The Bot
Foreword
This document will guide you to deploy the solution to your environment.
First, an Azure AAD is required to register the app registrations. In this document, the Azure AAD will be called "Huddle AAD", and an account in Huddle AAD will be called Huddle work account.
All app registrations should be created in the Huddle AAD.
Bot/Luis/Microsoft App should be registered with a Huddle work account. This account should have permission to deploy resource and create resource group in Azure.
SharePoint lists should be created on SharePoint associating with Huddle AAD.
Following Powershell Modules are installed
- MicrosoftTeams
- ImportExcel
- Microsoft.Graph
- SharePointPnPPowerShellOnline
- Azure
Notes:
Run PowerShell as Administrator, and execute the commands below to install required modules:
Install-Module MicrosoftTeamsInstall-Module ImportExcelInstall-module Microsoft.GraphInstall-Module SharePointPnPPowerShellOnlineInstall-Module Az
Required NodeJS on your local environment. Node.js >= 8.5 and npm installed on your machine, then use:
npm install -g luis-apis
An Azure Subscription is required to deploy the Azure components. We will use the ARM Template to deploy these Azure components automatically.
Please download files in /Files
folder to your computer.
To learn more about the huddle solutions in Microsoft Teams and Microsoft O365, visit the Microsoft developer blog.
Enable and Create Microsoft Teams
Enable Microsoft Teams feature
Please follow Teams org-wide settings in the Microsoft Teams admin center.
Make sure the following options are turned on:
Allow third-party apps
Allow interaction with custom apps
Create Teams
In this section, we will connect to Microsoft Teams in PowerShell with a Huddle AAD account, and execute some PowerShell scripts to create teams from an Excel file.
Note: after you finish this section, teams will be created right away. But their owners and members will take up to an hour to show in Teams. Refer to Add-TeamUser for more details.
First, let open and edit
/Files/Teams.xlsx
. Input the teams and related information.Note:
- AccessType:
- Private: Private teams can only be joined if the team owner adds you to them. They also won't show up in your teams gallery.
- Public: public teams are visible to everyone from the teams gallery and you can join them without getting approval from the team owner.
- Owners and Members:
- Please use UPN (User Principle Name) instead of email.
- Use ";" to separate multi-users.
- The Huddle work account used to connect to Microsoft Teams will be added as the owner of each team automatically, no matter it is in the owners column or not.
- AccessType:
Open PowerShell Console
Navigate to the
/Files
folder in PowerShellcd <Path to Files folder> # For example: cd "c:\Users\Admin\Desktop\Huddle\Files\"
Connect to Microsoft Teams with a Huddle AAD account.
Connect-MicrosoftTeams
Execute the commands below which reads data from the Excel file and create teams:
.\NewTeams.ps1 -excelPath .\Teams.xlsx
Update Each Team
For each team you created, please active the default planer and create 4 buckets:
Open https://www.office.com, sign in.
Click Planner.
Click New plan and then click Add to an existing Office 365 Group. Create a plan with the same name in the previously created group.
Create the following buckets:
- New Idea
- In Progress
- Completed
- Shareable
Import and publish LUIS App
Open PowerShell Console and navigate to the
/Files
folder in PowerShellConnect to Microsoft Azure with a Huddle work account.
Connect-AzAccount
Run the following script in the PowerShell console. This script will create a resource group in Azure, then import, train, and publish LUIS App. Replace <resource group name> with the resource group name you expect. If the execution is successful, LUIS App Id and ResourceGroup Suffix will be returned. Remember these two values
#Replace <resource group name> with the resource group name you expect..\DeployLuis.ps1 -appPath .\LUISApp.json -resourceTemplate .\LUISTemplate.json -resourceGroup <resource group name>
Create a site collection
Open a web browser and go to SharePoint Administration Center.
https://<YourTenant>-admin.sharepoint.com/_layouts/15/online/SiteCollections.aspx
Click New -> Private Site Collection.
Fill in the form:
- In the Title field, enter site title.
- In the Web Site Address field, enter hospital site URL.
- Select a language: English
- In the Template Selection section, select Team Site as site template.
- Choose a Time Zone.
- Administrator should be the alias of the individual you want to have full administrator rights on this site.
- Leave Server Resource Quota at 300. (This value can be adjusted later if needed)
Click OK.
When the site is created, use Huddle AAD account to log in to the site just created.
Click the gear in the upper right corner of the page, Shared with..., Invite people. Add the users you want to use. And click Save
Copy aside the URL of the site collection. It will be used as the value of Base SP Site Url parameter of the ARM Template.
Provision Lists
Install SharePointPnPPowerShellOnline module, if you have not installed it.
Please follow: https://msdn.microsoft.com/en-us/pnp_powershell/pnp-powershell-overview#installation
Open Power Shell, then execute the command below to connect to the site you just created:
Connect-PnPOnline -Url https://<Tenant>.sharepoint.com/sites/<Site> -Credentials (Get-Credential)
Note: Please replace
<Tenant>
and<Site>
.Login in with an admin account.
Navigate to
/Files
folder in PowerShell, then execute the following command:Apply-PnPProvisioningTemplate -Path PnPProvisioningTemplate.xml
Notes: The Following sample data was created in the Categories list
- Safety/Quality
- Access
- Experience
- Finance
- People
Create App Registrations in AAD
Register App in AAD
Open PowerShell Console and navigate to the
/Files
folder in PowerShellConnect to Microsoft Azure with a Huddle AAD account.
Connect-Graph -Scopes Directory.AccessAsUser.All
Run the following script in the PowerShell console. This script will create the following 4 Applications in AAD. The names of these 4 Applications are defined at the top of NewApps.ps1.
- Huddle Bot
- Huddle Bot Web App
- Huddle Metric Web App
- Huddle MS Graph Connector App
.\NewApps.ps1 -ResourceGroupSuffix <your resourceGroupSuffix value>
Notes:The resourceGroupSuffix value is generated in Import and publish LUIS App section
After the script runs successfully, it will return the following data, remember these data
- Tenant Id
- Microsoft App Id
- Microsoft App Password
- Bot Client Id
- Bot Client Secret
- Metric Client Id
- Metric Client Secret
- Graph Client Id
- Graph Client Secret
- Certificate Pfx Base64
- Certificate Pfx Password
Consent Permissions
Log in to Azure Portal with Huddle AAD account.
Find Huddle Bot Web App just created in App registrations.
In API Permission tab, consent the permission
Follow step 2 and step 3, consent the permission for Huddle Metric Web App and Huddle MS Graph Connector App
Deploy Azure Components with ARM Template
GitHub Authorize
Generate Token
Open https://github.com/settings/tokens in your web browser.
Sign into your GitHub account where you forked this repository.
Click Generate new token.
Enter a value in the Token description text box.
Select the following s (your selections should match the screenshot below):
- repo (all) -> repo:status, repo_deployment, public_repo, repo:invite, security_events
- admin:repo_hook -> read:repo_hook
Click Generate token.
Copy the token.
Add the GitHub Token to Azure in the Azure Resource Explorer
Open https://resources.azure.com/providers/Microsoft.Web/sourcecontrols/GitHub in your web browser.
Log in with your Azure account.
Selected the correct Azure subscription.
Select Read/Write mode.
Click Edit.
Paste the token into the token parameter.
Click PUT.
Deploy Azure Components
Fork this repository to your GitHub account.
Click the Deploy to Azure Button:
Fill in the values on the deployment page:
You have collected most of the values in previous steps. For the rest parameters:
- Resource group: select to created resource group in previous step.
- Bot Name: the name of the bot, will be used as Display Name of Bot Registration.
- Global Team: the name of the global team that is one of the Teams created earlier. A webjob will move shared tasks in other team planners to the shared bucket of Global Team
- Source Code Repository: use the URL of the repository you just created -
https://github.com/<YourAccount>/Office-365-Huddle-Templates
- Source Code Branch: master
- Source code Manual Integration: false
- Check I agree to the terms and conditions stated above.
Tips:
You can click Edit Parameters on top of the template after filled all parameters.
Then click Download to save parameters on your local computer in case of deployment failure.
Click Purchase.
Handle Errors
If the deployment started, but failed as below - one or two errors of sourcecontrols resources:
Please Redeploy with the same parameters and to the same resource group.
Follow-up Steps
Customize and Configure the Bot
On Azure Portal, find the Resource Group you just created. Navigate to the Bot Channels Registration you created.
Upload an icon:
Click Settings.
Upload
/Files/HuddleBotIcon.png
as the Icon.Click Save.
Authorize Planner API Connection
Navigate to planner in the resource group you just created.
Click the planner API Connection.
Click Edit API connection.
Click Authorize.
Pick up or input the Huddle AAD account. The user account should be in every team.
Sign in the account.
Click Save at the bottom.
Authorize Teams API Connection
Follow the similar steps in the previous chapter to authorize the teams API Connection.
Authorize Microsoft Graph API Connection
Follow the similar steps in the previous chapter to authorize the microsoft-graph API.
Add Prediction Resource in LUIS App
- Open LUIS site and log in with Huddle work account
Navigate to My apps tab
Select the Subscription and Resource deployed in the previous step (the suffix of this resource has the same suffix as the luis app deployed in the previous step)
Click on the listed app
Select MANAGE tab on the top
- Select Azure Resources tab on the left
- Click Add prediction resource button
- Select the Subscription and Resource deployed in the previous step (the suffix of this resource has the same suffix as the luis app deployed in the previous step)
- Click Done button to save changes.
Configure Teams App
Create Teams App Package and Side-load It
Open
/Files/TeamsAppPackage/manifest.json
with a text editor.Replace the following 2 placeholders with the corresponding values you got in previous guides:
<MicrosoftAppId>
: Microsoft App Id generated in previous step.<MetricWebAppDomain>
: the domain of the Metric Web App
Save the changes.
Zip the files in
/Files/TeamsAppPackage
folder.Name it HuddleTeamsApp.zip.
Right-click a team in Microsoft Teams, then click Manage team.
Click the Apps tab.
Then click Upload a custom app.
Select the HuddleTeamsApp.zip.
Click Add button.
Add Metric Input Tab
Click a team.
Click +
Click Huddle App.
Click Save.
Add Idea Board Tab
Click a team.
Click +
Click Planner.
Choose Use an existing plan, then select the plan which has the same name as the team.
Click Save.
Click the dropdown icon, then click Rename.
Input: Idea Board
Click Save.
Start Conversation with The Bot
Follow the step below to start 1:1 conversation with the Bot in Microsoft Teams
Find the URL of Microsoft Teams Channel of the Bot,
Then open it in your browser:
Click Open Microsoft Teams.
Another way to start 1:1 talk is using the MicrosoftAppId of the Bot:
Copyright (c) 2018 Microsoft. All rights reserved.