ClientContext Class
Runtime information about the client and session in Microsoft Teams.
Constructor
ClientContext(app_session_id: str, tenant_id: str, user_id: str, user_name: str, page_id: str, auth_token: str, app_id: str | None = None, team_id: str | None = None, message_id: str | None = None, channel_id: str | None = None, chat_id: str | None = None, meeting_id: str | None = None, sub_page_id: str | None = None, _resolved_conversation_id: str | None = None)
Parameters
| Name | Description |
|---|---|
|
app_session_id
Required
|
|
|
tenant_id
Required
|
|
|
user_id
Required
|
|
|
user_name
Required
|
|
|
page_id
Required
|
|
|
auth_token
Required
|
|
|
app_id
|
Default value: None
|
|
team_id
|
Default value: None
|
|
message_id
|
Default value: None
|
|
channel_id
|
Default value: None
|
|
chat_id
|
Default value: None
|
|
meeting_id
|
Default value: None
|
|
sub_page_id
|
Default value: None
|
|
_resolved_conversation_id
|
Default value: None
|
Attributes
app_id
This ID is the unique identifier assigned to the app after deployment and is critical for ensuring the correct app instance is recognized across hosts.
app_id: str | None = None
app_session_id
Unique ID for the current session for use in correlating telemetry data. A session corresponds to the lifecycle of an app. A new session begins upon the creation of a webview (on Teams mobile) or iframe (in Teams desktop) hosting the app, and ends when it is destroyed.
app_session_id: str
auth_token
The MSAL Entra token.
auth_token: str
channel_id
The Microsoft Teams ID for the channel with which the content is associated.
channel_id: str | None = None
chat_id
The Microsoft Teams ID for the chat with which the content is associated.
chat_id: str | None = None
conversation_id
The Microsoft Teams ID for the conversation with which the content is associated.
meeting_id
Meeting ID used by tab when running in meeting context.
meeting_id: str | None = None
message_id
The ID of the parent message from which this task module was launched. This is only available in task modules launched from bot cards.
message_id: str | None = None
page_id
The developer-defined unique ID for the page this content points to.
page_id: str
sub_page_id
The developer-defined unique ID for the sub-page this content points to. This field should be used to restore to a specific state within a page, such as scrolling to or activating a specific piece of content.
sub_page_id: str | None = None
team_id
The Microsoft Teams ID for the team with which the content is associated.
team_id: str | None = None
tenant_id
The Microsoft Entra tenant ID of the current user, extracted from request auth token.
tenant_id: str
user_id
The Microsoft Entra object ID of the current user, extracted from the request auth token.
user_id: str
user_name
The name of the current user, extracted from the request auth token.
user_name: str