Skip to content

Commit dcd125b

Browse files
committed
added bot identifier for python
1 parent 752c907 commit dcd125b

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

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

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

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

72+
### Microsoft Bot Identifier
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+
# You can also specify tenantized bots by setting the is_resource_account_configured flag to true.
93+
# The flag is false if the bot is global and no resource account is configured.
94+
gcch_bot_identifier = MicrosoftBotIdentifier(
95+
bot_id=bot.get("id"),
96+
is_resource_account_configured=True,
97+
cloud=CommunicationCloudEnvironment.GCCH
98+
)
99+
```
100+
101+
#### API reference
102+
103+
[MicrosoftTeamsUserIdentifier](/python/api/azure-communication-identity/azure.communication.identity.microsoftbotidentifier?view=azure-python-preview)
104+
72105
### Unknown
73106

74107
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.

0 commit comments

Comments
 (0)