Skip to content

Commit 2dc5502

Browse files
committed
added bot identifier for android
1 parent 14de92c commit 2dc5502

File tree

1 file changed

+42
-6
lines changed

1 file changed

+42
-6
lines changed

articles/communication-services/concepts/includes/identifiers/identifiers-android.md

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ CommunicationUserIdentifier newUser = identityClient.CreateUser();
2626

2727
// and then send newUser.getId() down to your client application
2828
// where you can again create an identifier for the user
29-
var sameUser = new CommunicationUserIdentifier(newUserId);
29+
CommunicationUserIdentifier sameUser = new CommunicationUserIdentifier(newUserId);
3030
```
3131

3232
#### API reference
@@ -41,15 +41,15 @@ The `MicrosoftTeamsUserIdentifier` represents a Teams user with its Azure AD use
4141

4242
```java
4343
// get the Teams user's ID from Graph APIs if only the email is known
44-
var user = await graphClient.users("[email protected]")
44+
User user = graphClient.users("[email protected]")
4545
.buildRequest()
4646
.get();
4747

4848
// create an identifier
49-
var teamsUser = new MicrosoftTeamsUserIdentifier(user.id);
49+
MicrosoftTeamsUserIdentifier teamsUser = new MicrosoftTeamsUserIdentifier(user.id);
5050

5151
// if you're not operating in the public cloud, you must also set the right Cloud type.
52-
var gcchTeamsUser = new MicrosoftTeamsUserIdentifier(userId).setCloudEnvironment(CommunicationCloudEnvironment.GCCH);
52+
MicrosoftTeamsUserIdentifier gcchTeamsUser = new MicrosoftTeamsUserIdentifier(userId).setCloudEnvironment(CommunicationCloudEnvironment.GCCH);
5353
```
5454

5555
#### API reference
@@ -64,13 +64,46 @@ The `PhoneNumberIdentifier` represents a phone number. The service assumes that
6464

6565
```java
6666
// create an identifier
67-
var phoneNumber = new PhoneNumberIdentifier("+112345556789");
67+
PhoneNumberIdentifier phoneNumber = new PhoneNumberIdentifier("+112345556789");
6868
```
6969

7070
#### API reference
7171

7272
[PhoneNumberIdentifier](https://azure.github.io/azure-sdk-for-android/azure-communication-common/com/azure/android/communication/common/PhoneNumberIdentifier.html)
7373

74+
### Microsoft Bot Identifier
75+
76+
> [!NOTE]
77+
> The Microsoft Bot Identifier is currently in public preview. For more information about previews, see [Supplemental Terms of Use for Microsoft Azure Previews](https://azure.microsoft.com/support/legal/preview-supplemental-terms/).
78+
79+
The `MicrosoftBotIdentifier` interface represents a Microsoft bot with its Azure AD bot object ID. In the preview version the interface represents a bot of the Teams Voice applications such as Call Queue and Auto Attendant, and the application should be configured with a resource account. You can retrieve the Azure AD bot object ID via the [Microsoft Graph REST API /users](/graph/api/user-list) endpoint from the `id` property in the response. For more information on how to work with Microsoft Graph, try the [Graph Explorer](https://developer.microsoft.com/en-us/graph/graph-explorer?request=users%2F%7Buser-mail%7D&method=GET&version=v1.0&GraphUrl=https://graph.microsoft.com) and look into the [Graph SDK](/graph/sdks/sdks-overview).
80+
81+
#### Basic usage
82+
83+
```java
84+
// get the Microsoft bot's ID from Graph APIs
85+
UserCollectionPage users = graphClient.users()
86+
.buildRequest()
87+
.filter(filterConditions)
88+
.select("displayName,id")
89+
.get();
90+
91+
//here we assume that you have a function getBotFromUsers that gets the bot from the returned response
92+
User bot = getBotFromUsers(users);
93+
94+
// create an identifier
95+
MicrosoftBotIdentifier botIdentifier = new MicrosoftBotIdentifier(bot.id);
96+
97+
// if you're not operating in the public cloud, you must also pass the right Cloud type.
98+
// You can also specify tenantized bots by setting the isResourceAccountConfigured flag to true.
99+
// The flag is false if the bot is global and no resource account is configured.
100+
MicrosoftBotIdentifier gcchBotIdentifier = new MicrosoftBotIdentifier(bot.id, true, CommunicationCloudEnvironment.GCCH);
101+
```
102+
103+
#### API reference
104+
105+
[MicrosoftBotIdentifier](/java/api/com.azure.communication.common.microsoftbotidentifier?view=azure-java-preview)
106+
74107
### Unknown
75108

76109
The `UnknownIdentifier` exists for future-proofing and you might encounter it when you are on an old version of the SDK and a new identifier type has been introduced recently. Any unknown identifier from the service will be deserialized to the `UnknownIdentifier` in the SDK.
@@ -79,7 +112,7 @@ The `UnknownIdentifier` exists for future-proofing and you might encounter it wh
79112

80113
```java
81114
// create an identifier
82-
var unknown = new UnknownIdentifier("a raw id that originated in the service");
115+
UnknownIdentifier unknown = new UnknownIdentifier("a raw id that originated in the service");
83116
```
84117

85118
#### API reference
@@ -100,6 +133,9 @@ else if (communicationIdentifier instanceof MicrosoftTeamsUserIdentifier) {
100133
else if (communicationIdentifier instanceof PhoneNumberIdentifier) {
101134
Log.i(tag, "Phone number: " + ((PhoneNumberIdentifier)communicationIdentifier).getPhoneNumber());
102135
}
136+
else if (communicationIdentifier instanceof MicrosoftBotIdentifier) {
137+
Log.i(tag, "Microsoft bot: " + ((MicrosoftBotIdentifier)communicationIdentifier).getBotId());
138+
}
103139
else if (communicationIdentifier instanceof UnknownIdentifier) {
104140
Log.i(tag, "Unkown user: " + ((UnknownIdentifier)communicationIdentifier).getId());
105141
}

0 commit comments

Comments
 (0)