Skip to content

Commit 96ce3da

Browse files
Merge pull request #234352 from AikoBB/aigerimb/acs-identity/bot-identifier
ACS identifier types - Botidentifier
2 parents 1e90cac + 21b6d63 commit 96ce3da

File tree

6 files changed

+206
-8
lines changed

6 files changed

+206
-8
lines changed

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

Lines changed: 41 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,45 @@ 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
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+
// If you use Azure Bot Framework instead of Teams Voice applications, set property isResourceAccountConfigured to false.
99+
MicrosoftBotIdentifier gcchBotIdentifier = new MicrosoftBotIdentifier(bot.id, true, CommunicationCloudEnvironment.GCCH);
100+
```
101+
102+
#### API reference
103+
104+
[MicrosoftBotIdentifier](https://azure.github.io/azure-sdk-for-android/azure-communication-common/com/azure/android/communication/common/MicrosoftBotIdentifier.html)
105+
74106
### Unknown
75107

76108
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 +111,7 @@ The `UnknownIdentifier` exists for future-proofing and you might encounter it wh
79111

80112
```java
81113
// create an identifier
82-
var unknown = new UnknownIdentifier("a raw id that originated in the service");
114+
UnknownIdentifier unknown = new UnknownIdentifier("a raw id that originated in the service");
83115
```
84116

85117
#### API reference
@@ -100,6 +132,9 @@ else if (communicationIdentifier instanceof MicrosoftTeamsUserIdentifier) {
100132
else if (communicationIdentifier instanceof PhoneNumberIdentifier) {
101133
Log.i(tag, "Phone number: " + ((PhoneNumberIdentifier)communicationIdentifier).getPhoneNumber());
102134
}
135+
else if (communicationIdentifier instanceof MicrosoftBotIdentifier) {
136+
Log.i(tag, "Microsoft bot: " + ((MicrosoftBotIdentifier)communicationIdentifier).getBotId());
137+
}
103138
else if (communicationIdentifier instanceof UnknownIdentifier) {
104139
Log.i(tag, "Unkown user: " + ((UnknownIdentifier)communicationIdentifier).getId());
105140
}

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

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ let userId = await getUserIdFromGraph("[email protected]")
4545
let teamsUser = MicrosoftTeamsUserIdentifier(userId: userId)
4646

4747
// if you're not operating in the public cloud, you must also pass the right Cloud type.
48-
gcchTeamsUser = MicrosoftTeamsUserIdentifier(userId: userId, cloud: CommunicationCloudEnvironment.Gcch)
48+
let gcchTeamsUser = MicrosoftTeamsUserIdentifier(userId: userId, cloud: CommunicationCloudEnvironment.Gcch)
4949
```
5050

5151
#### API reference
@@ -67,6 +67,30 @@ let phoneNumber = PhoneNumberIdentifier(phoneNumber: "+112345556789")
6767

