You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/communication-services/quickstarts/chat/includes/chat-android.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -434,4 +434,4 @@ In Android Studio, hit the Run button to build and run the project. In the conso
434
434
435
435
## Sample code
436
436
437
-
Find the finalized code for this quickstart on GitHub at[Add chat to your app](https://github.com/Azure-Samples/communication-services-android-quickstarts/tree/main/Add-chat).
437
+
Find the finalized code for this article in the GitHub sample[Add Chat to your application](https://github.com/Azure-Samples/communication-services-android-quickstarts/tree/main/Add-chat).
Copy file name to clipboardExpand all lines: articles/communication-services/quickstarts/chat/includes/chat-csharp.md
+29-27Lines changed: 29 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,19 +13,19 @@ ms.author: rifox
13
13
---
14
14
15
15
## Prerequisites
16
-
Before you get started, make sure to:
16
+
17
17
- Create an Azure account with an active subscription. For details, see [Create an account for free](https://azure.microsoft.com/free/?WT.mc_id=A261C142F).
- Create an Azure Communication Services resource. For details, see [Create an Azure Communication Services resource](../../create-communication-resource.md). You'll need to record your resource **endpoint and connection string** for this quickstart.
20
-
- A [User Access Token](../../identity/access-tokens.md). Be sure to set the scope to **chat**, and **note the token string as well as the user_id string**. You can also use the Azure CLI and run the command below with your connection string to create a user and an access token.
19
+
- Create an Azure Communication Services resource. For details, see [Create an Azure Communication Services resource](../../create-communication-resource.md). You need to record your resource **endpoint and connection string** for this article.
20
+
- A [User Access Token](../../identity/access-tokens.md). Be sure to set the scope to **chat**, and **note the token string as well as the user_id string**. You can also use the Azure CLI and run the following command with your connection string to create a user and an access token.
21
21
22
22
```azurecli-interactive
23
23
az communication identity token issue --scope chat --connection-string "yourConnectionString"
24
24
```
25
25
26
26
For details, see [Use Azure CLI to Create and Manage Access Tokens](../../identity/access-tokens.md?pivots=platform-azcli).
27
27
28
-
## Setting up
28
+
## Set up
29
29
30
30
### Create a new C# application
31
31
@@ -56,18 +56,19 @@ The following classes handle some of the major features of the Azure Communicati
| ChatClient | This class is needed for the Chat functionality. You instantiate it with your subscription information, and use it to create, get and delete threads. |
59
+
| ChatClient | This class is needed for the Chat functionality. You instantiate it with your subscription information, and use it to create, get, and delete threads. |
60
60
| ChatThreadClient | This class is needed for the Chat Thread functionality. You obtain an instance via the ChatClient, and use it to send/receive/update/delete messages, add/remove/get participants, send typing notifications and read receipts. |
61
61
62
62
## Create a chat client
63
63
64
-
To create a chat client, you'll use your Communication Services endpoint and the access token that was generated as part of the prerequisite steps. You need to use the `CommunicationIdentityClient` class from the Identity SDK to create a user and issue a token to pass to your chat client.
64
+
To create a chat client, use your Communication Services endpoint and the access token that was generated as part of the prerequisite steps. You need to use the `CommunicationIdentityClient` class from the Identity SDK to create a user and issue a token to pass to your chat client.
65
65
66
66
Learn more about [User Access Tokens](../../identity/access-tokens.md).
67
67
68
-
This quickstart doesn't cover creating a service tier to manage tokens for your chat application, although it's recommended. Learn more about [Chat Architecture](../../../concepts/chat/concepts.md)
68
+
This article doesn't cover creating a service tier to manage tokens for your chat application, although we recommend it. For more information, see [Chat Architecture](../../../concepts/chat/concepts.md).
69
+
70
+
Copy the following code snippets and paste into the `Program.cs` source file.
69
71
70
-
Copy the following code snippets and paste into source file: **Program.cs**
71
72
```csharp
72
73
usingAzure;
73
74
usingAzure.Communication;
@@ -93,10 +94,10 @@ namespace ChatQuickstart
93
94
## Start a chat thread
94
95
95
96
Use the `createChatThread` method on the chatClient to create a chat thread
96
-
- Use `topic` to give a topic to this chat; Topic can be updated after the chat thread is created using the `UpdateTopic` function.
97
-
- Use `participants` property to pass a list of `ChatParticipant` objects to be added to the chat thread. The `ChatParticipant` object is initialized with a `CommunicationIdentifier` object. `CommunicationIdentifier` could be of type `CommunicationUserIdentifier`, `MicrosoftTeamsUserIdentifier` or `PhoneNumberIdentifier`. For example, to get a `CommunicationIdentifier` object, you'll need to pass an Access ID which you created by following instruction to [Create a user](../../identity/access-tokens.md#create-an-identity)
97
+
- Use `topic` to give a topic to this chat. You can update the topic after creating the chat thread using the `UpdateTopic` function.
98
+
- Use `participants` property to pass a list of `ChatParticipant` objects to be added to the chat thread. The `ChatParticipant` object is initialized with a `CommunicationIdentifier` object. `CommunicationIdentifier` could be of type `CommunicationUserIdentifier`, `MicrosoftTeamsUserIdentifier`, or `PhoneNumberIdentifier`. For example, to get a `CommunicationIdentifier` object, you need to pass an Access ID which you created by following instruction to [Create a user](../../identity/access-tokens.md#create-an-identity)
98
99
99
-
The response object from the `createChatThread` method contains the `chatThread` details. To interact with the chat thread operations such as adding participants, sending a message, deleting a message, etc., a `chatThreadClient` client instance needs to instantiated using the `GetChatThreadClient` method on the `ChatClient` client.
100
+
The response object from the `createChatThread` method contains the `chatThread` details. To interact with the chat thread operations such as adding participants, sending a message, deleting a message, and so on, a `chatThreadClient` client instance needs to instantiated using the `GetChatThreadClient` method on the `ChatClient` client.
The `GetChatThreadClient` method returns a thread client for a thread that already exists. It can be used for performing operations on the created thread: add members, send message, etc. threadId is the unique ID of the existing chat thread.
113
+
The `GetChatThreadClient` method returns a thread client for a thread that already exists. You can use it to perform operations on the created thread: add members, send message, and so on. `threadId` is the unique ID of the existing chat thread.
113
114
114
115
```csharp
115
116
stringthreadId="<THREAD_ID>";
@@ -131,10 +132,10 @@ await foreach (ChatThreadItem chatThreadItem in chatThreadItems)
131
132
132
133
Use `SendMessage` to send a message to a thread.
133
134
134
-
- Use `content` to provide the content for the message, it's required.
135
-
- Use `type` for the content type of the message such as 'Text' or 'Html'. If not specified, 'Text' will be set.
136
-
- Use `senderDisplayName` to specify the display name of the sender. If not specified, empty string will be set.
137
-
- Use `metadata`optionally to include any additional data you want to send along with the message. This field provides a mechanism for developers to extend chat message functionality and add custom information for your use case. For example, when sharing a file link in the message, you might want to add 'hasAttachment:true' in metadata so that recipient's application can parse that and display accordingly.
135
+
- Use `content` to provide the content for the message. Required.
136
+
- Use `type` for the content type of the message such as 'Text' or 'Html'. If not specified, 'Text' is set.
137
+
- Use `senderDisplayName` to specify the display name of the sender. If not specified, empty string is set.
138
+
-Optional: Use `metadata` to include other data you want to send along with the message. This field provides a mechanism for developers to extend chat message functionality and add custom information for your use case. For example, when sharing a file link in the message, you might want to add 'hasAttachment:true' in metadata so that recipient's application can parse that and display accordingly.
@@ -162,29 +163,29 @@ await foreach (ChatMessage message in allMessages)
162
163
}
163
164
```
164
165
165
-
`GetMessages` takes an optional `DateTimeOffset` parameter. If that offset is specified, you'll receive messages that were received, updated or deleted after it. Note that messages received before the offset time but edited or removed after it will also be returned.
166
+
`GetMessages` takes an optional `DateTimeOffset` parameter. If that offset is specified, you receive messages that were received, updated, or deleted after it. Messages received before the offset time but edited or removed afterward are also returned.
166
167
167
168
`GetMessages` returns the latest version of the message, including any edits or deletes that happened to the message using `UpdateMessage` and `DeleteMessage`. For deleted messages, `chatMessage.DeletedOn` returns a datetime value indicating when that message was deleted. For edited messages, `chatMessage.EditedOn` returns a datetime indicating when the message was edited. The original time of message creation can be accessed using `chatMessage.CreatedOn`, and it can be used for ordering the messages.
168
169
169
-
`GetMessages` returns different types of messages which can be identified by `chatMessage.Type`. These types are:
170
+
`GetMessages` returns different types of messages. You can identify the type from the `chatMessage.Type`. The types are:
170
171
171
172
-`Text`: Regular chat message sent by a thread member.
172
173
173
-
-`Html`: A formatted text message. Note that Communication Services users currently can't send RichText messages. This message type is supported by messages sent from Teams users to Communication Services users in Teams Interop scenarios.
174
+
-`Html`: A formatted text message. Communication Services users currently can't send RichText messages. This message type is supported for messages sent from Teams users to Communication Services users in Teams Interop scenarios.
174
175
175
-
-`TopicUpdated`: System message that indicates the topic has been updated. (readonly)
176
+
-`TopicUpdated`: System message that indicates the topic is updated. (readonly)
176
177
177
-
-`ParticipantAdded`: System message that indicates one or more participants have been added to the chat thread.(readonly)
178
+
-`ParticipantAdded`: System message that indicates one or more participants are added to the chat thread(readonly).
178
179
179
-
-`ParticipantRemoved`: System message that indicates a participant has been removed from the chat thread.
180
+
-`ParticipantRemoved`: System message that indicates a participant is removed from the chat thread.
180
181
181
-
For more details, see [Message Types](../../../concepts/chat/concepts.md#message-types).
182
+
For more information, see [Message Types](../../../concepts/chat/concepts.md#message-types).
182
183
183
184
## Add a user as a participant to the chat thread
184
185
185
-
Once a thread is created, you can then add and remove users from it. By adding users, you give them access to be able to send messages to the thread, and add/remove other participant. Before calling `AddParticipants`, ensure that you have acquired a new access token and identity for that user. The user will need that access token in order to initialize their chat client.
186
+
Once a thread is created, you can then add and remove users from it. By adding users, you give them access to be able to send messages to the thread, and add/remove other participant. Before calling `AddParticipants`, ensure that you acquire a new access token and identity for that user. The user needs that access token in order to initialize their chat client.
186
187
187
-
Use `AddParticipants` to add one or more participants to the chat thread. The following are the supported attributes for each thread participant(s):
188
+
Use `AddParticipants` to add one or more participants to the chat thread. The following are the supported attributes for each thread participant:
188
189
-`communicationUser`, required, is the identity of the thread participant.
189
190
-`displayName`, optional, is the display name for the thread participant.
190
191
-`shareHistoryTime`, optional, time from which the chat history is shared with the participant.
@@ -218,7 +219,7 @@ await foreach (ChatParticipant participant in allParticipants)
218
219
219
220
## Send read receipt
220
221
221
-
Use `SendReadReceipt` to notify other participants that the message is read by the user.
222
+
Use `SendReadReceipt` to notify other participants that the user read the message.
Find the finalized code for this quickstart on [GitHub](https://github.com/Azure-Samples/communication-services-dotnet-quickstarts/tree/main/add-chat).
237
+
238
+
Find the finalized code for this article in the GitHub sample [Add Chat to your application](https://github.com/Azure-Samples/communication-services-dotnet-quickstarts/tree/main/add-chat).
0 commit comments