You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/communication-services/tutorials/widgets/click-to-call-widget.md
+29-10Lines changed: 29 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,32 @@
1
+
---
2
+
title: Tutorial - Embed a Teams call widget into your web application
3
+
titleSuffix: An Azure Communication Services tutorial
4
+
description: Learn how to use Azure Communication Services to embed a calling widget into your web application.
5
+
author: ddematheu2
6
+
manager: shahen
7
+
services: azure-communication-services
8
+
9
+
ms.author: dademath
10
+
ms.date: 04/17/2023
11
+
ms.topic: tutorial
12
+
ms.service: azure-communication-services
13
+
ms.subservice: calling
14
+
---
15
+
1
16
# Embed a Teams call widget into your web application
2
17
3
18
Enable your customers to talk with your support agent on Teams through a call interface directly embedded into your web application.
4
19
5
20
## Architecture overview
6
21
7
22
## Pre-requisites
8
-
- Azure Subscription
9
-
- Azure Communication Services resource
23
+
- An Azure account with an active subscription. For details, see [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
24
+
-[Visual Studio Code](https://code.visualstudio.com/) on one of the [supported platforms](https://code.visualstudio.com/docs/supporting/requirements#_platforms).
25
+
- An active Communication Services resource and connection string. [Create a Communication Services resource](../quickstarts/create-communication-resource.md).
10
26
11
27
## Set up an Azure Function to provide access tokens
12
28
13
-
Follow instructions from our [trusted user access service tutorial](https://learn.microsoft.com/azure/communication-services/tutorials/trusted-service-tutorial) to deploy your Azure Function for access tokens. This service will return an access token which our widget will use to authenticate to Azure Communication Services and start the call to the Teams user we define.
29
+
Follow instructions from our [trusted user access service tutorial](../trusted-service-tutorial) to deploy your Azure Function for access tokens. This service returns an access token which our widget uses to authenticate to Azure Communication Services and start the call to the Teams user we define.
14
30
15
31
## Set up boilerplate vanilla web application
16
32
@@ -75,11 +91,10 @@ Follow instructions from our [trusted user access service tutorial](https://lear
75
91
76
92
```
77
93
78
-
3. Configure the call window to be hidden by default. We will show it when the user clicks the button.
94
+
1. Configure the call window to be hidden by default. We show it when the user clicks the button.
@@ -104,7 +119,7 @@ Follow instructions from our [trusted user access service tutorial](https://lear
104
119
105
120
```
106
121
107
-
At this point we have set up a static HTML page with a button that will open a call widget when clicked. We will next add the widget script code. It will make a call to our Azure Function to get the access token and then use it to initialize our call client for Azure Communication Services and start the call to the Teams user we define.
122
+
At this point we have set up a static HTML page with a button that opens a call widget when clicked. Next, we add the widget script code. It makes a call to our Azure Function to get the access token and then use it to initialize our call client for Azure Communication Services and start the call to the Teams user we define.
108
123
109
124
## Fetch an access token from your Azure Function
110
125
@@ -119,7 +134,7 @@ Add the following code to the `getAccessToken()` function:
119
134
}
120
135
121
136
```
122
-
You will need to add the URL of your Azure Function. You can find these values in the Azure portal under your Azure Function resource.
137
+
You need to add the URL of your Azure Function. You can find these values in the Azure portal under your Azure Function resource.
123
138
124
139
125
140
## Initialize the call widget
@@ -128,7 +143,7 @@ You will need to add the URL of your Azure Function. You can find these values i
locator: { participantIds: ['INSERT TEAMS USER ID']},
166
+
locator: { participantIds: ['INSERT USER UNIQUE IDENTIFIER FROM MICROSOFT GRAPH']},
152
167
userId:response.user,
153
168
token:response.userToken
154
169
},
@@ -167,4 +182,8 @@ We provide a test script hosted on GitHub for you to use for testing. For produc
167
182
168
183
```
169
184
170
-
This code will initialize the call widget when the button is clicked. It will make a call to our Azure Function to get the access token and then use it to initialize our call client for Azure Communication Services and start the call to the Teams user we define.
185
+
Add a Microsoft Graph [User](https://learn.microsoft.com/graph/api/resources/user?view=graph-rest-1.0) ID to the `participantIds` array. You can find this value through [Microsoft Graph](https://learn.microsoft.com/graph/api/user-get?view=graph-rest-1.0&tabs=http) or through [Microsoft Graph explorer](https://developer.microsoft.com/graph/graph-explorer) for testing purposes. There you can grab the `id` value from the response.
186
+
187
+
## Run code
188
+
189
+
Open the `index.html` in a browser. This code initializes the call widget when the button is clicked. It makes a call to our Azure Function to get the access token and then use it to initialize our call client for Azure Communication Services and start the call to the Teams user we define.
0 commit comments