These sample programs show how to use the TypeScript client libraries for Azure Communication Service Communication Chat to create chat threads and send messages.
|threadOperations.js||create, retrieve, update and delete a chat thread|
|messageOperations.js||send, list, update and delete chat messages|
|participantsOperations.js||add, list, and remove participants from a chat thread|
The sample is compatible with Node.js >= 8.0.0.
Adapting the samples to run in the browser may require some additional consideration. For details, please see the package README.
To run the sample using the published version of the package:
- Install the dependencies using
Edit the file
sample.env, adding the correct credentials to access the Azure service and run the samples. Then rename the file from
.env. The sample programs will read this file automatically.
Run whichever samples you like:
Alternatively, run a single sample with the correct environment variables set (step 3 is not required if you do this), for example (cross-platform):
npx cross-env COMMUNICATION_CONNECTION_STRING="<connection string>" node threadOperations.js
Take a look at our API Documentation for more information about the APIs that are available in the clients.