Skip to content

Commit d106c1a

Browse files
committed
updates
1 parent 820e6c1 commit d106c1a

File tree

1 file changed

+29
-10
lines changed

1 file changed

+29
-10
lines changed

articles/communication-services/tutorials/widgets/click-to-call-widget.md

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff 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+
116
# Embed a Teams call widget into your web application
217

318
Enable your customers to talk with your support agent on Teams through a call interface directly embedded into your web application.
419

520
## Architecture overview
621

722
## 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).
1026

1127
## Set up an Azure Function to provide access tokens
1228

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.
1430

1531
## Set up boilerplate vanilla web application
1632

@@ -75,11 +91,10 @@ Follow instructions from our [trusted user access service tutorial](https://lear
7591

7692
```
7793

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.
7995

8096
``` html
8197

82-
<script src="https://github.com/Azure/communication-ui-library/releases/latest/download/callComposite.js"></script>
8398
<script>
8499
var open = false;
85100
const button = document.querySelector('.widget');
@@ -104,7 +119,7 @@ Follow instructions from our [trusted user access service tutorial](https://lear
104119

105120
```
106121

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.
108123

109124
## Fetch an access token from your Azure Function
110125

@@ -119,7 +134,7 @@ Add the following code to the `getAccessToken()` function:
119134
}
120135

121136
```
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.
123138

124139

125140
## 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
128143

129144
``` html
130145

131-
<script src="https://github.com/Azure/communication-ui-library/releases/latest/download/callComposite.js"></script>
146+
<script src="https://github.com/ddematheu2/ACS-UI-Library-Widget/releases/download/widget/callComposite.js"></script>
132147

133148
```
134149

@@ -148,7 +163,7 @@ We provide a test script hosted on GitHub for you to use for testing. For produc
148163
const callAdapter = await callComposite.loadCallComposite(
149164
{
150165
displayName: "Test User",
151-
locator: { participantIds: ['INSERT TEAMS USER ID']},
166+
locator: { participantIds: ['INSERT USER UNIQUE IDENTIFIER FROM MICROSOFT GRAPH']},
152167
userId: response.user,
153168
token: response.userToken
154169
},
@@ -167,4 +182,8 @@ We provide a test script hosted on GitHub for you to use for testing. For produc
167182

168183
```
169184

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

Comments
 (0)