page_type | description | urlFragment | products | languages | extensions | contentType | createdDate | ||||
---|---|---|---|---|---|---|---|---|---|---|---|
sample |
This sample app demonstrates sending change notifications to user presence in Teams based on user presence status. |
teams-graph-change-notification-nodejs |
|
|
samples |
07-07-2021 13:38:26 |
Bot Framework v4 ChangeNotification sample.
This sample app demonstrates sending notifications to users when presence status is changed.
-
Microsoft Teams is installed and you have an account
-
Node.js version 10.14 or higher
#determine node version node --version
-
ngrok or equivalent tunnelling solution
-
Clone the repository
git clone https://github.com/OfficeDev/Microsoft-Teams-Samples.git
-
Open from Visual Studio code
- Launch Visual Studio code
- File -> Open Folder
- Navigate to
samples/graph-change-notification/nodejs
folder - Run npm command in the terminal
npm install
- Press
F5
to run the project
-
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.
-
Select Add OAuth Connection 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
- Update
MicrosoftAppId
andMicrosoftAppPassword
in the .env that is created in Azure. - Add
connectionName
created in step 5. - Update
notificationUrl
as{NgrokBaseURL}/api/notifications