Azure Communication Services Static Web App with Token API Template

This repo shows how you can develop and deploy an Azure Communication Services app with the help of Azure Static Web Apps.

Access Tokens

To work with chat and calling in Azure Communication Services you need to obtain user access tokens. This repo comes with a pre-configured /api/token endpoint that you can call from your web app and get access to calling and chat functionality right away.

Prerequisites

Local Development

To set up local development follow the steps from the Static Web Apps how-to guide:

  1. Install the CLI.

    npm install -g @azure/static-web-apps-cli azure-functions-core-tools
  2. Get your Azure Communication Services connection string and add enter it under COMMUNICATION_SERVICES_CONNECTION_STRING key in your local.settings.json file:

    {
        "IsEncrypted": false,
        "Values": {
            "AzureWebJobsStorage": "",
            "FUNCTIONS_WORKER_RUNTIME": "dotnet",
            "COMMUNICATION_SERVICES_CONNECTION_STRING": "<YOUR CONNECTION STRING HERE>"
        }
    }
  3. From the root of your repo start the Azure Static Web Apps CLI.

    swa start src --api-location api

Deploying to Azure Static Web Apps

  1. Follow the Static Web Apps quickstart to configure and deploy your web app via Azure Portal.

  2. Once the app is deployed, use the Azure Portal to configure app settings: add a new app setting with name = COMMUNICATION_SERVICES_CONNECTION_STRING and value = your Azure Communication Services connection string.