6868
[PhoneNumberIdentifier](https://azure.github.io/azure-sdk-for-ios/AzureCommunicationCommon/Classes/PhoneNumberIdentifier.html)
6969

70+
### Microsoft bot
71+
72+
> [!NOTE]
73+
> 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/).
74+
75+
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).
76+
#### Basic usage
77+
78+
```swift
79+
// Get the Microsoft bot's ID from Graph APIs, assuming a helper method for the Graph API
80+
let botId = await getBotIdFromGraph()
81+
82+
// Create an identifier
83+
let botIdentifier = MicrosoftBotIdentifier(botId: botId)
84+
85+
// If you're not operating in the public cloud, you must also pass the right Cloud type.
86+
// If you use Azure Bot Framework instead of Teams Voice applications, set property isResourceAccountConfigured to false.
87+
let gcchBotIdentifier = MicrosoftBotIdentifier(botId: botId, isResourceAccountConfigured: true, cloudEnvironment: CommunicationCloudEnvironment.Gcch)
88+
```
89+
90+
#### API reference
91+
92+
[MicrosoftBotIdentifier](https://azure.github.io/azure-sdk-for-ios/AzureCommunicationCommon/Classes/MicrosoftBotIdentifier.html)
93+
7094
### Unknown
7195

7296
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.
@@ -95,6 +119,8 @@ switch (communicationIdentifier)
95119
print(#"Teams user: \(teamsUser.UserId)"#)
96120
case let phoneNumber as PhoneNumberIdentifier:
97121
print(#"Phone number: \(phoneNumber.PhoneNumber)"#)
122+
case let bot as MicrosoftBotIdentifier:
123+
print(#"Microsoft bot: \(bot.botId)"#)
98124
case let unknown as UnknownIdentifier:
99125
print(#"Unknown: \(unknown.Id)"#)
100126
@unknown default:

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

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ 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+
var user = graphClient.users("[email protected]")
4545
.buildRequest()
4646
.get();
4747

@@ -71,6 +71,38 @@ var phoneNumber = new PhoneNumberIdentifier("+112345556789");
7171

7272
[PhoneNumberIdentifier](/java/api/com.azure.communication.common.phonenumberidentifier)
7373

74+
### Microsoft bot
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+
var user = 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+
var bot = getBotFromUsers(users);
93+
94+
// Create an identifier
95+
var 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+
// If you use Azure Bot Framework instead of Teams Voice applications, set property isResourceAccountConfigured to false.
99+
var gcchBotIdentifier = new MicrosoftBotIdentifier(bot.id, true, CommunicationCloudEnvironment.GCCH);
100+
```
101+
102+
#### API reference
103+
104+
[MicrosoftBotIdentifier](/java/api/com.azure.communication.common.microsoftbotidentifier?view=azure-java-preview)
105+
74106
### Unknown
75107

76108
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.
@@ -100,6 +132,9 @@ else if (communicationIdentifier instanceof MicrosoftTeamsUserIdentifier) {
100132
else if (communicationIdentifier instanceof PhoneNumberIdentifier) {
101133
System.out.println("Phone number: " + ((PhoneNumberIdentifier)communicationIdentifier).getPhoneNumber());
102134
}
135+
else if (communicationIdentifier instanceof MicrosoftBotIdentifier) {
136+
Log.i(tag, "Microsoft bot: " + ((MicrosoftBotIdentifier)communicationIdentifier).getBotId());
137+
}
103138
else if (communicationIdentifier instanceof UnknownIdentifier) {
104139
System.out.println("Unkown user: " + ((UnknownIdentifier)communicationIdentifier).getId());
105140
}

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

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,35 @@ const phoneNumber = { phoneNumber: "+112345556789" };
6969

7070
[PhoneNumberIdentifier](/javascript/api/@azure/communication-common/phonenumberidentifier)
7171

72+
### Microsoft bot
73+
74+
> [!NOTE]
75+
> 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/).
76+
77+
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).
78+
79+
#### Basic usage
80+
81+
```javascript
82+
// Get the Microsoft bot's ID from Graph APIs
83+
const users = await graphClient.api("/users")
84+
.filter(filterConditions)
85+
.select('displayName,id')
86+
.get();
87+
//Here we assume that you have a function getBotFromUsers that gets the bot from the returned response
88+
const bot = getBotFromUsers(users);
89+
// Create an identifier
90+
const botIdentifier = { botId: bot.id };
91+
92+
// If you're not operating in the public cloud, you must also pass the right Cloud type.
93+
// If you use Azure Bot Framework instead of Teams Voice applications, set property isResourceAccountConfigured to false.
94+
const gcchBotIdentifier = { botId: id, cloud: "gcch", isResourceAccountConfigured: true };
95+
```
96+
97+
#### API reference
98+
99+
[MicrosoftBotIdentifier](/javascript/api/@azure/communication-common/microsoftbotidentifier?view=azure-node-preview)
100+
72101
### Unknown
73102

74103
The `UnknownIdentifier` interface 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.
@@ -107,6 +136,10 @@ switch (communicationIdentifier.kind)
107136
// narrowed to UnknownIdentifierKind
108137
console.log(`Unknown: ${communicationIdentifier.id}`);
109138
break;
139+
case "microsoftBot":
140+
// narrowed to MicrosoftBotIdentifier
141+
console.log(`Microsoft bot: ${communicationIdentifier.botId}`);
142+
break;
110143
default:
111144
// be careful here whether you want to throw because a new SDK version
112145
// can introduce new identifier types

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

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,38 @@ var phoneNumber = new PhoneNumberIdentifier("+112345556789");
7171

7272
[PhoneNumberIdentifier](/dotnet/api/azure.communication.phonenumberidentifier)
7373

74+
### Microsoft bot
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+
```csharp
84+
// Get the Microsoft bot's ID from Graph APIs
85+
var users = await graphClient.Users.GetAsync((requestConfiguration) =>
86+
{
87+
requestConfiguration.QueryParameters.Select = new string []{ "displayName","id" };
88+
requestConfiguration.QueryParameters.Filter = filterConditions;
89+
});
90+
91+
// Here we assume that you have a function GetBotFromUsers that gets the bot from the returned response
92+
var bot = GetBotFromUsers(users);
93+
94+
// Create an identifier
95+
var 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+
// If you use Azure Bot Framework instead of Teams Voice applications, set property isResourceAccountConfigured to false.
99+
var gcchBotIdentifier = new MicrosoftBotIdentifier(bot.Id, true, CommunicationCloudEnvironment.Gcch);
100+
```
101+
102+
#### API reference
103+
104+
[MicrosoftBotIdentifier](/dotnet/api/azure.communication.microsoftbotidentifier?view=azure-dotnet-preview)
105+
74106
### Unknown
75107

76108
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.
@@ -102,6 +134,9 @@ switch (communicationIdentifier)
102134
case PhoneNumberIdentifier phoneNumber:
103135
Console.WriteLine($"Phone number: {phoneNumber.PhoneNumber}");
104136
break;
137+
case MicrosoftBotIdentifier bot:
138+
Console.WriteLine($"Microsoft bot: {bot.BotId}");
139+
break;
105140
case UnknownIdentifier unknown:
106141
Console.WriteLine($"Unknown: {unknown.Id}");
107142
break;

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

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,38 @@ phone_number = PhoneNumberIdentifier("+112345556789")
6969

7070
[PhoneNumberIdentifier](/python/api/azure-communication-chat/azure.communication.chat.phonenumberidentifier)
7171

72+
### Microsoft bot
73+
74+
> [!NOTE]
75+
> 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/).
76+
77+
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).
78+
79+
#### Basic usage
80+
81+
```python
82+
# Get the Microsoft bot's ID from Graph APIs
83+
users = graph_client.get("/users").json()
84+
85+
# Here we assume that you have a function get_bot_from_users that gets the bot from the returned response
86+
bot = get_bot_from_users(users);
87+
88+
# Create an identifier
89+
bot_identifier = MicrosoftBotIdentifier(bot_id=bot.get("id"))
90+
91+
# If you're not operating in the public cloud, you must also pass the right Cloud type.
92+
# If you use Azure Bot Framework instead of Teams Voice applications, set property isResourceAccountConfigured to false.
93+
gcch_bot_identifier = MicrosoftBotIdentifier(
94+
bot_id=bot.get("id"),
95+
is_resource_account_configured=True,
96+
cloud=CommunicationCloudEnvironment.GCCH
97+
)
98+
```
99+
100+
#### API reference
101+
102+
[MicrosoftBotIdentifier](/python/api/azure-communication-identity/azure.communication.identity.microsoftbotidentifier?view=azure-python-preview)
103+
72104
### Unknown
73105

74106
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.
@@ -96,6 +128,8 @@ match communication_identifier.kind:
96128
print(f"Teams user: {communication_identifier.properties['user_id']}")
97129
case CommunicationIdentifierKind.PHONE_NUMBER:
98130
print(f"Phone number: {communication_identifier.properties['value']}")
131+
case CommunicationIdentifierKind.MICROSOFT_BOT:
132+
print(f"Microsoft bot: {communication_identifier.properties['bot_id']}")
99133
case CommunicationIdentifierKind.UNKNOWN:
100134
print(f"Unknown: {communication_identifier.raw_id}")
101135
case _:

0 commit comments

Comments
 (0)