Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

README.md

page_type sample
languages
Python
products
azure
azure-communication-chat
azure-communication-identity

Add Chat to your App

For full instructions on how to build this code sample from scratch, look at Quickstart: Add Chat to your App

Prerequisites

Code Structure

  • ./add-chat/start-chat.py: contains code for chat.

Install the packages

pip install azure-communication-chat

pip install azure-communication-identity

Before running sample code

  1. Open an instance of PowerShell, Windows Terminal, Command Prompt or equivalent and navigate to the directory that you'd like to clone the sample to.
  2. git clone https://github.com/Azure-Samples/communication-services-python-quickstarts.git
  3. With the Communication Services procured in pre-requisites, add endpoint to start-chat.py file at line no:11 endpoint = "https://<RESOURCE_NAME>.communication.azure.com".
  4. With the access token procured in pre-requisites, add it to the start-chat.py file. Assign token at line no:12 chat_client = ChatClient(endpoint, CommunicationTokenCredential("<Access Token>")).
  5. With the Communication Services procured in pre-requisites, add connection string to start-chat.py file at line no:58 identity_client = CommunicationIdentityClient.from_connection_string('<connection_string>').

Run Locally

From a console prompt, navigate to the directory containing the start-chat.py file, then execute the following command to run the app.

python ./start-chat.py