Azure SDK for JavaScript

Overview

The Azure Communication Services (ACS) JavaScript SDK enables you to add voice, video, chat, and SMS capabilities to your web applications. It is built on top of the Azure SDK core libraries and follows the same design patterns for consistency and ease of use.

Installation

npm install @azure/communication-chat @azure/communication-common @azure/communication-identity @azure/communication-calling

Quick Start

JavaScript
TypeScript
// Initialize the Identity client
import { CommunicationIdentityClient } from "@azure/communication-identity";

const connectionString = "";
const client = new CommunicationIdentityClient(connectionString);

async function createUser() {
    const identityResponse = await client.createUser();
    const tokenResponse = await client.getToken(identityResponse, ["voip"]);
    console.log("User ID:", identityResponse.communicationUserId);
    console.log("Access Token:", tokenResponse.token);
}
createUser();
import { CommunicationIdentityClient, CommunicationUserIdentifier } from "@azure/communication-identity";

const connectionString: string = "";
const identityClient = new CommunicationIdentityClient(connectionString);

async function generateToken(): Promise<{ user: CommunicationUserIdentifier; token: string }> {
    const user = await identityClient.createUser();
    const tokenResponse = await identityClient.getToken(user, ["voip"]);
    return { user, token: tokenResponse.token };
}
generateToken().then(console.log);

Key Concepts

Resources