This repository is for developers who want to know..
- How to start Microsoft Teams group call from your app
- How to let user join existing Microsoft Teams online meeting by your app
Microsoft Teams is popular collaboration tool. Users can chat, call and having online meeting with their colleagues. Developers want to integrate their application with Teams. For example, their app triggers to start new group call with specific members. Thus users can collaborate well even if developers don't need to implement their own online meeting features and infrastructure.
A user can get group call from your app.
We uses following language and tools. As prerequistics, please read and try each tools tutorial.
- C# with .Net Core 3.1: Because we can utilize dependecy injection on Azure Functions and Azure SDKs, we picked up C# for this sample.
- Azure Functions: Serverless platform to run your code. In this repository, we simply implement without database for keeping sample simple.
- Microsoft Graph: You can utilize Micorosft Graph to utilize Microsoft 365 back-end. For example, you can fetch users' email, calendar.. etc. In this repository, we utilize it to integrate Microsoft Teams.
- Azure Active Directory: This is identitiy platform. For utilizing Microsoft Graph, you need to utilize it for making secure connection between your app and Microsoft Graph (Microsoft Teams).
- Azure Bot Service: Microsoft graph need bot to start Teams Call.
- OAuth 2.0 client credential flow: Because our app is worker/deamon type service and can't have user interaction, we need to utilize client credential flow to fetch access token for Microsoft Graph.
- Create your Microsoft 365 environment with developer program.
- Create 2 - 3 users in the Microsoft 365 environment.
- Register app in you Azure AD and memo following information by referring microsoft document
- Client Id
- Client Secret
- Tenant Id
- Setup the app permissions in Azure AD (detailed permissions list)
- Install Visual Studio Code
- Clone repository and open with Visual Studio Code. If you get recommendation to install dependencies (extension and cli), please install them.
- Copy
local.settings.sample.json
and paste aslocal.settings.json
in same path. - Update
local.settings.json
with copiedClient Id
andClient Secret
values. - Setup Azure Bot Service and enable Teams feature. (document)
- Setup ngrok for accepting webhook from Microsoft Graph. After you installed ngrok, please run it by
ngrok http 7071
. Then, you can see https forwarding url. Please copy the https url and paste it as value ofCallBackUrl
inlocal.settings.json
. - Press [F5] key to run Azure Functions locally.
We recommend you to install Microsoft Teams mobile app in your phone and sign-in with your Microsoft 365 developer program account.
App can call this API endpoint when app want to start group call with specific users.
HTTP POST http://localhost:7071/api/calls
BODY
{
"TenantId": "tenant id",
"ParticipantEmails": [
"email address",
"email address"
]
}
HTTP POST http://localhost:7071/api/calls
BODY
{
"TenantId": "b21a0d16-4e90-4cdb-a05b-ad3846369881",
"ParticipantEmails": [
"[email protected]",
"[email protected]"
]
}
App can call this API for
- Start group call with meeting attendees
- Join existing online meeting if the meeting is set up with online meeting
HTTP POST http://localhost:7071/api/calls/{meeting id}
Body
{
"TenantId":"tenant id",
"MeetingId":"meetin id which a user want to join",
"UserEmail": "user email who want to join call"
}
Body
{
"TenantId":"b21a0d16-4e90-4cdb-a05b-ad3846369881",
"MeetingId":"AAMkADViZGQxZWY4LWQ4YzUtNDRhOS04OTQyLWU1NWI5N2JkOWU0ZQBGAAAAAABlonO6N9eNRYv3Fm0mCU2XBwAMGKVZFv8rR4rhKgq_-6brAAAAAAENAAAMGKVZFv8rR4rhKgq_-6brAAAyaeaJAAA=",
"UserEmail": "[email protected]"
}
In this section, we assume you've finished previous section to setup dev environment.
- Open project with Visual Studio Code
- Ctrl+Shift+P(windows)/Command+ShiftP(Mac) to show command pallet.
- Select
Tasks:Run test tasks
to run test
You can see test results and coverage in the VS Code terminal. If you've installed Coverage Gutters extension, you can see code covered inline by clicking [Watch] button.
- For using App secret securely, you may want to use Azure Key Vault.
- For multi-tenant usage, you need to register your app as Multitenant application and let Aministrator in customer tenant grant app by Admin consent flow.