page_type | description | products | languages | extensions | contentType | createdDate | ||||
---|---|---|---|---|---|---|---|---|---|---|
sample |
This sample app demonstrates sending change notifications to user presence in Teams based on user presence status. |
|
|
samples |
07-07-2021 13:38:26 |
Bot Framework v4 ChangeNotification sample.
This sample app demonstrates sending change notifications to user presence in Teams based on user presence status.
- Microsoft Teams is installed and you have an account
- .NET Core SDK version 3.1
- ngrok or equivalent tunnelling solution
-
Clone the repository
git clone https://github.com/OfficeDev/Microsoft-Teams-Samples.git
A) Or from Visual Studio code
- Launch Visual Studio code
- File -> Open Folder
- Navigate to
samples/graph-change-notification/csharp
folder - Select
ChangeNotification
folder - Press
F5
to run the project
B) Run ngrok - point to port 3978
ngrok http -host-header=rewrite 3978
-
In the Azure portal, select your resource group from the dashboard.
-
Select your bot channel registration link.
-
Open the resource page and select Configuration under Settings.
-
Complete the form as follows:
a. Enter a name for the connection. You'll use this name in your bot in the appsettings.json file. For example BotTeamsAuthADv1.
b. Service Provider. Select Azure Active Directory. Once you select this, the Azure AD-specific fields will be displayed.
c. Client id. Enter the Application (client) ID that you recorded for your Azure identity provider app in the steps above.
d. Client secret. Enter the secret that you recorded for your Azure identity provider app in the steps above.
e. Grant Type. Enter authorization_code.
f. Login URL. Enter https://login.microsoftonline.com.
g. Tenant ID, enter the Directory (tenant) ID that you recorded earlier for your Azure identity app or common depending on the supported account type selected when you created the identity provider app. h. For Resource URL, enter https://graph.microsoft.com/ i. Provide Scopes like "Presence.Read, Presence.Read.All"
- Ensure that you've enabled the Teams Channel
- Provide appId and appPassword in the appsetting that is created in Azure.
- Provide UserId in appsetting for which you want to subscribe the user presence.
- Provide the ngrok url as "BaseUrl" in appsetting on which application is running on.