universal-mcp-applications 0.1.33__py3-none-any.whl → 0.1.39rc16__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of universal-mcp-applications might be problematic. Click here for more details.

Files changed (119) hide show
  1. universal_mcp/applications/BEST_PRACTICES.md +1 -1
  2. universal_mcp/applications/ahrefs/app.py +92 -238
  3. universal_mcp/applications/airtable/app.py +36 -135
  4. universal_mcp/applications/apollo/app.py +124 -477
  5. universal_mcp/applications/asana/app.py +605 -1755
  6. universal_mcp/applications/aws_s3/app.py +63 -119
  7. universal_mcp/applications/bill/app.py +644 -2055
  8. universal_mcp/applications/box/app.py +1246 -4159
  9. universal_mcp/applications/braze/app.py +410 -1476
  10. universal_mcp/applications/browser_use/README.md +15 -1
  11. universal_mcp/applications/browser_use/__init__.py +1 -0
  12. universal_mcp/applications/browser_use/app.py +91 -26
  13. universal_mcp/applications/cal_com_v2/app.py +207 -625
  14. universal_mcp/applications/calendly/app.py +103 -242
  15. universal_mcp/applications/canva/app.py +75 -140
  16. universal_mcp/applications/clickup/app.py +331 -798
  17. universal_mcp/applications/coda/app.py +240 -520
  18. universal_mcp/applications/confluence/app.py +497 -1285
  19. universal_mcp/applications/contentful/app.py +40 -155
  20. universal_mcp/applications/crustdata/app.py +44 -123
  21. universal_mcp/applications/dialpad/app.py +451 -924
  22. universal_mcp/applications/digitalocean/app.py +2071 -6082
  23. universal_mcp/applications/domain_checker/app.py +3 -54
  24. universal_mcp/applications/e2b/app.py +17 -68
  25. universal_mcp/applications/elevenlabs/README.md +27 -3
  26. universal_mcp/applications/elevenlabs/app.py +741 -74
  27. universal_mcp/applications/exa/README.md +8 -4
  28. universal_mcp/applications/exa/app.py +415 -186
  29. universal_mcp/applications/falai/README.md +5 -7
  30. universal_mcp/applications/falai/app.py +156 -232
  31. universal_mcp/applications/figma/app.py +91 -175
  32. universal_mcp/applications/file_system/app.py +2 -13
  33. universal_mcp/applications/firecrawl/app.py +198 -176
  34. universal_mcp/applications/fireflies/app.py +59 -281
  35. universal_mcp/applications/fpl/app.py +92 -529
  36. universal_mcp/applications/fpl/utils/fixtures.py +15 -49
  37. universal_mcp/applications/fpl/utils/helper.py +25 -89
  38. universal_mcp/applications/fpl/utils/league_utils.py +20 -64
  39. universal_mcp/applications/ghost_content/app.py +70 -179
  40. universal_mcp/applications/github/app.py +30 -67
  41. universal_mcp/applications/gong/app.py +142 -302
  42. universal_mcp/applications/google_calendar/app.py +26 -78
  43. universal_mcp/applications/google_docs/README.md +15 -14
  44. universal_mcp/applications/google_docs/app.py +103 -206
  45. universal_mcp/applications/google_drive/app.py +194 -793
  46. universal_mcp/applications/google_gemini/app.py +68 -59
  47. universal_mcp/applications/google_mail/README.md +1 -0
  48. universal_mcp/applications/google_mail/app.py +93 -214
  49. universal_mcp/applications/google_searchconsole/app.py +25 -58
  50. universal_mcp/applications/google_sheet/README.md +2 -1
  51. universal_mcp/applications/google_sheet/app.py +226 -624
  52. universal_mcp/applications/google_sheet/helper.py +26 -53
  53. universal_mcp/applications/hashnode/app.py +57 -269
  54. universal_mcp/applications/heygen/README.md +10 -32
  55. universal_mcp/applications/heygen/app.py +339 -811
  56. universal_mcp/applications/http_tools/app.py +10 -32
  57. universal_mcp/applications/hubspot/README.md +1 -1
  58. universal_mcp/applications/hubspot/app.py +7508 -99
  59. universal_mcp/applications/jira/app.py +2419 -8334
  60. universal_mcp/applications/klaviyo/app.py +739 -1621
  61. universal_mcp/applications/linkedin/README.md +18 -1
  62. universal_mcp/applications/linkedin/app.py +729 -251
  63. universal_mcp/applications/mailchimp/app.py +696 -1851
  64. universal_mcp/applications/markitdown/app.py +8 -20
  65. universal_mcp/applications/miro/app.py +333 -815
  66. universal_mcp/applications/ms_teams/app.py +420 -1407
  67. universal_mcp/applications/neon/app.py +144 -250
  68. universal_mcp/applications/notion/app.py +38 -53
  69. universal_mcp/applications/onedrive/app.py +26 -48
  70. universal_mcp/applications/openai/app.py +43 -166
  71. universal_mcp/applications/outlook/README.md +22 -9
  72. universal_mcp/applications/outlook/app.py +403 -141
  73. universal_mcp/applications/perplexity/README.md +2 -1
  74. universal_mcp/applications/perplexity/app.py +161 -20
  75. universal_mcp/applications/pipedrive/app.py +1021 -3331
  76. universal_mcp/applications/posthog/app.py +272 -541
  77. universal_mcp/applications/reddit/app.py +65 -164
  78. universal_mcp/applications/resend/app.py +72 -139
  79. universal_mcp/applications/retell/app.py +23 -50
  80. universal_mcp/applications/rocketlane/app.py +252 -965
  81. universal_mcp/applications/scraper/app.py +114 -142
  82. universal_mcp/applications/semanticscholar/app.py +36 -78
  83. universal_mcp/applications/semrush/app.py +44 -78
  84. universal_mcp/applications/sendgrid/app.py +826 -1576
  85. universal_mcp/applications/sentry/app.py +444 -1079
  86. universal_mcp/applications/serpapi/app.py +44 -146
  87. universal_mcp/applications/sharepoint/app.py +27 -49
  88. universal_mcp/applications/shopify/app.py +1748 -4486
  89. universal_mcp/applications/shortcut/app.py +275 -536
  90. universal_mcp/applications/slack/app.py +43 -125
  91. universal_mcp/applications/spotify/app.py +206 -405
  92. universal_mcp/applications/supabase/app.py +174 -283
  93. universal_mcp/applications/tavily/app.py +2 -2
  94. universal_mcp/applications/trello/app.py +853 -2816
  95. universal_mcp/applications/twilio/app.py +27 -62
  96. universal_mcp/applications/twitter/api_segments/compliance_api.py +4 -14
  97. universal_mcp/applications/twitter/api_segments/dm_conversations_api.py +6 -18
  98. universal_mcp/applications/twitter/api_segments/likes_api.py +1 -3
  99. universal_mcp/applications/twitter/api_segments/lists_api.py +5 -15
  100. universal_mcp/applications/twitter/api_segments/trends_api.py +1 -3
  101. universal_mcp/applications/twitter/api_segments/tweets_api.py +9 -31
  102. universal_mcp/applications/twitter/api_segments/usage_api.py +1 -5
  103. universal_mcp/applications/twitter/api_segments/users_api.py +14 -42
  104. universal_mcp/applications/whatsapp/app.py +35 -186
  105. universal_mcp/applications/whatsapp/audio.py +2 -6
  106. universal_mcp/applications/whatsapp/whatsapp.py +17 -51
  107. universal_mcp/applications/whatsapp_business/app.py +86 -299
  108. universal_mcp/applications/wrike/app.py +80 -153
  109. universal_mcp/applications/yahoo_finance/app.py +19 -65
  110. universal_mcp/applications/youtube/app.py +120 -306
  111. universal_mcp/applications/zenquotes/app.py +3 -3
  112. {universal_mcp_applications-0.1.33.dist-info → universal_mcp_applications-0.1.39rc16.dist-info}/METADATA +4 -2
  113. {universal_mcp_applications-0.1.33.dist-info → universal_mcp_applications-0.1.39rc16.dist-info}/RECORD +115 -119
  114. {universal_mcp_applications-0.1.33.dist-info → universal_mcp_applications-0.1.39rc16.dist-info}/WHEEL +1 -1
  115. universal_mcp/applications/hubspot/api_segments/__init__.py +0 -0
  116. universal_mcp/applications/hubspot/api_segments/api_segment_base.py +0 -54
  117. universal_mcp/applications/hubspot/api_segments/crm_api.py +0 -7337
  118. universal_mcp/applications/hubspot/api_segments/marketing_api.py +0 -1467
  119. {universal_mcp_applications-0.1.33.dist-info → universal_mcp_applications-0.1.39rc16.dist-info}/licenses/LICENSE +0 -0
@@ -1,5 +1,4 @@
1
- from typing import Any
2
-
1
+ from typing import Any, Literal
3
2
  from universal_mcp.applications.application import APIApplication
4
3
  from universal_mcp.integrations import Integration
5
4
 
@@ -9,101 +8,63 @@ class MsTeamsApp(APIApplication):
9
8
  super().__init__(name="ms_teams", integration=integration, **kwargs)
10
9
  self.base_url = "https://graph.microsoft.com/v1.0"
11
10
 
12
- def get_user_chats(
11
+ async def get_me(
13
12
  self,
14
- top: int | None = None,
15
- skip: int | None = None,
16
- search: str | None = None,
17
- filter: str | None = None,
18
- count: bool | None = None,
19
- orderby: list[str] | None = None,
20
13
  select: list[str] | None = None,
21
14
  expand: list[str] | None = None,
22
15
  ) -> dict[str, Any]:
23
16
  """
24
- Retrieves a collection of chats the authenticated user is participating in. Supports optional OData query parameters for advanced filtering, sorting, pagination, and field selection, enabling customized data retrieval from the Microsoft Graph API.
17
+ Get the currently signed-in user.
25
18
 
26
19
  Args:
27
- top (integer): Show only the first n items Example: '50'.
28
- skip (integer): Skip the first n items
29
- search (string): Search items by search phrases
30
- filter (string): Filter items by property values
31
- count (boolean): Include count of items
32
- orderby (array): Order items by property values
33
- select (array): Select properties to be returned
34
- expand (array): Expand related entities
20
+ select (array): Select specific properties to return.
21
+ expand (array): Expand related entities.
35
22
 
36
23
  Returns:
37
- dict[str, Any]: Retrieved collection
24
+ dict[str, Any]: The user resource.
38
25
 
39
26
  Raises:
40
- HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
27
+ HTTPStatusError: If the API request fails.
41
28
 
42
29
  Tags:
43
- chats.chat, important
30
+ user, me, read, profile
44
31
  """
45
- url = f"{self.base_url}/chats"
32
+ url = f"{self.base_url}/me"
33
+
34
+ # Helper to format list params
35
+ def fmt(val):
36
+ return ",".join(val) if isinstance(val, list) else val
37
+
46
38
  query_params = {
47
- k: v
39
+ k: fmt(v)
48
40
  for k, v in [
49
- ("$top", top),
50
- ("$skip", skip),
51
- ("$search", search),
52
- ("$filter", filter),
53
- ("$count", count),
54
- ("$orderby", orderby),
55
41
  ("$select", select),
56
42
  ("$expand", expand),
57
43
  ]
58
44
  if v is not None
59
45
  }
60
- response = self._get(url, params=query_params)
61
- return self._handle_response(response)
62
-
63
- def get_joined_teams(self) -> list[dict[str, Any]]:
64
- """
65
- Fetches all Microsoft Teams the authenticated user belongs to by querying the `/me/joinedTeams` Graph API endpoint. It returns a list of dictionaries, where each dictionary represents a single team's details, unlike functions that list channels or chats for a specific team.
66
46
 
67
- Returns:
68
- A list of dictionaries, where each dictionary represents a team.
47
+ response = await self._aget(url, params=query_params)
48
+ return self._handle_response(response)
69
49
 
70
- Raises:
71
- httpx.HTTPStatusError: If the API request fails due to authentication or other issues.
72
50
 
73
- Tags:
74
- read, list, teams, microsoft-teams, api, important
75
- """
76
- url = f"{self.base_url}/me/joinedTeams"
77
- response = self._get(url)
78
- data = self._handle_response(response)
79
- # The API returns the list of teams under the "value" key.
80
- return data.get("value", [])
51
+ # Chat Management
81
52
 
82
- def list_channels_for_team(
53
+ async def get_user_chats(
83
54
  self,
84
- team_id: str,
85
55
  top: int | None = None,
86
- skip: int | None = None,
87
- search: str | None = None,
56
+ expand: list[Literal["members", "lastMessagePreview"]] | None = None,
88
57
  filter: str | None = None,
89
- count: bool | None = None,
90
- orderby: list[str] | None = None,
91
- select: list[str] | None = None,
92
- expand: list[str] | None = None,
58
+ orderby: Literal["lastMessagePreview/createdDateTime desc"] | None = None,
93
59
  ) -> dict[str, Any]:
94
60
  """
95
- Retrieves the collection of channels for a specified Microsoft Teams team by its ID. It supports advanced OData query parameters for filtering, sorting, and pagination, distinguishing it from functions that fetch single channels like `get_channel_details`.
61
+ Retrieves a collection of chats the authenticated user is participating in. Supports optional OData query parameters for advanced filtering, sorting, pagination, and field selection, enabling customized data retrieval from the Microsoft Graph API.
96
62
 
97
63
  Args:
98
- team_id (string): team-id
99
- top (integer): Show only the first n items Example: '50'.
100
- skip (integer): Skip the first n items
101
- search (string): Search items by search phrases
102
- filter (string): Filter items by property values
103
- count (boolean): Include count of items
104
- orderby (array): Order items by property values
105
- select (array): Select properties to be returned
106
- expand (array): Expand related entities
64
+ top (integer): Controls the number of items per response. Maximum allowed $top value is 50.
65
+ expand (array): Currently supports 'members' and 'lastMessagePreview' properties.
66
+ filter (string): Filters results.
67
+ orderby (string): Currently supports 'lastMessagePreview/createdDateTime desc'. Ascending order is currently not supported.
107
68
 
108
69
  Returns:
109
70
  dict[str, Any]: Retrieved collection
@@ -112,198 +73,70 @@ class MsTeamsApp(APIApplication):
112
73
  HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
113
74
 
114
75
  Tags:
115
- teams.channel, important
76
+ chats.chat, important
116
77
  """
117
- if team_id is None:
118
- raise ValueError("Missing required parameter 'team-id'.")
119
- url = f"{self.base_url}/teams/{team_id}/channels"
78
+ url = f"{self.base_url}/chats"
79
+ # Helper to format list params
80
+ def fmt(val):
81
+ return ",".join(val) if isinstance(val, list) else val
82
+
120
83
  query_params = {
121
- k: v
84
+ k: fmt(v)
122
85
  for k, v in [
123
86
  ("$top", top),
124
- ("$skip", skip),
125
- ("$search", search),
87
+ ("$expand", expand),
126
88
  ("$filter", filter),
127
- ("$count", count),
128
89
  ("$orderby", orderby),
129
- ("$select", select),
130
- ("$expand", expand),
131
90
  ]
132
91
  if v is not None
133
92
  }
134
- response = self._get(url, params=query_params)
93
+ response = await self._aget(url, params=query_params)
135
94
  return self._handle_response(response)
136
95
 
137
- def send_chat_message(self, chat_id: str, content: str) -> dict[str, Any]:
138
- """
139
- Posts a new message to a specific Microsoft Teams chat using its unique ID. This function targets direct or group chats, distinguishing it from `send_channel_message`, which posts to public team channels, and `reply_to_chat_message`, which responds to existing messages.
140
-
141
- Args:
142
- chat_id: The unique identifier of the chat.
143
- content: The message content to send (can be plain text or HTML).
144
-
145
- Returns:
146
- A dictionary containing the API response for the sent message, including its ID.
147
-
148
- Raises:
149
- httpx.HTTPStatusError: If the API request fails due to invalid ID, permissions, etc.
150
-
151
- Tags:
152
- create, send, message, chat, microsoft-teams, api, important
153
- """
154
- url = f"{self.base_url}/chats/{chat_id}/messages"
155
- payload = {"body": {"content": content}}
156
- response = self._post(url, data=payload)
157
- return self._handle_response(response)
158
-
159
- def send_channel_message(
160
- self, team_id: str, channel_id: str, content: str
161
- ) -> dict[str, Any]:
162
- """
163
- Posts a new message to a specified team channel, initiating a new conversation thread. Unlike `reply_to_channel_message`, which replies to a message, this function starts a new topic. It's distinct from `send_chat_message`, which is for private or group chats, not team channels.
164
-
165
- Args:
166
- team_id: The unique identifier of the team.
167
- channel_id: The unique identifier of the channel within the team.
168
- content: The message content to send (can be plain text or HTML).
169
-
170
- Returns:
171
- A dictionary containing the API response for the sent message, including its ID.
172
-
173
- Raises:
174
- httpx.HTTPStatusError: If the API request fails due to invalid IDs, permissions, etc.
175
-
176
- Tags:
177
- create, send, message, channel, microsoft-teams, api, important
178
- """
179
- url = f"{self.base_url}/teams/{team_id}/channels/{channel_id}/messages"
180
- payload = {"body": {"content": content}}
181
- response = self._post(url, data=payload)
182
- return self._handle_response(response)
183
-
184
- def reply_to_channel_message(
185
- self, team_id: str, channel_id: str, message_id: str, content: str
186
- ) -> dict[str, Any]:
187
- """
188
- Posts a reply to a specific message within a Microsoft Teams channel. It uses the team, channel, and original message IDs to target an existing conversation thread, distinguishing it from `send_channel_message` which starts a new one.
189
-
190
- Args:
191
- team_id: The unique identifier of the team.
192
- channel_id: The unique identifier of the channel.
193
- message_id: The unique identifier of the message to reply to.
194
- content: The reply message content (can be plain text or HTML).
195
-
196
- Returns:
197
- A dictionary containing the API response for the sent reply, including its ID.
198
-
199
- Raises:
200
- httpx.HTTPStatusError: If the API request fails due to invalid IDs, permissions, etc.
201
-
202
- Tags:
203
- create, send, reply, message, channel, microsoft-teams, api, important
204
- """
205
- url = f"{self.base_url}/teams/{team_id}/channels/{channel_id}/messages/{message_id}/replies"
206
- payload = {"body": {"content": content}}
207
- response = self._post(url, data=payload)
208
- return self._handle_response(response)
209
-
210
- def create_chat(
96
+ async def create_chat(
211
97
  self,
212
- id: str | None = None,
213
- chatType: str | None = None,
214
- createdDateTime: str | None = None,
215
- isHiddenForAllMembers: bool | None = None,
216
- lastUpdatedDateTime: str | None = None,
217
- onlineMeetingInfo: dict[str, dict[str, Any]] | None = None,
218
- tenantId: str | None = None,
98
+ chatType: Literal["oneOnOne", "group"] | str,
99
+ members: list[dict[str, Any]],
219
100
  topic: str | None = None,
220
- viewpoint: dict[str, dict[str, Any]] | None = None,
221
- webUrl: str | None = None,
222
- installedApps: list[Any] | None = None,
223
- lastMessagePreview: Any | None = None,
224
- members: list[Any] | None = None,
225
- messages: list[Any] | None = None,
226
- permissionGrants: list[Any] | None = None,
227
- pinnedMessages: list[Any] | None = None,
228
- tabs: list[Any] | None = None,
229
- ) -> Any:
101
+ ) -> dict[str, Any]:
230
102
  """
231
- Creates a new one-on-one or group chat in Microsoft Teams. This function provisions a new conversation using optional parameters like chatType and members, distinguishing it from functions that create teams (`create_team`) or send messages to existing chats (`send_chat_message`).
103
+ Creates a new one-on-one or group chat in Microsoft Teams. This function provisions a new conversation using required parameters like chatType and members.
232
104
 
233
105
  Args:
234
- id (string): The unique identifier for an entity. Read-only.
235
- chatType (string): chatType
236
- createdDateTime (string): Date and time at which the chat was created. Read-only.
237
- isHiddenForAllMembers (boolean): Indicates whether the chat is hidden for all its members. Read-only.
238
- lastUpdatedDateTime (string): Date and time at which the chat was renamed or the list of members was last changed. Read-only.
239
- onlineMeetingInfo (object): onlineMeetingInfo
240
- tenantId (string): The identifier of the tenant in which the chat was created. Read-only.
106
+ chatType (string): The type of chat. Possible values are: oneOnOne, group.
107
+ members (array): A collection of member dictionaries. For oneOnOne chats, typically 2 users. For group chats, multiple users. Each member should specify roles and user binding (e.g. `{'@odata.type': '#microsoft.graph.aadUserConversationMember', 'roles': ['owner'], 'user@odata.bind': 'https://graph.microsoft.com/v1.0/users(\\'<user-id>\\')'}`).
241
108
  topic (string): (Optional) Subject or topic for the chat. Only available for group chats.
242
- viewpoint (object): viewpoint
243
- webUrl (string): The URL for the chat in Microsoft Teams. The URL should be treated as an opaque blob, and not parsed. Read-only.
244
- installedApps (array): A collection of all the apps in the chat. Nullable.
245
- lastMessagePreview (string): lastMessagePreview
246
- members (array): A collection of all the members in the chat. Nullable.
247
- messages (array): A collection of all the messages in the chat. Nullable.
248
- permissionGrants (array): A collection of permissions granted to apps for the chat.
249
- pinnedMessages (array): A collection of all the pinned messages in the chat. Nullable.
250
- tabs (array): A collection of all the tabs in the chat. Nullable.
251
109
 
252
110
  Returns:
253
- Any: Created entity
111
+ dict[str, Any]: The newly created chat entity.
254
112
 
255
113
  Raises:
256
114
  HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
257
115
 
258
116
  Tags:
259
- chats.chat
117
+ chats.chat, create
260
118
  """
261
- request_body_data = None
262
119
  request_body_data = {
263
- "id": id,
264
120
  "chatType": chatType,
265
- "createdDateTime": createdDateTime,
266
- "isHiddenForAllMembers": isHiddenForAllMembers,
267
- "lastUpdatedDateTime": lastUpdatedDateTime,
268
- "onlineMeetingInfo": onlineMeetingInfo,
269
- "tenantId": tenantId,
270
- "topic": topic,
271
- "viewpoint": viewpoint,
272
- "webUrl": webUrl,
273
- "installedApps": installedApps,
274
- "lastMessagePreview": lastMessagePreview,
275
121
  "members": members,
276
- "messages": messages,
277
- "permissionGrants": permissionGrants,
278
- "pinnedMessages": pinnedMessages,
279
- "tabs": tabs,
280
- }
281
- request_body_data = {
282
- k: v for k, v in request_body_data.items() if v is not None
122
+ "topic": topic,
283
123
  }
124
+ # Filter explicitly None values, though for required ones they should be validated by type hints/caller
125
+ request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
126
+
284
127
  url = f"{self.base_url}/chats"
285
- query_params = {}
286
- response = self._post(
287
- url,
288
- data=request_body_data,
289
- params=query_params,
290
- content_type="application/json",
291
- )
128
+ response = await self._apost(url, data=request_body_data, content_type="application/json")
292
129
  return self._handle_response(response)
293
130
 
294
- def get_chat_details(
131
+ async def get_chat_details(
295
132
  self,
296
133
  chat_id: str,
297
- select: list[str] | None = None,
298
- expand: list[str] | None = None,
299
134
  ) -> Any:
300
135
  """
301
- Retrieves the properties and relationships of a specific chat conversation by its unique ID. Unlike `get_user_chats` which lists all chats, this targets one chat. Optional parameters can select specific fields or expand related entities like members or apps to customize the returned data.
136
+ Retrieves the properties and relationships of a specific chat conversation by its unique ID.
302
137
 
303
138
  Args:
304
- chat_id (string): chat-id
305
- select (array): Select properties to be returned
306
- expand (array): Expand related entities
139
+ chat_id (string): The unique identifier of the chat.
307
140
 
308
141
  Returns:
309
142
  Any: Retrieved entity
@@ -312,1512 +145,692 @@ class MsTeamsApp(APIApplication):
312
145
  HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
313
146
 
314
147
  Tags:
315
- chats.chat
148
+ chats.chat, read
316
149
  """
317
150
  if chat_id is None:
318
151
  raise ValueError("Missing required parameter 'chat-id'.")
319
152
  url = f"{self.base_url}/chats/{chat_id}"
320
- query_params = {
321
- k: v for k, v in [("$select", select), ("$expand", expand)] if v is not None
322
- }
323
- response = self._get(url, params=query_params)
153
+ response = await self._aget(url)
324
154
  return self._handle_response(response)
325
155
 
326
- def update_chat_details(
156
+ async def update_chat_details(
327
157
  self,
328
158
  chat_id: str,
329
- id: str | None = None,
330
- chatType: str | None = None,
331
- createdDateTime: str | None = None,
332
- isHiddenForAllMembers: bool | None = None,
333
- lastUpdatedDateTime: str | None = None,
334
- onlineMeetingInfo: dict[str, dict[str, Any]] | None = None,
335
- tenantId: str | None = None,
336
159
  topic: str | None = None,
337
- viewpoint: dict[str, dict[str, Any]] | None = None,
338
- webUrl: str | None = None,
339
- installedApps: list[Any] | None = None,
340
- lastMessagePreview: Any | None = None,
341
- members: list[Any] | None = None,
342
- messages: list[Any] | None = None,
343
- permissionGrants: list[Any] | None = None,
344
- pinnedMessages: list[Any] | None = None,
345
- tabs: list[Any] | None = None,
346
160
  ) -> Any:
347
161
  """
348
- Updates properties of a specific chat, such as its topic, using its unique ID. This function performs a partial update (PATCH), distinguishing it from `get_chat_details` which only retrieves data, and `create_chat` which creates an entirely new chat conversation.
162
+ Updates properties of a specific chat, such as its topic, using its unique ID. This function performs a partial update (PATCH). Currently, only the 'topic' property can be updated for group chats.
349
163
 
350
164
  Args:
351
- chat_id (string): chat-id
352
- id (string): The unique identifier for an entity. Read-only.
353
- chatType (string): chatType
354
- createdDateTime (string): Date and time at which the chat was created. Read-only.
355
- isHiddenForAllMembers (boolean): Indicates whether the chat is hidden for all its members. Read-only.
356
- lastUpdatedDateTime (string): Date and time at which the chat was renamed or the list of members was last changed. Read-only.
357
- onlineMeetingInfo (object): onlineMeetingInfo
358
- tenantId (string): The identifier of the tenant in which the chat was created. Read-only.
359
- topic (string): (Optional) Subject or topic for the chat. Only available for group chats.
360
- viewpoint (object): viewpoint
361
- webUrl (string): The URL for the chat in Microsoft Teams. The URL should be treated as an opaque blob, and not parsed. Read-only.
362
- installedApps (array): A collection of all the apps in the chat. Nullable.
363
- lastMessagePreview (string): lastMessagePreview
364
- members (array): A collection of all the members in the chat. Nullable.
365
- messages (array): A collection of all the messages in the chat. Nullable.
366
- permissionGrants (array): A collection of permissions granted to apps for the chat.
367
- pinnedMessages (array): A collection of all the pinned messages in the chat. Nullable.
368
- tabs (array): A collection of all the tabs in the chat. Nullable.
165
+ chat_id (string): The unique identifier of the chat.
166
+ topic (string): (Optional) The new subject or topic for the chat. Only applicable for group chats.
369
167
 
370
168
  Returns:
371
- Any: Success
169
+ Any: Variable response depending on the API, typically the updated entity or status.
372
170
 
373
171
  Raises:
374
172
  HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
375
173
 
376
174
  Tags:
377
- chats.chat
175
+ chats.chat, update
378
176
  """
379
177
  if chat_id is None:
380
178
  raise ValueError("Missing required parameter 'chat-id'.")
381
- request_body_data = None
382
- request_body_data = {
383
- "id": id,
384
- "chatType": chatType,
385
- "createdDateTime": createdDateTime,
386
- "isHiddenForAllMembers": isHiddenForAllMembers,
387
- "lastUpdatedDateTime": lastUpdatedDateTime,
388
- "onlineMeetingInfo": onlineMeetingInfo,
389
- "tenantId": tenantId,
390
- "topic": topic,
391
- "viewpoint": viewpoint,
392
- "webUrl": webUrl,
393
- "installedApps": installedApps,
394
- "lastMessagePreview": lastMessagePreview,
395
- "members": members,
396
- "messages": messages,
397
- "permissionGrants": permissionGrants,
398
- "pinnedMessages": pinnedMessages,
399
- "tabs": tabs,
400
- }
401
- request_body_data = {
402
- k: v for k, v in request_body_data.items() if v is not None
403
- }
404
- url = f"{self.base_url}/chats/{chat_id}"
405
- query_params = {}
406
- response = self._patch(url, data=request_body_data, params=query_params)
407
- return self._handle_response(response)
408
-
409
- def list_installed_chat_apps(
410
- self,
411
- chat_id: str,
412
- top: int | None = None,
413
- skip: int | None = None,
414
- search: str | None = None,
415
- filter: str | None = None,
416
- count: bool | None = None,
417
- orderby: list[str] | None = None,
418
- select: list[str] | None = None,
419
- expand: list[str] | None = None,
420
- ) -> dict[str, Any]:
421
- """
422
- Retrieves applications installed in a specific chat, identified by `chat_id`. Differentiating from `list_user_installed_apps`, which targets a user's personal scope, this function queries a single conversation. It supports optional parameters for advanced filtering, sorting, and pagination to customize the returned collection.
423
-
424
- Args:
425
- chat_id (string): chat-id
426
- top (integer): Show only the first n items Example: '50'.
427
- skip (integer): Skip the first n items
428
- search (string): Search items by search phrases
429
- filter (string): Filter items by property values
430
- count (boolean): Include count of items
431
- orderby (array): Order items by property values
432
- select (array): Select properties to be returned
433
- expand (array): Expand related entities
434
-
435
- Returns:
436
- dict[str, Any]: Retrieved collection
437
-
438
- Raises:
439
- HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
440
-
441
- Tags:
442
- chats.teamsAppInstallation
443
- """
444
- if chat_id is None:
445
- raise ValueError("Missing required parameter 'chat-id'.")
446
- url = f"{self.base_url}/chats/{chat_id}/installedApps"
447
- query_params = {
448
- k: v
449
- for k, v in [
450
- ("$top", top),
451
- ("$skip", skip),
452
- ("$search", search),
453
- ("$filter", filter),
454
- ("$count", count),
455
- ("$orderby", orderby),
456
- ("$select", select),
457
- ("$expand", expand),
458
- ]
459
- if v is not None
460
- }
461
- response = self._get(url, params=query_params)
462
- return self._handle_response(response)
179
+
180
+ request_body_data = {"topic": topic}
181
+ # Filter explicitly None values
182
+ request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
183
+
184
+ if not request_body_data:
185
+ raise ValueError("No updateable parameters provided.")
463
186
 
464
- def list_chat_members(
465
- self,
466
- chat_id: str,
467
- top: int | None = None,
468
- skip: int | None = None,
469
- search: str | None = None,
470
- filter: str | None = None,
471
- count: bool | None = None,
472
- orderby: list[str] | None = None,
473
- select: list[str] | None = None,
474
- expand: list[str] | None = None,
475
- ) -> dict[str, Any]:
476
- """
477
- Retrieves a collection of all members in a specific chat using its ID. It supports OData query parameters for pagination, filtering, and sorting. Unlike `get_chat_member`, which fetches a single individual, this function returns the entire collection of members for the specified chat.
478
-
479
- Args:
480
- chat_id (string): chat-id
481
- top (integer): Show only the first n items Example: '50'.
482
- skip (integer): Skip the first n items
483
- search (string): Search items by search phrases
484
- filter (string): Filter items by property values
485
- count (boolean): Include count of items
486
- orderby (array): Order items by property values
487
- select (array): Select properties to be returned
488
- expand (array): Expand related entities
489
-
490
- Returns:
491
- dict[str, Any]: Retrieved collection
492
-
493
- Raises:
494
- HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
495
-
496
- Tags:
497
- chats.conversationMember
498
- """
499
- if chat_id is None:
500
- raise ValueError("Missing required parameter 'chat-id'.")
501
- url = f"{self.base_url}/chats/{chat_id}/members"
502
- query_params = {
503
- k: v
504
- for k, v in [
505
- ("$top", top),
506
- ("$skip", skip),
507
- ("$search", search),
508
- ("$filter", filter),
509
- ("$count", count),
510
- ("$orderby", orderby),
511
- ("$select", select),
512
- ("$expand", expand),
513
- ]
514
- if v is not None
515
- }
516
- response = self._get(url, params=query_params)
187
+ url = f"{self.base_url}/chats/{chat_id}"
188
+ response = await self._apatch(url, data=request_body_data, content_type="application/json")
517
189
  return self._handle_response(response)
518
190
 
519
- def add_member_to_chat(
191
+ async def list_chat_members(
520
192
  self,
521
193
  chat_id: str,
522
- id: str | None = None,
523
- displayName: str | None = None,
524
- roles: list[str] | None = None,
525
- visibleHistoryStartDateTime: str | None = None,
526
- ) -> Any:
194
+ ) -> list[dict[str, Any]]:
527
195
  """
528
- Adds a new member to a specific Microsoft Teams chat using its `chat_id`. This function allows for configuring member roles and chat history visibility. It is the direct counterpart to `delete_chat_member`, performing the 'create' action for a chat's membership.
196
+ Retrieves a collection of all members in a specific chat using its ID.
197
+ Note: The Microsoft Graph API for getting chat members does NOT support OData query parameters like $top, $filter, etc.
529
198
 
530
199
  Args:
531
- chat_id (string): chat-id
532
- id (string): The unique identifier for an entity. Read-only.
533
- displayName (string): The display name of the user.
534
- roles (array): The roles for that user. This property contains more qualifiers only when relevant - for example, if the member has owner privileges, the roles property contains owner as one of the values. Similarly, if the member is an in-tenant guest, the roles property contains guest as one of the values. A basic member shouldn't have any values specified in the roles property. An Out-of-tenant external member is assigned the owner role.
535
- visibleHistoryStartDateTime (string): The timestamp denoting how far back a conversation's history is shared with the conversation member. This property is settable only for members of a chat.
200
+ chat_id (string): The unique identifier of the chat.
536
201
 
537
202
  Returns:
538
- Any: Created navigation property.
203
+ list[dict[str, Any]]: A list of conversationMember objects.
539
204
 
540
205
  Raises:
541
206
  HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
542
207
 
543
208
  Tags:
544
- chats.conversationMember
209
+ chats.conversationMember, list, read
545
210
  """
546
211
  if chat_id is None:
547
212
  raise ValueError("Missing required parameter 'chat-id'.")
548
- request_body_data = None
549
- request_body_data = {
550
- "id": id,
551
- "displayName": displayName,
552
- "roles": roles,
553
- "visibleHistoryStartDateTime": visibleHistoryStartDateTime,
554
- }
555
- request_body_data = {
556
- k: v for k, v in request_body_data.items() if v is not None
557
- }
558
213
  url = f"{self.base_url}/chats/{chat_id}/members"
559
- query_params = {}
560
- response = self._post(
561
- url,
562
- data=request_body_data,
563
- params=query_params,
564
- content_type="application/json",
565
- )
566
- return self._handle_response(response)
214
+
215
+ # This endpoint generally does not support OData params, so we send none.
216
+ response = await self._aget(url)
217
+ data = self._handle_response(response)
218
+ return data.get("value", [])
567
219
 
568
- def get_chat_member(
569
- self,
570
- chat_id: str,
571
- conversationMember_id: str,
572
- select: list[str] | None = None,
573
- expand: list[str] | None = None,
220
+ async def get_chat_member(
221
+ self, chat_id: str, conversationMember_id: str
574
222
  ) -> Any:
575
223
  """
576
- Retrieves detailed information for a specific member within a chat using their unique ID. This function targets a single individual, distinguishing it from `list_chat_members` which returns all members. The response can be customized by selecting specific properties or expanding related entities.
224
+ Retrieves detailed information for a specific member within a chat using their unique ID.
225
+ Note: The Microsoft Graph API for this endpoint does NOT support OData query parameters.
577
226
 
578
227
  Args:
579
- chat_id (string): chat-id
580
- conversationMember_id (string): conversationMember-id
581
- select (array): Select properties to be returned
582
- expand (array): Expand related entities
228
+ chat_id (string): The unique identifier of the chat.
229
+ conversationMember_id (string): The unique identifier of the member.
583
230
 
584
231
  Returns:
585
- Any: Retrieved navigation property
232
+ Any: Retrieved conversationMember entity.
586
233
 
587
234
  Raises:
588
235
  HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
589
236
 
590
237
  Tags:
591
- chats.conversationMember
238
+ chats.conversationMember, read
592
239
  """
593
240
  if chat_id is None:
594
241
  raise ValueError("Missing required parameter 'chat-id'.")
595
242
  if conversationMember_id is None:
596
243
  raise ValueError("Missing required parameter 'conversationMember-id'.")
597
244
  url = f"{self.base_url}/chats/{chat_id}/members/{conversationMember_id}"
598
- query_params = {
599
- k: v for k, v in [("$select", select), ("$expand", expand)] if v is not None
600
- }
601
- response = self._get(url, params=query_params)
245
+
246
+ # This endpoint generally does not support OData params
247
+ response = await self._aget(url)
602
248
  return self._handle_response(response)
603
249
 
604
- def delete_chat_member(self, chat_id: str, conversationMember_id: str) -> Any:
605
- """
606
- Removes a specific member from a chat using their unique ID and the chat's ID. This function sends a DELETE request to the Microsoft Graph API to permanently remove the user from the conversation, acting as the counterpart to `add_member_to_chat`.
607
-
608
- Args:
609
- chat_id (string): chat-id
610
- conversationMember_id (string): conversationMember-id
611
-
612
- Returns:
613
- Any: Success
250
+ # Chat Messages
614
251
 
615
- Raises:
616
- HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
617
-
618
- Tags:
619
- chats.conversationMember
620
- """
621
- if chat_id is None:
622
- raise ValueError("Missing required parameter 'chat-id'.")
623
- if conversationMember_id is None:
624
- raise ValueError("Missing required parameter 'conversationMember-id'.")
625
- url = f"{self.base_url}/chats/{chat_id}/members/{conversationMember_id}"
626
- query_params = {}
627
- response = self._delete(url, params=query_params)
628
- return self._handle_response(response)
629
-
630
- def list_chat_messages(
252
+ async def list_chat_messages(
631
253
  self,
632
254
  chat_id: str,
633
255
  top: int | None = None,
634
- skip: int | None = None,
635
- search: str | None = None,
256
+ orderby: list[Literal["lastModifiedDateTime desc", "createdDateTime desc"]] | None = None,
636
257
  filter: str | None = None,
637
- count: bool | None = None,
638
- orderby: list[str] | None = None,
639
- select: list[str] | None = None,
640
- expand: list[str] | None = None,
641
258
  ) -> dict[str, Any]:
642
259
  """
643
- Retrieves messages from a specific chat using its ID. Unlike `get_chat_message`, which fetches a single message, this function returns a collection and supports advanced querying for filtering, sorting, and pagination to refine the results.
260
+ Retrieves messages from a specific chat using its ID.
261
+
262
+ Supported OData parameters with strict limitations:
263
+ - $top: Controls the number of items per response. Maximum allowed value is 50.
264
+ - $orderby: Currently supports 'lastModifiedDateTime desc' (default) and 'createdDateTime desc'. Ascending order is NOT supported.
265
+ - $filter: Sets the date range filter for 'lastModifiedDateTime' (supports gt/lt) and 'createdDateTime' (supports lt).
266
+ Note: You can only filter results if 'orderby' is configured for the same property!
644
267
 
645
268
  Args:
646
- chat_id (string): chat-id
647
- top (integer): Show only the first n items Example: '50'.
648
- skip (integer): Skip the first n items
649
- search (string): Search items by search phrases
650
- filter (string): Filter items by property values
651
- count (boolean): Include count of items
652
- orderby (array): Order items by property values
653
- select (array): Select properties to be returned
654
- expand (array): Expand related entities
269
+ chat_id (string): The unique identifier of the chat.
270
+ top (integer): Show only the first n items. Max 50.
271
+ orderby (array): Order items by property values. Restrict to supported descending sorts.
272
+ filter (string): Filter items by property values. Must match orderby property.
655
273
 
656
274
  Returns:
657
- dict[str, Any]: Retrieved collection
275
+ dict[str, Any]: Retrieved collection of messages.
658
276
 
659
277
  Raises:
660
278
  HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
661
279
 
662
280
  Tags:
663
- chats.chatMessage
281
+ chats.chatMessage, list, read
664
282
  """
665
283
  if chat_id is None:
666
284
  raise ValueError("Missing required parameter 'chat-id'.")
667
285
  url = f"{self.base_url}/chats/{chat_id}/messages"
286
+ # Helper to format list params
287
+ def fmt(val):
288
+ return ",".join(val) if isinstance(val, list) else val
289
+
668
290
  query_params = {
669
- k: v
291
+ k: fmt(v)
670
292
  for k, v in [
671
293
  ("$top", top),
672
- ("$skip", skip),
673
- ("$search", search),
674
- ("$filter", filter),
675
- ("$count", count),
676
294
  ("$orderby", orderby),
677
- ("$select", select),
678
- ("$expand", expand),
295
+ ("$filter", filter),
679
296
  ]
680
297
  if v is not None
681
298
  }
682
- response = self._get(url, params=query_params)
299
+ response = await self._aget(url, params=query_params)
683
300
  return self._handle_response(response)
684
301
 
685
- def get_chat_message(
686
- self,
687
- chat_id: str,
688
- chatMessage_id: str,
689
- select: list[str] | None = None,
690
- expand: list[str] | None = None,
302
+ async def get_chat_message(
303
+ self, chat_id: str, chatMessage_id: str
691
304
  ) -> Any:
692
305
  """
693
- Retrieves the full details of a single message from a specific chat using both chat and message IDs. This function targets an individual message, differentiating it from `list_chat_messages`, which retrieves a collection. Optional parameters can customize the response by selecting specific properties or expanding entities.
306
+ Retrieves the full details of a single message from a specific chat using both chat and message IDs.
307
+ Note: The Microsoft Graph API for this endpoint does NOT support OData query parameters like $select or $expand.
694
308
 
695
309
  Args:
696
- chat_id (string): chat-id
697
- chatMessage_id (string): chatMessage-id
698
- select (array): Select properties to be returned
699
- expand (array): Expand related entities
310
+ chat_id (string): The unique identifier of the chat.
311
+ chatMessage_id (string): The unique identifier of the message.
700
312
 
701
313
  Returns:
702
- Any: Retrieved navigation property
314
+ Any: Retrieved chatMessage entity.
703
315
 
704
316
  Raises:
705
317
  HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
706
318
 
707
319
  Tags:
708
- chats.chatMessage
320
+ chats.chatMessage, read
709
321
  """
710
322
  if chat_id is None:
711
323
  raise ValueError("Missing required parameter 'chat-id'.")
712
324
  if chatMessage_id is None:
713
325
  raise ValueError("Missing required parameter 'chatMessage-id'.")
714
326
  url = f"{self.base_url}/chats/{chat_id}/messages/{chatMessage_id}"
715
- query_params = {
716
- k: v for k, v in [("$select", select), ("$expand", expand)] if v is not None
717
- }
718
- response = self._get(url, params=query_params)
327
+
328
+ # This endpoint explicitly does not support OData params
329
+ response = await self._aget(url)
719
330
  return self._handle_response(response)
720
331
 
721
- def list_chat_message_replies(
722
- self,
723
- chat_id: str,
724
- chatMessage_id: str,
725
- top: int | None = None,
726
- skip: int | None = None,
727
- search: str | None = None,
728
- filter: str | None = None,
729
- count: bool | None = None,
730
- orderby: list[str] | None = None,
731
- select: list[str] | None = None,
732
- expand: list[str] | None = None,
733
- ) -> dict[str, Any]:
332
+ async def send_chat_message(self, chat_id: str, content: str) -> dict[str, Any]:
734
333
  """
735
- Retrieves all replies for a specific message within a chat, using the parent message's ID. This function, unlike `get_chat_reply_details`, returns a collection and supports OData query parameters for advanced filtering, sorting, and pagination of the results.
736
-
334
+ Posts a new message to a specific Microsoft Teams chat using its unique ID.
335
+
737
336
  Args:
738
- chat_id (string): chat-id
739
- chatMessage_id (string): chatMessage-id
740
- top (integer): Show only the first n items Example: '50'.
741
- skip (integer): Skip the first n items
742
- search (string): Search items by search phrases
743
- filter (string): Filter items by property values
744
- count (boolean): Include count of items
745
- orderby (array): Order items by property values
746
- select (array): Select properties to be returned
747
- expand (array): Expand related entities
337
+ chat_id (string): The unique identifier of the chat.
338
+ content (string): The message content to send (plain text or HTML).
748
339
 
749
340
  Returns:
750
- dict[str, Any]: Retrieved collection
341
+ dict[str, Any]: A dictionary containing the API response for the sent message, including its ID.
751
342
 
752
343
  Raises:
753
- HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
344
+ HTTPStatusError: If the API request fails due to invalid ID, permissions, etc.
754
345
 
755
346
  Tags:
756
- chats.chatMessage
347
+ chats.chatMessage, create, send, important
757
348
  """
758
349
  if chat_id is None:
759
350
  raise ValueError("Missing required parameter 'chat-id'.")
760
- if chatMessage_id is None:
761
- raise ValueError("Missing required parameter 'chatMessage-id'.")
762
- url = f"{self.base_url}/chats/{chat_id}/messages/{chatMessage_id}/replies"
763
- query_params = {
764
- k: v
765
- for k, v in [
766
- ("$top", top),
767
- ("$skip", skip),
768
- ("$search", search),
769
- ("$filter", filter),
770
- ("$count", count),
771
- ("$orderby", orderby),
772
- ("$select", select),
773
- ("$expand", expand),
774
- ]
775
- if v is not None
776
- }
777
- response = self._get(url, params=query_params)
351
+
352
+ url = f"{self.base_url}/chats/{chat_id}/messages"
353
+ payload = {"body": {"content": content}}
354
+
355
+ response = await self._apost(url, data=payload)
778
356
  return self._handle_response(response)
779
357
 
780
- def reply_to_chat_message(
781
- self,
782
- chat_id: str,
783
- chatMessage_id: str,
784
- id: str | None = None,
785
- attachments: list[dict[str, dict[str, Any]]] | None = None,
786
- body: dict[str, dict[str, Any]] | None = None,
787
- channelIdentity: dict[str, dict[str, Any]] | None = None,
788
- chatId: str | None = None,
789
- createdDateTime: str | None = None,
790
- deletedDateTime: str | None = None,
791
- etag: str | None = None,
792
- eventDetail: dict[str, dict[str, Any]] | None = None,
793
- from_: Any | None = None,
794
- importance: str | None = None,
795
- lastEditedDateTime: str | None = None,
796
- lastModifiedDateTime: str | None = None,
797
- locale: str | None = None,
798
- mentions: list[dict[str, dict[str, Any]]] | None = None,
799
- messageHistory: list[dict[str, dict[str, Any]]] | None = None,
800
- messageType: str | None = None,
801
- policyViolation: dict[str, dict[str, Any]] | None = None,
802
- reactions: list[dict[str, dict[str, Any]]] | None = None,
803
- replyToId: str | None = None,
804
- subject: str | None = None,
805
- summary: str | None = None,
806
- webUrl: str | None = None,
807
- hostedContents: list[Any] | None = None,
808
- replies: list[Any] | None = None,
809
- ) -> Any:
810
- """
811
- Posts a reply to a specific message within a chat. This comprehensive function allows for detailed configuration of the reply's properties, like its body and attachments. It differs from `reply_to_channel_message`, which sends simpler replies to messages within team channels.
812
-
813
- Args:
814
- chat_id (string): chat-id
815
- chatMessage_id (string): chatMessage-id
816
- id (string): The unique identifier for an entity. Read-only.
817
- attachments (array): References to attached objects like files, tabs, meetings etc.
818
- body (object): body
819
- channelIdentity (object): channelIdentity
820
- chatId (string): If the message was sent in a chat, represents the identity of the chat.
821
- createdDateTime (string): Timestamp of when the chat message was created.
822
- deletedDateTime (string): Read only. Timestamp at which the chat message was deleted, or null if not deleted.
823
- etag (string): Read-only. Version number of the chat message.
824
- eventDetail (object): eventDetail
825
- from_ (string): from
826
- importance (string): importance
827
- lastEditedDateTime (string): Read only. Timestamp when edits to the chat message were made. Triggers an 'Edited' flag in the Teams UI. If no edits are made the value is null.
828
- lastModifiedDateTime (string): Read only. Timestamp when the chat message is created (initial setting) or modified, including when a reaction is added or removed.
829
- locale (string): Locale of the chat message set by the client. Always set to en-us.
830
- mentions (array): List of entities mentioned in the chat message. Supported entities are: user, bot, team, channel, chat, and tag.
831
- messageHistory (array): List of activity history of a message item, including modification time and actions, such as reactionAdded, reactionRemoved, or reaction changes, on the message.
832
- messageType (string): messageType
833
- policyViolation (object): policyViolation
834
- reactions (array): Reactions for this chat message (for example, Like).
835
- replyToId (string): Read-only. ID of the parent chat message or root chat message of the thread. (Only applies to chat messages in channels, not chats.)
836
- subject (string): The subject of the chat message, in plaintext.
837
- summary (string): Summary text of the chat message that could be used for push notifications and summary views or fall back views. Only applies to channel chat messages, not chat messages in a chat.
838
- webUrl (string): Read-only. Link to the message in Microsoft Teams.
839
- hostedContents (array): Content in a message hosted by Microsoft Teams - for example, images or code snippets.
840
- replies (array): Replies for a specified message. Supports $expand for channel messages.
841
-
842
- Returns:
843
- Any: Created navigation property.
844
-
845
- Raises:
846
- HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
358
+ # Channels
847
359
 
848
- Tags:
849
- chats.chatMessage
850
- """
851
- if chat_id is None:
852
- raise ValueError("Missing required parameter 'chat-id'.")
853
- if chatMessage_id is None:
854
- raise ValueError("Missing required parameter 'chatMessage-id'.")
855
- request_body_data = None
856
- request_body_data = {
857
- "id": id,
858
- "attachments": attachments,
859
- "body": body,
860
- "channelIdentity": channelIdentity,
861
- "chatId": chatId,
862
- "createdDateTime": createdDateTime,
863
- "deletedDateTime": deletedDateTime,
864
- "etag": etag,
865
- "eventDetail": eventDetail,
866
- "from": from_,
867
- "importance": importance,
868
- "lastEditedDateTime": lastEditedDateTime,
869
- "lastModifiedDateTime": lastModifiedDateTime,
870
- "locale": locale,
871
- "mentions": mentions,
872
- "messageHistory": messageHistory,
873
- "messageType": messageType,
874
- "policyViolation": policyViolation,
875
- "reactions": reactions,
876
- "replyToId": replyToId,
877
- "subject": subject,
878
- "summary": summary,
879
- "webUrl": webUrl,
880
- "hostedContents": hostedContents,
881
- "replies": replies,
882
- }
883
- request_body_data = {
884
- k: v for k, v in request_body_data.items() if v is not None
885
- }
886
- url = f"{self.base_url}/chats/{chat_id}/messages/{chatMessage_id}/replies"
887
- query_params = {}
888
- response = self._post(
889
- url,
890
- data=request_body_data,
891
- params=query_params,
892
- content_type="application/json",
893
- )
894
- return self._handle_response(response)
895
-
896
- def get_chat_reply_details(
360
+ async def list_all_channels(
897
361
  self,
898
- chat_id: str,
899
- chatMessage_id: str,
900
- chatMessage_id1: str,
362
+ team_id: str,
363
+ filter: str | None = None,
901
364
  select: list[str] | None = None,
902
365
  expand: list[str] | None = None,
903
- ) -> Any:
366
+ ) -> dict[str, Any]:
904
367
  """
905
- Retrieves a specific reply from a chat message thread using the chat, parent message, and reply IDs. Unlike `list_chat_message_replies`, which fetches all replies, this function targets a single reply for detailed information, allowing for customized field selection.
368
+ Retrieves the list of channels either in this team or shared with this team (incoming channels).
369
+ Supported OData parameters:
370
+ - $filter: Filter by property values.
371
+ - $select: Select specific properties to return (recommended for performance).
372
+ - $expand: Expand related entities.
906
373
 
907
374
  Args:
908
- chat_id (string): chat-id
909
- chatMessage_id (string): chatMessage-id
910
- chatMessage_id1 (string): chatMessage-id1
911
- select (array): Select properties to be returned
912
- expand (array): Expand related entities
375
+ team_id (string): The unique identifier of the team.
376
+ filter (string): Filter items by property values.
377
+ select (array): Select properties to be returned.
378
+ expand (array): Expand related entities.
913
379
 
914
380
  Returns:
915
- Any: Retrieved navigation property
381
+ dict[str, Any]: Retrieved collection of channels.
916
382
 
917
383
  Raises:
918
- HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
384
+ HTTPStatusError: If the API request fails.
919
385
 
920
386
  Tags:
921
- chats.chatMessage
387
+ teams.channel, list, read
922
388
  """
923
- if chat_id is None:
924
- raise ValueError("Missing required parameter 'chat-id'.")
925
- if chatMessage_id is None:
926
- raise ValueError("Missing required parameter 'chatMessage-id'.")
927
- if chatMessage_id1 is None:
928
- raise ValueError("Missing required parameter 'chatMessage-id1'.")
929
- url = f"{self.base_url}/chats/{chat_id}/messages/{chatMessage_id}/replies/{chatMessage_id1}"
389
+ if team_id is None:
390
+ raise ValueError("Missing required parameter 'team-id'.")
391
+
392
+ url = f"{self.base_url}/teams/{team_id}/allChannels"
393
+
394
+ # Helper to format list params
395
+ def fmt(val):
396
+ return ",".join(val) if isinstance(val, list) else val
397
+
930
398
  query_params = {
931
- k: v for k, v in [("$select", select), ("$expand", expand)] if v is not None
399
+ k: fmt(v)
400
+ for k, v in [
401
+ ("$filter", filter),
402
+ ("$select", select),
403
+ ("$expand", expand),
404
+ ]
405
+ if v is not None
932
406
  }
933
- response = self._get(url, params=query_params)
407
+
408
+ response = await self._aget(url, params=query_params)
934
409
  return self._handle_response(response)
935
410
 
936
- def create_team_from_group(
411
+ async def get_channel(
937
412
  self,
938
- group_id: str,
939
- id: str | None = None,
940
- classification: str | None = None,
941
- createdDateTime: str | None = None,
942
- description: str | None = None,
943
- displayName: str | None = None,
944
- firstChannelName: str | None = None,
945
- funSettings: dict[str, dict[str, Any]] | None = None,
946
- guestSettings: dict[str, dict[str, Any]] | None = None,
947
- internalId: str | None = None,
948
- isArchived: bool | None = None,
949
- memberSettings: dict[str, dict[str, Any]] | None = None,
950
- messagingSettings: dict[str, dict[str, Any]] | None = None,
951
- specialization: str | None = None,
952
- summary: dict[str, dict[str, Any]] | None = None,
953
- tenantId: str | None = None,
954
- visibility: str | None = None,
955
- webUrl: str | None = None,
956
- allChannels: list[Any] | None = None,
957
- channels: list[Any] | None = None,
958
- group: Any | None = None,
959
- incomingChannels: list[Any] | None = None,
960
- installedApps: list[Any] | None = None,
961
- members: list[Any] | None = None,
962
- operations: list[Any] | None = None,
963
- permissionGrants: list[Any] | None = None,
964
- photo: Any | None = None,
965
- primaryChannel: Any | None = None,
966
- schedule: Any | None = None,
967
- tags: list[Any] | None = None,
968
- template: Any | None = None,
969
- ) -> Any:
413
+ team_id: str,
414
+ channel_id: str,
415
+ select: list[str] | None = None,
416
+ expand: list[str] | None = None,
417
+ ) -> dict[str, Any]:
970
418
  """
971
- Enables Microsoft Teams functionality for a pre-existing Microsoft 365 group using its ID. This 'team-ifies' the group, allowing optional configuration of team properties. It differs from `create_team`, which provisions both a new team and its associated group simultaneously.
419
+ Retrieve the properties and relationships of a channel.
420
+ Supported OData parameters:
421
+ - $select: Select specific properties to return (recommended for performance).
422
+ - $expand: Expand related entities.
972
423
 
973
424
  Args:
974
- group_id (string): group-id
975
- id (string): The unique identifier for an entity. Read-only.
976
- classification (string): An optional label. Typically describes the data or business sensitivity of the team. Must match one of a preconfigured set in the tenant's directory.
977
- createdDateTime (string): Timestamp at which the team was created.
978
- description (string): An optional description for the team. Maximum length: 1,024 characters.
979
- displayName (string): The name of the team.
980
- firstChannelName (string): The name of the first channel in the team. This is an optional property, only used during team creation and isn't returned in methods to get and list teams.
981
- funSettings (object): funSettings
982
- guestSettings (object): guestSettings
983
- internalId (string): A unique ID for the team that was used in a few places such as the audit log/Office 365 Management Activity API.
984
- isArchived (boolean): Whether this team is in read-only mode.
985
- memberSettings (object): memberSettings
986
- messagingSettings (object): messagingSettings
987
- specialization (string): specialization
988
- summary (object): summary
989
- tenantId (string): The ID of the Microsoft Entra tenant.
990
- visibility (string): visibility
991
- webUrl (string): A hyperlink that goes to the team in the Microsoft Teams client. You get this URL when you right-click a team in the Microsoft Teams client and select Get link to team. This URL should be treated as an opaque blob, and not parsed.
992
- allChannels (array): List of channels either hosted in or shared with the team (incoming channels).
993
- channels (array): The collection of channels and messages associated with the team.
994
- group (string): group
995
- incomingChannels (array): List of channels shared with the team.
996
- installedApps (array): The apps installed in this team.
997
- members (array): Members and owners of the team.
998
- operations (array): The async operations that ran or are running on this team.
999
- permissionGrants (array): A collection of permissions granted to apps to access the team.
1000
- photo (string): photo
1001
- primaryChannel (string): primaryChannel
1002
- schedule (string): schedule
1003
- tags (array): The tags associated with the team.
1004
- template (string): template
425
+ team_id (string): The unique identifier of the team.
426
+ channel_id (string): The unique identifier of the channel.
427
+ select (array): Select properties to be returned.
428
+ expand (array): Expand related entities.
1005
429
 
1006
430
  Returns:
1007
- Any: Success
431
+ dict[str, Any]: Retrieved channel entity.
1008
432
 
1009
433
  Raises:
1010
- HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
434
+ HTTPStatusError: If the API request fails.
1011
435
 
1012
436
  Tags:
1013
- groups.team
437
+ teams.channel, read
1014
438
  """
1015
- if group_id is None:
1016
- raise ValueError("Missing required parameter 'group-id'.")
1017
- request_body_data = None
1018
- request_body_data = {
1019
- "id": id,
1020
- "classification": classification,
1021
- "createdDateTime": createdDateTime,
1022
- "description": description,
1023
- "displayName": displayName,
1024
- "firstChannelName": firstChannelName,
1025
- "funSettings": funSettings,
1026
- "guestSettings": guestSettings,
1027
- "internalId": internalId,
1028
- "isArchived": isArchived,
1029
- "memberSettings": memberSettings,
1030
- "messagingSettings": messagingSettings,
1031
- "specialization": specialization,
1032
- "summary": summary,
1033
- "tenantId": tenantId,
1034
- "visibility": visibility,
1035
- "webUrl": webUrl,
1036
- "allChannels": allChannels,
1037
- "channels": channels,
1038
- "group": group,
1039
- "incomingChannels": incomingChannels,
1040
- "installedApps": installedApps,
1041
- "members": members,
1042
- "operations": operations,
1043
- "permissionGrants": permissionGrants,
1044
- "photo": photo,
1045
- "primaryChannel": primaryChannel,
1046
- "schedule": schedule,
1047
- "tags": tags,
1048
- "template": template,
1049
- }
1050
- request_body_data = {
1051
- k: v for k, v in request_body_data.items() if v is not None
1052
- }
1053
- url = f"{self.base_url}/groups/{group_id}/team"
1054
- query_params = {}
1055
- response = self._put(
1056
- url,
1057
- data=request_body_data,
1058
- params=query_params,
1059
- content_type="application/json",
1060
- )
1061
- return self._handle_response(response)
1062
-
1063
- def create_team(
1064
- self,
1065
- id: str | None = None,
1066
- classification: str | None = None,
1067
- createdDateTime: str | None = None,
1068
- description: str | None = None,
1069
- displayName: str | None = None,
1070
- firstChannelName: str | None = None,
1071
- funSettings: dict[str, dict[str, Any]] | None = None,
1072
- guestSettings: dict[str, dict[str, Any]] | None = None,
1073
- internalId: str | None = None,
1074
- isArchived: bool | None = None,
1075
- memberSettings: dict[str, dict[str, Any]] | None = None,
1076
- messagingSettings: dict[str, dict[str, Any]] | None = None,
1077
- specialization: str | None = None,
1078
- summary: dict[str, dict[str, Any]] | None = None,
1079
- tenantId: str | None = None,
1080
- visibility: str | None = None,
1081
- webUrl: str | None = None,
1082
- allChannels: list[Any] | None = None,
1083
- channels: list[Any] | None = None,
1084
- group: Any | None = None,
1085
- incomingChannels: list[Any] | None = None,
1086
- installedApps: list[Any] | None = None,
1087
- members: list[Any] | None = None,
1088
- operations: list[Any] | None = None,
1089
- permissionGrants: list[Any] | None = None,
1090
- photo: Any | None = None,
1091
- primaryChannel: Any | None = None,
1092
- schedule: Any | None = None,
1093
- tags: list[Any] | None = None,
1094
- template: Any | None = None,
1095
- ) -> Any:
1096
- """
1097
- Creates a new Microsoft Team and its associated Microsoft 365 group. This method builds a team from scratch, allowing specification of initial properties like display name, description, and members. It differs from `create_team_from_group`, which enables team functionality for an existing group.
1098
-
1099
- Args:
1100
- id (string): The unique identifier for an entity. Read-only.
1101
- classification (string): An optional label. Typically describes the data or business sensitivity of the team. Must match one of a preconfigured set in the tenant's directory.
1102
- createdDateTime (string): Timestamp at which the team was created.
1103
- description (string): An optional description for the team. Maximum length: 1,024 characters.
1104
- displayName (string): The name of the team.
1105
- firstChannelName (string): The name of the first channel in the team. This is an optional property, only used during team creation and isn't returned in methods to get and list teams.
1106
- funSettings (object): funSettings
1107
- guestSettings (object): guestSettings
1108
- internalId (string): A unique ID for the team that was used in a few places such as the audit log/Office 365 Management Activity API.
1109
- isArchived (boolean): Whether this team is in read-only mode.
1110
- memberSettings (object): memberSettings
1111
- messagingSettings (object): messagingSettings
1112
- specialization (string): specialization
1113
- summary (object): summary
1114
- tenantId (string): The ID of the Microsoft Entra tenant.
1115
- visibility (string): visibility
1116
- webUrl (string): A hyperlink that goes to the team in the Microsoft Teams client. You get this URL when you right-click a team in the Microsoft Teams client and select Get link to team. This URL should be treated as an opaque blob, and not parsed.
1117
- allChannels (array): List of channels either hosted in or shared with the team (incoming channels).
1118
- channels (array): The collection of channels and messages associated with the team.
1119
- group (string): group
1120
- incomingChannels (array): List of channels shared with the team.
1121
- installedApps (array): The apps installed in this team.
1122
- members (array): Members and owners of the team.
1123
- operations (array): The async operations that ran or are running on this team.
1124
- permissionGrants (array): A collection of permissions granted to apps to access the team.
1125
- photo (string): photo
1126
- primaryChannel (string): primaryChannel
1127
- schedule (string): schedule
1128
- tags (array): The tags associated with the team.
1129
- template (string): template
439
+ if team_id is None:
440
+ raise ValueError("Missing required parameter 'team-id'.")
441
+ if channel_id is None:
442
+ raise ValueError("Missing required parameter 'channel-id'.")
1130
443
 
1131
- Returns:
1132
- Any: Created entity
444
+ url = f"{self.base_url}/teams/{team_id}/channels/{channel_id}"
1133
445
 
1134
- Raises:
1135
- HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
446
+ # Helper to format list params
447
+ def fmt(val):
448
+ return ",".join(val) if isinstance(val, list) else val
1136
449
 
1137
- Tags:
1138
- teams.team
1139
- """
1140
- request_body_data = None
1141
- request_body_data = {
1142
- "id": id,
1143
- "classification": classification,
1144
- "createdDateTime": createdDateTime,
1145
- "description": description,
1146
- "displayName": displayName,
1147
- "firstChannelName": firstChannelName,
1148
- "funSettings": funSettings,
1149
- "guestSettings": guestSettings,
1150
- "internalId": internalId,
1151
- "isArchived": isArchived,
1152
- "memberSettings": memberSettings,
1153
- "messagingSettings": messagingSettings,
1154
- "specialization": specialization,
1155
- "summary": summary,
1156
- "tenantId": tenantId,
1157
- "visibility": visibility,
1158
- "webUrl": webUrl,
1159
- "allChannels": allChannels,
1160
- "channels": channels,
1161
- "group": group,
1162
- "incomingChannels": incomingChannels,
1163
- "installedApps": installedApps,
1164
- "members": members,
1165
- "operations": operations,
1166
- "permissionGrants": permissionGrants,
1167
- "photo": photo,
1168
- "primaryChannel": primaryChannel,
1169
- "schedule": schedule,
1170
- "tags": tags,
1171
- "template": template,
1172
- }
1173
- request_body_data = {
1174
- k: v for k, v in request_body_data.items() if v is not None
450
+ query_params = {
451
+ k: fmt(v)
452
+ for k, v in [
453
+ ("$select", select),
454
+ ("$expand", expand),
455
+ ]
456
+ if v is not None
1175
457
  }
1176
- url = f"{self.base_url}/teams"
1177
- query_params = {}
1178
- response = self._post(
1179
- url,
1180
- data=request_body_data,
1181
- params=query_params,
1182
- content_type="application/json",
1183
- )
458
+
459
+ response = await self._aget(url, params=query_params)
1184
460
  return self._handle_response(response)
1185
461
 
1186
- def get_channel_details(
462
+ async def get_primary_channel(
1187
463
  self,
1188
464
  team_id: str,
1189
- channel_id: str,
1190
465
  select: list[str] | None = None,
1191
466
  expand: list[str] | None = None,
1192
- ) -> Any:
467
+ ) -> dict[str, Any]:
1193
468
  """
1194
- Retrieves detailed information for a specific channel within a Microsoft Teams team, identified by both team and channel IDs. Optional parameters can select specific properties or expand related entities in the response, distinguishing it from list_channels_for_team, which retrieves a collection of channels.
469
+ Retrieve the default General channel of a team.
470
+ Supported OData parameters:
471
+ - $select: Select specific properties to return.
472
+ - $expand: Expand related entities.
1195
473
 
1196
474
  Args:
1197
- team_id (string): team-id
1198
- channel_id (string): channel-id
1199
- select (array): Select properties to be returned
1200
- expand (array): Expand related entities
475
+ team_id (string): The unique identifier of the team.
476
+ select (array): Select properties to be returned.
477
+ expand (array): Expand related entities.
1201
478
 
1202
479
  Returns:
1203
- Any: Retrieved navigation property
480
+ dict[str, Any]: Retrieved channel entity.
1204
481
 
1205
482
  Raises:
1206
- HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
483
+ HTTPStatusError: If the API request fails.
1207
484
 
1208
485
  Tags:
1209
- teams.channel
486
+ teams.channel, read
1210
487
  """
1211
488
  if team_id is None:
1212
489
  raise ValueError("Missing required parameter 'team-id'.")
1213
- if channel_id is None:
1214
- raise ValueError("Missing required parameter 'channel-id'.")
1215
- url = f"{self.base_url}/teams/{team_id}/channels/{channel_id}"
490
+
491
+ url = f"{self.base_url}/teams/{team_id}/primaryChannel"
492
+
493
+ # Helper to format list params
494
+ def fmt(val):
495
+ return ",".join(val) if isinstance(val, list) else val
496
+
1216
497
  query_params = {
1217
- k: v for k, v in [("$select", select), ("$expand", expand)] if v is not None
498
+ k: fmt(v)
499
+ for k, v in [
500
+ ("$select", select),
501
+ ("$expand", expand),
502
+ ]
503
+ if v is not None
1218
504
  }
1219
- response = self._get(url, params=query_params)
505
+
506
+ response = await self._aget(url, params=query_params)
1220
507
  return self._handle_response(response)
1221
508
 
1222
- def update_channel_message(
509
+ async def send_channel_message(
1223
510
  self,
1224
511
  team_id: str,
1225
512
  channel_id: str,
1226
- chatMessage_id: str,
1227
- id: str | None = None,
1228
- attachments: list[dict[str, dict[str, Any]]] | None = None,
1229
- body: dict[str, dict[str, Any]] | None = None,
1230
- channelIdentity: dict[str, dict[str, Any]] | None = None,
1231
- chatId: str | None = None,
1232
- createdDateTime: str | None = None,
1233
- deletedDateTime: str | None = None,
1234
- etag: str | None = None,
1235
- eventDetail: dict[str, dict[str, Any]] | None = None,
1236
- from_: Any | None = None,
1237
- importance: str | None = None,
1238
- lastEditedDateTime: str | None = None,
1239
- lastModifiedDateTime: str | None = None,
1240
- locale: str | None = None,
1241
- mentions: list[dict[str, dict[str, Any]]] | None = None,
1242
- messageHistory: list[dict[str, dict[str, Any]]] | None = None,
1243
- messageType: str | None = None,
1244
- policyViolation: dict[str, dict[str, Any]] | None = None,
1245
- reactions: list[dict[str, dict[str, Any]]] | None = None,
1246
- replyToId: str | None = None,
1247
- subject: str | None = None,
1248
- summary: str | None = None,
1249
- webUrl: str | None = None,
1250
- hostedContents: list[Any] | None = None,
1251
- replies: list[Any] | None = None,
1252
- ) -> Any:
513
+ content: str,
514
+ ) -> dict[str, Any]:
1253
515
  """
1254
- Updates an existing message within a Microsoft Teams channel, identified by team, channel, and message IDs. This function modifies the original message's properties, like its body, via a PATCH request, distinguishing it from functions that create new messages or update replies.
516
+ Posts a new message to a specific channel in a team.
1255
517
 
1256
518
  Args:
1257
- team_id (string): team-id
1258
- channel_id (string): channel-id
1259
- chatMessage_id (string): chatMessage-id
1260
- id (string): The unique identifier for an entity. Read-only.
1261
- attachments (array): References to attached objects like files, tabs, meetings etc.
1262
- body (object): body
1263
- channelIdentity (object): channelIdentity
1264
- chatId (string): If the message was sent in a chat, represents the identity of the chat.
1265
- createdDateTime (string): Timestamp of when the chat message was created.
1266
- deletedDateTime (string): Read only. Timestamp at which the chat message was deleted, or null if not deleted.
1267
- etag (string): Read-only. Version number of the chat message.
1268
- eventDetail (object): eventDetail
1269
- from_ (string): from
1270
- importance (string): importance
1271
- lastEditedDateTime (string): Read only. Timestamp when edits to the chat message were made. Triggers an 'Edited' flag in the Teams UI. If no edits are made the value is null.
1272
- lastModifiedDateTime (string): Read only. Timestamp when the chat message is created (initial setting) or modified, including when a reaction is added or removed.
1273
- locale (string): Locale of the chat message set by the client. Always set to en-us.
1274
- mentions (array): List of entities mentioned in the chat message. Supported entities are: user, bot, team, channel, chat, and tag.
1275
- messageHistory (array): List of activity history of a message item, including modification time and actions, such as reactionAdded, reactionRemoved, or reaction changes, on the message.
1276
- messageType (string): messageType
1277
- policyViolation (object): policyViolation
1278
- reactions (array): Reactions for this chat message (for example, Like).
1279
- replyToId (string): Read-only. ID of the parent chat message or root chat message of the thread. (Only applies to chat messages in channels, not chats.)
1280
- subject (string): The subject of the chat message, in plaintext.
1281
- summary (string): Summary text of the chat message that could be used for push notifications and summary views or fall back views. Only applies to channel chat messages, not chat messages in a chat.
1282
- webUrl (string): Read-only. Link to the message in Microsoft Teams.
1283
- hostedContents (array): Content in a message hosted by Microsoft Teams - for example, images or code snippets.
1284
- replies (array): Replies for a specified message. Supports $expand for channel messages.
519
+ team_id (string): The unique identifier of the team.
520
+ channel_id (string): The unique identifier of the channel.
521
+ content (string): The message content to send (plain text or HTML).
1285
522
 
1286
523
  Returns:
1287
- Any: Success
524
+ dict[str, Any]: A dictionary containing the API response for the sent message, including its ID.
1288
525
 
1289
526
  Raises:
1290
- HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
527
+ HTTPStatusError: If the API request fails.
1291
528
 
1292
529
  Tags:
1293
- teams.channel
530
+ teams.channel, channel.message, create, send
1294
531
  """
1295
532
  if team_id is None:
1296
533
  raise ValueError("Missing required parameter 'team-id'.")
1297
534
  if channel_id is None:
1298
535
  raise ValueError("Missing required parameter 'channel-id'.")
1299
- if chatMessage_id is None:
1300
- raise ValueError("Missing required parameter 'chatMessage-id'.")
1301
- request_body_data = None
1302
- request_body_data = {
1303
- "id": id,
1304
- "attachments": attachments,
1305
- "body": body,
1306
- "channelIdentity": channelIdentity,
1307
- "chatId": chatId,
1308
- "createdDateTime": createdDateTime,
1309
- "deletedDateTime": deletedDateTime,
1310
- "etag": etag,
1311
- "eventDetail": eventDetail,
1312
- "from": from_,
1313
- "importance": importance,
1314
- "lastEditedDateTime": lastEditedDateTime,
1315
- "lastModifiedDateTime": lastModifiedDateTime,
1316
- "locale": locale,
1317
- "mentions": mentions,
1318
- "messageHistory": messageHistory,
1319
- "messageType": messageType,
1320
- "policyViolation": policyViolation,
1321
- "reactions": reactions,
1322
- "replyToId": replyToId,
1323
- "subject": subject,
1324
- "summary": summary,
1325
- "webUrl": webUrl,
1326
- "hostedContents": hostedContents,
1327
- "replies": replies,
1328
- }
1329
- request_body_data = {
1330
- k: v for k, v in request_body_data.items() if v is not None
1331
- }
1332
- url = f"{self.base_url}/teams/{team_id}/channels/{channel_id}/messages/{chatMessage_id}"
1333
- query_params = {}
1334
- response = self._patch(url, data=request_body_data, params=query_params)
536
+
537
+ url = f"{self.base_url}/teams/{team_id}/channels/{channel_id}/messages"
538
+ payload = {"body": {"content": content}}
539
+
540
+ response = await self._apost(url, data=payload)
1335
541
  return self._handle_response(response)
1336
542
 
1337
- def update_channel_message_reply(
543
+ async def reply_to_channel_message(
1338
544
  self,
1339
545
  team_id: str,
1340
546
  channel_id: str,
1341
- chatMessage_id: str,
1342
- chatMessage_id1: str,
1343
- id: str | None = None,
1344
- attachments: list[dict[str, dict[str, Any]]] | None = None,
1345
- body: dict[str, dict[str, Any]] | None = None,
1346
- channelIdentity: dict[str, dict[str, Any]] | None = None,
1347
- chatId: str | None = None,
1348
- createdDateTime: str | None = None,
1349
- deletedDateTime: str | None = None,
1350
- etag: str | None = None,
1351
- eventDetail: dict[str, dict[str, Any]] | None = None,
1352
- from_: Any | None = None,
1353
- importance: str | None = None,
1354
- lastEditedDateTime: str | None = None,
1355
- lastModifiedDateTime: str | None = None,
1356
- locale: str | None = None,
1357
- mentions: list[dict[str, dict[str, Any]]] | None = None,
1358
- messageHistory: list[dict[str, dict[str, Any]]] | None = None,
1359
- messageType: str | None = None,
1360
- policyViolation: dict[str, dict[str, Any]] | None = None,
1361
- reactions: list[dict[str, dict[str, Any]]] | None = None,
1362
- replyToId: str | None = None,
1363
- subject: str | None = None,
1364
- summary: str | None = None,
1365
- webUrl: str | None = None,
1366
- hostedContents: list[Any] | None = None,
1367
- replies: list[Any] | None = None,
1368
- ) -> Any:
547
+ message_id: str,
548
+ content: str,
549
+ ) -> dict[str, Any]:
1369
550
  """
1370
- Updates an existing reply to a specific message within a Microsoft Teams channel. It identifies the target reply using team, channel, parent message, and reply IDs, modifying its properties (e.g., body content, attachments) via a PATCH request.
551
+ Sends a reply to an existing message in a channel.
1371
552
 
1372
553
  Args:
1373
- team_id (string): team-id
1374
- channel_id (string): channel-id
1375
- chatMessage_id (string): chatMessage-id
1376
- chatMessage_id1 (string): chatMessage-id1
1377
- id (string): The unique identifier for an entity. Read-only.
1378
- attachments (array): References to attached objects like files, tabs, meetings etc.
1379
- body (object): body
1380
- channelIdentity (object): channelIdentity
1381
- chatId (string): If the message was sent in a chat, represents the identity of the chat.
1382
- createdDateTime (string): Timestamp of when the chat message was created.
1383
- deletedDateTime (string): Read only. Timestamp at which the chat message was deleted, or null if not deleted.
1384
- etag (string): Read-only. Version number of the chat message.
1385
- eventDetail (object): eventDetail
1386
- from_ (string): from
1387
- importance (string): importance
1388
- lastEditedDateTime (string): Read only. Timestamp when edits to the chat message were made. Triggers an 'Edited' flag in the Teams UI. If no edits are made the value is null.
1389
- lastModifiedDateTime (string): Read only. Timestamp when the chat message is created (initial setting) or modified, including when a reaction is added or removed.
1390
- locale (string): Locale of the chat message set by the client. Always set to en-us.
1391
- mentions (array): List of entities mentioned in the chat message. Supported entities are: user, bot, team, channel, chat, and tag.
1392
- messageHistory (array): List of activity history of a message item, including modification time and actions, such as reactionAdded, reactionRemoved, or reaction changes, on the message.
1393
- messageType (string): messageType
1394
- policyViolation (object): policyViolation
1395
- reactions (array): Reactions for this chat message (for example, Like).
1396
- replyToId (string): Read-only. ID of the parent chat message or root chat message of the thread. (Only applies to chat messages in channels, not chats.)
1397
- subject (string): The subject of the chat message, in plaintext.
1398
- summary (string): Summary text of the chat message that could be used for push notifications and summary views or fall back views. Only applies to channel chat messages, not chat messages in a chat.
1399
- webUrl (string): Read-only. Link to the message in Microsoft Teams.
1400
- hostedContents (array): Content in a message hosted by Microsoft Teams - for example, images or code snippets.
1401
- replies (array): Replies for a specified message. Supports $expand for channel messages.
554
+ team_id (string): The unique identifier of the team.
555
+ channel_id (string): The unique identifier of the channel.
556
+ message_id (string): The unique identifier of the message to reply to.
557
+ content (string): The reply content to send (plain text or HTML).
1402
558
 
1403
559
  Returns:
1404
- Any: Success
560
+ dict[str, Any]: A dictionary containing the API response for the created reply.
1405
561
 
1406
562
  Raises:
1407
- HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
563
+ HTTPStatusError: If the API request fails.
1408
564
 
1409
565
  Tags:
1410
- teams.channel
566
+ teams.channel, channel.message, reply, create, send
1411
567
  """
1412
568
  if team_id is None:
1413
569
  raise ValueError("Missing required parameter 'team-id'.")
1414
570
  if channel_id is None:
1415
571
  raise ValueError("Missing required parameter 'channel-id'.")
1416
- if chatMessage_id is None:
1417
- raise ValueError("Missing required parameter 'chatMessage-id'.")
1418
- if chatMessage_id1 is None:
1419
- raise ValueError("Missing required parameter 'chatMessage-id1'.")
1420
- request_body_data = None
1421
- request_body_data = {
1422
- "id": id,
1423
- "attachments": attachments,
1424
- "body": body,
1425
- "channelIdentity": channelIdentity,
1426
- "chatId": chatId,
1427
- "createdDateTime": createdDateTime,
1428
- "deletedDateTime": deletedDateTime,
1429
- "etag": etag,
1430
- "eventDetail": eventDetail,
1431
- "from": from_,
1432
- "importance": importance,
1433
- "lastEditedDateTime": lastEditedDateTime,
1434
- "lastModifiedDateTime": lastModifiedDateTime,
1435
- "locale": locale,
1436
- "mentions": mentions,
1437
- "messageHistory": messageHistory,
1438
- "messageType": messageType,
1439
- "policyViolation": policyViolation,
1440
- "reactions": reactions,
1441
- "replyToId": replyToId,
1442
- "subject": subject,
1443
- "summary": summary,
1444
- "webUrl": webUrl,
1445
- "hostedContents": hostedContents,
1446
- "replies": replies,
1447
- }
1448
- request_body_data = {
1449
- k: v for k, v in request_body_data.items() if v is not None
1450
- }
1451
- url = f"{self.base_url}/teams/{team_id}/channels/{channel_id}/messages/{chatMessage_id}/replies/{chatMessage_id1}"
1452
- query_params = {}
1453
- response = self._patch(url, data=request_body_data, params=query_params)
572
+ if message_id is None:
573
+ raise ValueError("Missing required parameter 'message-id'.")
574
+
575
+ url = f"{self.base_url}/teams/{team_id}/channels/{channel_id}/messages/{message_id}/replies"
576
+ payload = {"body": {"content": content}}
577
+
578
+ response = await self._apost(url, data=payload)
1454
579
  return self._handle_response(response)
1455
580
 
1456
- def list_channel_tabs(
581
+ async def list_pinned_chat_messages(
1457
582
  self,
1458
- team_id: str,
1459
- channel_id: str,
1460
- top: int | None = None,
1461
- skip: int | None = None,
1462
- search: str | None = None,
1463
- filter: str | None = None,
1464
- count: bool | None = None,
1465
- orderby: list[str] | None = None,
1466
- select: list[str] | None = None,
583
+ chat_id: str,
1467
584
  expand: list[str] | None = None,
1468
585
  ) -> dict[str, Any]:
1469
586
  """
1470
- Retrieves a collection of tabs from a specified channel within a Microsoft Teams team. Unlike `get_channel_tab_details`, which fetches a single tab, this function lists all tabs and supports advanced OData query parameters for filtering, sorting, and pagination of the entire collection.
587
+ Get a list of pinned messages in a chat.
588
+ Supported OData parameters:
589
+ - $expand: Expand related entities (e.g., 'message').
1471
590
 
1472
591
  Args:
1473
- team_id (string): team-id
1474
- channel_id (string): channel-id
1475
- top (integer): Show only the first n items Example: '50'.
1476
- skip (integer): Skip the first n items
1477
- search (string): Search items by search phrases
1478
- filter (string): Filter items by property values
1479
- count (boolean): Include count of items
1480
- orderby (array): Order items by property values
1481
- select (array): Select properties to be returned
1482
- expand (array): Expand related entities
592
+ chat_id (string): The unique identifier of the chat.
593
+ expand (array): Expand related entities.
1483
594
 
1484
595
  Returns:
1485
- dict[str, Any]: Retrieved collection
596
+ dict[str, Any]: Retrieved collection of pinned messages.
1486
597
 
1487
598
  Raises:
1488
- HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
599
+ HTTPStatusError: If the API request fails.
1489
600
 
1490
601
  Tags:
1491
- teams.channel
602
+ teams.chat, pinned_message, list, read
1492
603
  """
1493
- if team_id is None:
1494
- raise ValueError("Missing required parameter 'team-id'.")
1495
- if channel_id is None:
1496
- raise ValueError("Missing required parameter 'channel-id'.")
1497
- url = f"{self.base_url}/teams/{team_id}/channels/{channel_id}/tabs"
604
+ if chat_id is None:
605
+ raise ValueError("Missing required parameter 'chat-id'.")
606
+
607
+ url = f"{self.base_url}/chats/{chat_id}/pinnedMessages"
608
+
609
+ # Helper to format list params
610
+ def fmt(val):
611
+ return ",".join(val) if isinstance(val, list) else val
612
+
1498
613
  query_params = {
1499
- k: v
614
+ k: fmt(v)
1500
615
  for k, v in [
1501
- ("$top", top),
1502
- ("$skip", skip),
1503
- ("$search", search),
1504
- ("$filter", filter),
1505
- ("$count", count),
1506
- ("$orderby", orderby),
1507
- ("$select", select),
1508
616
  ("$expand", expand),
1509
617
  ]
1510
618
  if v is not None
1511
619
  }
1512
- response = self._get(url, params=query_params)
620
+
621
+ response = await self._aget(url, params=query_params)
1513
622
  return self._handle_response(response)
1514
623
 
1515
- def create_channel_tab(
624
+ async def pin_chat_message(
1516
625
  self,
1517
- team_id: str,
1518
- channel_id: str,
1519
- id: str | None = None,
1520
- configuration: dict[str, dict[str, Any]] | None = None,
1521
- displayName: str | None = None,
1522
- webUrl: str | None = None,
1523
- teamsApp: Any | None = None,
1524
- ) -> Any:
626
+ chat_id: str,
627
+ message_id: str,
628
+ ) -> dict[str, Any]:
1525
629
  """
1526
- Creates a new tab in a specified Microsoft Teams channel using team and channel IDs. This function configures the tab's initial properties, such as display name and application, distinguishing it from functions that list (`list_channel_tabs`) or modify (`update_channel_tab`) existing tabs.
630
+ Pin a message in a chat.
1527
631
 
1528
632
  Args:
1529
- team_id (string): team-id
1530
- channel_id (string): channel-id
1531
- id (string): The unique identifier for an entity. Read-only.
1532
- configuration (object): configuration
1533
- displayName (string): Name of the tab.
1534
- webUrl (string): Deep link URL of the tab instance. Read only.
1535
- teamsApp (string): teamsApp
633
+ chat_id (string): The unique identifier of the chat.
634
+ message_id (string): The unique identifier of the message to pin.
1536
635
 
1537
636
  Returns:
1538
- Any: Created navigation property.
637
+ dict[str, Any]: A dictionary containing the API response for the pinned message.
1539
638
 
1540
639
  Raises:
1541
- HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
640
+ HTTPStatusError: If the API request fails.
1542
641
 
1543
642
  Tags:
1544
- teams.channel
643
+ teams.chat, pinned_message, create, pin
1545
644
  """
1546
- if team_id is None:
1547
- raise ValueError("Missing required parameter 'team-id'.")
1548
- if channel_id is None:
1549
- raise ValueError("Missing required parameter 'channel-id'.")
1550
- request_body_data = None
1551
- request_body_data = {
1552
- "id": id,
1553
- "configuration": configuration,
1554
- "displayName": displayName,
1555
- "webUrl": webUrl,
1556
- "teamsApp": teamsApp,
1557
- }
1558
- request_body_data = {
1559
- k: v for k, v in request_body_data.items() if v is not None
645
+ if chat_id is None:
646
+ raise ValueError("Missing required parameter 'chat-id'.")
647
+ if message_id is None:
648
+ raise ValueError("Missing required parameter 'message-id'.")
649
+
650
+ url = f"{self.base_url}/chats/{chat_id}/pinnedMessages"
651
+
652
+ # The API requires a specific OData bind format for the message
653
+ payload = {
654
+ "message@odata.bind": f"https://graph.microsoft.com/v1.0/chats/{chat_id}/messages/{message_id}"
1560
655
  }
1561
- url = f"{self.base_url}/teams/{team_id}/channels/{channel_id}/tabs"
1562
- query_params = {}
1563
- response = self._post(
1564
- url,
1565
- data=request_body_data,
1566
- params=query_params,
1567
- content_type="application/json",
1568
- )
656
+
657
+ response = await self._apost(url, data=payload)
1569
658
  return self._handle_response(response)
1570
659
 
1571
- def get_channel_tab_details(
660
+ async def unpin_chat_message(
1572
661
  self,
1573
- team_id: str,
1574
- channel_id: str,
1575
- teamsTab_id: str,
1576
- select: list[str] | None = None,
1577
- expand: list[str] | None = None,
1578
- ) -> Any:
662
+ chat_id: str,
663
+ pinned_chat_message_id: str,
664
+ ) -> dict[str, Any]:
1579
665
  """
1580
- Fetches properties for a single tab within a specific Microsoft Teams channel, identified by its team, channel, and tab IDs. Unlike `list_channel_tabs` which gets all tabs, this targets a specific one, with options to select fields or expand related entities in the response.
666
+ Unpin a message from a chat.
1581
667
 
1582
668
  Args:
1583
- team_id (string): team-id
1584
- channel_id (string): channel-id
1585
- teamsTab_id (string): teamsTab-id
1586
- select (array): Select properties to be returned
1587
- expand (array): Expand related entities
669
+ chat_id (string): The unique identifier of the chat.
670
+ pinned_chat_message_id (string): The unique identifier of the pinned message (not the message ID itself).
1588
671
 
1589
672
  Returns:
1590
- Any: Retrieved navigation property
673
+ dict[str, Any]: A dictionary containing the API response (usually empty for 204).
1591
674
 
1592
675
  Raises:
1593
- HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
676
+ HTTPStatusError: If the API request fails.
1594
677
 
1595
678
  Tags:
1596
- teams.channel
679
+ teams.chat, pinned_message, delete, unpin
1597
680
  """
1598
- if team_id is None:
1599
- raise ValueError("Missing required parameter 'team-id'.")
1600
- if channel_id is None:
1601
- raise ValueError("Missing required parameter 'channel-id'.")
1602
- if teamsTab_id is None:
1603
- raise ValueError("Missing required parameter 'teamsTab-id'.")
1604
- url = (
1605
- f"{self.base_url}/teams/{team_id}/channels/{channel_id}/tabs/{teamsTab_id}"
1606
- )
1607
- query_params = {
1608
- k: v for k, v in [("$select", select), ("$expand", expand)] if v is not None
1609
- }
1610
- response = self._get(url, params=query_params)
681
+ if chat_id is None:
682
+ raise ValueError("Missing required parameter 'chat-id'.")
683
+ if pinned_chat_message_id is None:
684
+ raise ValueError("Missing required parameter 'pinned-chat-message-id'.")
685
+
686
+ url = f"{self.base_url}/chats/{chat_id}/pinnedMessages/{pinned_chat_message_id}"
687
+
688
+ response = await self._adelete(url)
689
+ # DELETE 204 returns no content, handle gracefully
690
+ if response.status_code == 204:
691
+ return {"status": "success", "message": "Message unpinned successfully."}
1611
692
  return self._handle_response(response)
1612
693
 
1613
- def update_channel_tab(
694
+ # Teams
695
+
696
+ async def create_team(
1614
697
  self,
1615
- team_id: str,
1616
- channel_id: str,
1617
- teamsTab_id: str,
1618
- id: str | None = None,
1619
- configuration: dict[str, dict[str, Any]] | None = None,
1620
- displayName: str | None = None,
1621
- webUrl: str | None = None,
1622
- teamsApp: Any | None = None,
1623
- ) -> Any:
698
+ display_name: str,
699
+ description: str,
700
+ ) -> dict[str, Any]:
1624
701
  """
1625
- Modifies properties of an existing tab within a specific Microsoft Teams channel. It uses the team, channel, and tab IDs to target the tab, allowing for partial updates to its configuration or display name via a PATCH request, differentiating it from tab creation or deletion functions.
702
+ Create a new team.
703
+ Uses the 'standard' template by default.
1626
704
 
1627
705
  Args:
1628
- team_id (string): team-id
1629
- channel_id (string): channel-id
1630
- teamsTab_id (string): teamsTab-id
1631
- id (string): The unique identifier for an entity. Read-only.
1632
- configuration (object): configuration
1633
- displayName (string): Name of the tab.
1634
- webUrl (string): Deep link URL of the tab instance. Read only.
1635
- teamsApp (string): teamsApp
706
+ display_name (string): The name of the team.
707
+ description (string): The description of the team.
1636
708
 
1637
709
  Returns:
1638
- Any: Success
710
+ dict[str, Any]: A dictionary containing the API response (e.g., location header for the async operation).
1639
711
 
1640
712
  Raises:
1641
- HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
713
+ HTTPStatusError: If the API request fails.
1642
714
 
1643
715
  Tags:
1644
- teams.channel
1645
- """
1646
- if team_id is None:
1647
- raise ValueError("Missing required parameter 'team-id'.")
1648
- if channel_id is None:
1649
- raise ValueError("Missing required parameter 'channel-id'.")
1650
- if teamsTab_id is None:
1651
- raise ValueError("Missing required parameter 'teamsTab-id'.")
1652
- request_body_data = None
1653
- request_body_data = {
1654
- "id": id,
1655
- "configuration": configuration,
1656
- "displayName": displayName,
1657
- "webUrl": webUrl,
1658
- "teamsApp": teamsApp,
1659
- }
1660
- request_body_data = {
1661
- k: v for k, v in request_body_data.items() if v is not None
1662
- }
1663
- url = (
1664
- f"{self.base_url}/teams/{team_id}/channels/{channel_id}/tabs/{teamsTab_id}"
1665
- )
1666
- query_params = {}
1667
- response = self._patch(url, data=request_body_data, params=query_params)
1668
- return self._handle_response(response)
1669
-
1670
- def delete_channel_tab(
1671
- self, team_id: str, channel_id: str, teamsTab_id: str
1672
- ) -> Any:
716
+ teams.team, create, provision
1673
717
  """
1674
- Permanently removes a specific tab from a Microsoft Teams channel using its unique ID, along with the parent team and channel IDs. This function is the destructive counterpart to `create_channel_tab`, designed to delete a tab rather than create, list, or update one.
1675
-
1676
- Args:
1677
- team_id (string): team-id
1678
- channel_id (string): channel-id
1679
- teamsTab_id (string): teamsTab-id
1680
-
1681
- Returns:
1682
- Any: Success
1683
-
1684
- Raises:
1685
- HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
718
+ if display_name is None:
719
+ raise ValueError("Missing required parameter 'display-name'.")
720
+ if description is None:
721
+ raise ValueError("Missing required parameter 'description'.")
1686
722
 
1687
- Tags:
1688
- teams.channel
1689
- """
1690
- if team_id is None:
1691
- raise ValueError("Missing required parameter 'team-id'.")
1692
- if channel_id is None:
1693
- raise ValueError("Missing required parameter 'channel-id'.")
1694
- if teamsTab_id is None:
1695
- raise ValueError("Missing required parameter 'teamsTab-id'.")
1696
- url = (
1697
- f"{self.base_url}/teams/{team_id}/channels/{channel_id}/tabs/{teamsTab_id}"
1698
- )
1699
- query_params = {}
1700
- response = self._delete(url, params=query_params)
723
+ url = f"{self.base_url}/teams"
724
+
725
+ payload = {
726
+ "template@odata.bind": "https://graph.microsoft.com/v1.0/teamsTemplates('standard')",
727
+ "displayName": display_name,
728
+ "description": description
729
+ }
730
+
731
+ response = await self._apost(url, data=payload)
732
+
733
+ # 202 Accepted means it's an async operation.
734
+ # The Location header contains the URL to check status.
735
+ if response.status_code == 202:
736
+ return {
737
+ "status": "accepted",
738
+ "operation_location": response.headers.get("Location"),
739
+ "message": "Team creation initiated. Check operation_location for status."
740
+ }
741
+
1701
742
  return self._handle_response(response)
1702
743
 
1703
- def get_primary_team_channel(
744
+ async def get_team(
1704
745
  self,
1705
746
  team_id: str,
1706
747
  select: list[str] | None = None,
1707
748
  expand: list[str] | None = None,
1708
- ) -> Any:
749
+ ) -> dict[str, Any]:
1709
750
  """
1710
- Retrieves the primary channel (usually 'General') for a specified team using its ID. Unlike `get_channel_details`, this function directly accesses the team's default channel without requiring a specific channel ID. Optional parameters can select or expand properties in the returned data.
751
+ Retrieve a specific team's details.
752
+ Supported OData parameters:
753
+ - $select: Select specific properties.
754
+ - $expand: Expand related entities.
1711
755
 
1712
756
  Args:
1713
- team_id (string): team-id
1714
- select (array): Select properties to be returned
1715
- expand (array): Expand related entities
757
+ team_id (string): The unique identifier of the team.
758
+ select (array): Select specific properties.
759
+ expand (array): Expand related entities.
1716
760
 
1717
761
  Returns:
1718
- Any: Retrieved navigation property
762
+ dict[str, Any]: The team resource.
1719
763
 
1720
764
  Raises:
1721
- HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
765
+ HTTPStatusError: If the API request fails.
1722
766
 
1723
767
  Tags:
1724
- teams.channel
768
+ teams.team, read, get
1725
769
  """
1726
770
  if team_id is None:
1727
771
  raise ValueError("Missing required parameter 'team-id'.")
1728
- url = f"{self.base_url}/teams/{team_id}/primaryChannel"
772
+
773
+ url = f"{self.base_url}/teams/{team_id}"
774
+
775
+ # Helper to format list params
776
+ def fmt(val):
777
+ return ",".join(val) if isinstance(val, list) else val
778
+
1729
779
  query_params = {
1730
- k: v for k, v in [("$select", select), ("$expand", expand)] if v is not None
780
+ k: fmt(v)
781
+ for k, v in [
782
+ ("$select", select),
783
+ ("$expand", expand),
784
+ ]
785
+ if v is not None
1731
786
  }
1732
- response = self._get(url, params=query_params)
787
+
788
+ response = await self._aget(url, params=query_params)
1733
789
  return self._handle_response(response)
1734
790
 
1735
- def list_user_installed_apps(
791
+ async def list_joined_teams(
1736
792
  self,
1737
- user_id: str,
1738
- top: int | None = None,
1739
- skip: int | None = None,
1740
- search: str | None = None,
1741
- filter: str | None = None,
1742
- count: bool | None = None,
1743
- orderby: list[str] | None = None,
1744
- select: list[str] | None = None,
1745
- expand: list[str] | None = None,
1746
793
  ) -> dict[str, Any]:
1747
794
  """
1748
- Retrieves applications installed in a user's personal Microsoft Teams scope, identified by their ID. Unlike `list_installed_chat_apps` which targets chat installations, this focuses on the user's scope. It supports optional OData parameters for filtering, sorting, and pagination to customize the returned app collection.
1749
-
1750
- Args:
1751
- user_id (string): user-id
1752
- top (integer): Show only the first n items Example: '50'.
1753
- skip (integer): Skip the first n items
1754
- search (string): Search items by search phrases
1755
- filter (string): Filter items by property values
1756
- count (boolean): Include count of items
1757
- orderby (array): Order items by property values
1758
- select (array): Select properties to be returned
1759
- expand (array): Expand related entities
795
+ List the teams that the user is a direct member of.
796
+ Note: This endpoint does not support OData query parameters.
797
+ It returns a subset of properties (id, displayName, description, isArchived, tenantId) by default.
1760
798
 
1761
799
  Returns:
1762
- dict[str, Any]: Retrieved collection
800
+ dict[str, Any]: A dictionary containing the list of teams.
1763
801
 
1764
802
  Raises:
1765
- HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
1766
-
803
+ HTTPStatusError: If the API request fails.
804
+
1767
805
  Tags:
1768
- users.userTeamwork
806
+ teams.team, list, read, joined
1769
807
  """
1770
- if user_id is None:
1771
- raise ValueError("Missing required parameter 'user-id'.")
1772
- url = f"{self.base_url}/users/{user_id}/teamwork/installedApps"
1773
- query_params = {
1774
- k: v
1775
- for k, v in [
1776
- ("$top", top),
1777
- ("$skip", skip),
1778
- ("$search", search),
1779
- ("$filter", filter),
1780
- ("$count", count),
1781
- ("$orderby", orderby),
1782
- ("$select", select),
1783
- ("$expand", expand),
1784
- ]
1785
- if v is not None
1786
- }
1787
- response = self._get(url, params=query_params)
808
+ url = f"{self.base_url}/me/joinedTeams"
809
+
810
+ response = await self._aget(url)
1788
811
  return self._handle_response(response)
1789
812
 
1790
813
  def list_tools(self):
1791
814
  return [
815
+ self.get_me,
1792
816
  self.get_user_chats,
1793
- self.get_joined_teams,
1794
- self.list_channels_for_team,
1795
- self.send_chat_message,
1796
- self.send_channel_message,
1797
- self.reply_to_channel_message,
1798
817
  self.create_chat,
1799
818
  self.get_chat_details,
1800
819
  self.update_chat_details,
1801
- self.list_installed_chat_apps,
1802
820
  self.list_chat_members,
1803
- self.add_member_to_chat,
1804
821
  self.get_chat_member,
1805
- self.delete_chat_member,
1806
822
  self.list_chat_messages,
1807
823
  self.get_chat_message,
1808
- self.list_chat_message_replies,
1809
- self.reply_to_chat_message,
1810
- self.get_chat_reply_details,
1811
- self.create_team_from_group,
824
+ self.send_chat_message,
825
+ self.list_all_channels,
826
+ self.get_channel,
827
+ self.get_primary_channel,
828
+ self.send_channel_message,
829
+ self.reply_to_channel_message,
830
+ self.list_pinned_chat_messages,
831
+ self.pin_chat_message,
832
+ self.unpin_chat_message,
1812
833
  self.create_team,
1813
- self.get_channel_details,
1814
- self.update_channel_message,
1815
- self.update_channel_message_reply,
1816
- self.list_channel_tabs,
1817
- self.create_channel_tab,
1818
- self.get_channel_tab_details,
1819
- self.update_channel_tab,
1820
- self.delete_channel_tab,
1821
- self.get_primary_team_channel,
1822
- self.list_user_installed_apps,
834
+ self.get_team,
835
+ self.list_joined_teams,
1823
836
  ]