archastro.platform.v1.resources.thread_messages
1# Copyright (c) 2026 ArchAstro Inc. All Rights Reserved. 2# This file is auto-generated by @archastro/sdk-generator. Do not edit. 3# Content hash: 835abb052035 4 5from __future__ import annotations 6 7from datetime import datetime 8from typing import Any, TypedDict 9 10from pydantic import BaseModel, Field 11 12from ...runtime.http_client import HttpClient, SyncHttpClient 13from ...types.common import Message, PaginatedReplies 14 15 16class ReactionCreateInput(TypedDict): 17 "Add a reaction to a thread message" 18 19 emoji: str 20 'Emoji character or shortcode to add as a reaction, e.g. `" "` or `":thumbsup:"`.' 21 22 23class ThreadMessageReplaceInput(TypedDict, total=False): 24 "Update a thread message" 25 26 content: str | None 27 "Replacement text content for the message. Omit to leave the content unchanged." 28 29 30class ReactionCreateResponseData(BaseModel): 31 created_at: datetime | None = Field( 32 default=None, description="When the reaction was added (ISO 8601)." 33 ) 34 feedback_type: str | None = Field( 35 default=None, 36 description='Category of feedback. Currently `"emoji_reaction"` for emoji responses.', 37 ) 38 id: str = Field(..., description="Reaction ID (`umf_...`).") 39 message: str | None = Field( 40 default=None, description="ID of the message this reaction is attached to (`msg_...`)." 41 ) 42 payload: dict[str, Any] | None = Field( 43 default=None, 44 description='Structured data for the reaction. For `"emoji_reaction"` types, includes an `emoji` key with the Unicode emoji string.', 45 ) 46 updated_at: datetime | None = Field( 47 default=None, description="When the reaction was last modified (ISO 8601)." 48 ) 49 user: str | None = Field( 50 default=None, description="ID of the user who added the reaction (`usr_...`)." 51 ) 52 53 54class ReactionCreateResponse(BaseModel): 55 """ 56 Successful response 57 """ 58 59 data: ReactionCreateResponseData = Field(..., description="Reaction object that was created.") 60 61 62class AsyncReactionResource: 63 def __init__(self, http: HttpClient): 64 self._http = http 65 66 async def remove(self, message: str) -> None: 67 """ 68 Remove a reaction from a thread message 69 Removes the authenticated user's emoji reaction from the specified thread 70 message. The reaction is identified by the combination of the message ID and 71 the emoji; only the reaction belonging to the calling user is removed. 72 Returns 204 No Content on success. Returns 404 if no matching reaction 73 exists for the user and emoji on that message, or if the message itself 74 cannot be found. The authenticated user must have read access to the thread 75 containing the message. 76 77 Args: 78 message: Message ID (`msg_...`) of the thread message whose reaction should be removed. 79 80 Returns: 81 Empty response body. HTTP 204 No Content on success. 82 """ 83 await self._http.request(f"/api/v1/thread_messages/{message}/reactions", method="DELETE") 84 85 async def create(self, message: str, input: ReactionCreateInput) -> ReactionCreateResponse: 86 """ 87 Add a reaction to a thread message 88 Adds an emoji reaction to the specified thread message on behalf of the 89 authenticated user. If the user has already reacted to the message with the 90 same emoji, the request returns a 409 Conflict rather than creating a 91 duplicate. 92 The authenticated user must have read access to the thread containing the 93 message. If the thread belongs to a team, the user must be a member of 94 that team. 95 96 Args: 97 message: Message ID (`msg_...`) of the thread message whose reaction should be removed. 98 input: Request body. 99 input.emoji: Emoji character or shortcode to add as a reaction, e.g. `" "` or `":thumbsup:"`. 100 101 Returns: 102 Successful response 103 """ 104 return await self._http.request( 105 f"/api/v1/thread_messages/{message}/reactions", 106 method="POST", 107 body=input, 108 response_type=ReactionCreateResponse, 109 ) 110 111 112class AsyncThreadMessageResource: 113 def __init__(self, http: HttpClient): 114 self._http = http 115 self.reactions = AsyncReactionResource(http) 116 117 async def delete(self, message: str) -> None: 118 """ 119 Delete a thread message 120 Permanently removes the specified message from its thread. This action 121 cannot be undone. 122 A regular user may only delete messages they authored. Service-to-service 123 callers with elevated (`all_powerful`) scope may delete any message in a 124 thread they can access. Returns `403 Forbidden` when the caller does not 125 own the message. 126 127 Args: 128 message: ID of the message to delete (`msg_...`). 129 130 Returns: 131 Empty body. The server responds with HTTP 204 No Content on success. 132 """ 133 await self._http.request(f"/api/v1/thread_messages/{message}", method="DELETE") 134 135 async def replace(self, message: str, input: ThreadMessageReplaceInput) -> Message: 136 """ 137 Update a thread message 138 Edits the content of an existing thread message and returns the updated 139 message object. 140 A regular user may only edit messages they authored. Service-to-service 141 callers with elevated (`all_powerful`) scope may edit any accessible message 142 without an ownership check. Returns `403 Forbidden` when the caller does not 143 own the message. 144 145 Args: 146 message: ID of the message to update (`msg_...`). 147 input: Request body. 148 input.content: Replacement text content for the message. Omit to leave the content unchanged. 149 150 Returns: 151 The updated message object reflecting the new content. 152 """ 153 return await self._http.request( 154 f"/api/v1/thread_messages/{message}", 155 method="PUT", 156 body=input, 157 response_type=Message, 158 ) 159 160 async def replies( 161 self, 162 message: str, 163 *, 164 before_cursor: str | None = None, 165 after_cursor: str | None = None, 166 limit: int | None = None, 167 tree: bool | None = None, 168 ) -> PaginatedReplies: 169 """ 170 List replies to a thread message 171 Returns a cursor-paginated list of reply messages for the specified thread 172 message. By default only direct (first-level) replies are returned. Set 173 `tree` to `true` to retrieve the full nested reply tree in a flat list, 174 ordered by creation time ascending. 175 The authenticated user must have access to the thread that contains the 176 message. If the message belongs to a team-scoped thread, the viewer is 177 automatically scoped to that team before the query executes. 178 Use `before_cursor` and `after_cursor` together with `limit` to page 179 through large reply threads. The `has_more` field in the response 180 indicates whether additional pages exist. 181 182 Args: 183 message: ID of the thread message to fetch replies for (`msg_...`). 184 before_cursor: Opaque pagination cursor. Returns replies created before this point. Obtain from `before_cursor` in a previous response. 185 after_cursor: Opaque pagination cursor. Returns replies created after this point. Obtain from `after_cursor` in a previous response. 186 limit: Maximum number of replies to return per page. Defaults to 20. 187 tree: When `true`, returns all replies in the nested reply tree (flattened). When `false` or omitted, returns only direct replies to the message. 188 189 Returns: 190 Cursor-paginated list of reply messages for the requested thread message. 191 """ 192 query: dict[str, object] = {} 193 if before_cursor is not None: 194 query["before_cursor"] = before_cursor 195 if after_cursor is not None: 196 query["after_cursor"] = after_cursor 197 if limit is not None: 198 query["limit"] = limit 199 if tree is not None: 200 query["tree"] = tree 201 return await self._http.request( 202 f"/api/v1/thread_messages/{message}/replies", 203 query=query, 204 response_type=PaginatedReplies, 205 ) 206 207 208class ReactionResource: 209 def __init__(self, http: SyncHttpClient): 210 self._http = http 211 212 def remove(self, message: str) -> None: 213 """ 214 Remove a reaction from a thread message 215 Removes the authenticated user's emoji reaction from the specified thread 216 message. The reaction is identified by the combination of the message ID and 217 the emoji; only the reaction belonging to the calling user is removed. 218 Returns 204 No Content on success. Returns 404 if no matching reaction 219 exists for the user and emoji on that message, or if the message itself 220 cannot be found. The authenticated user must have read access to the thread 221 containing the message. 222 223 Args: 224 message: Message ID (`msg_...`) of the thread message whose reaction should be removed. 225 226 Returns: 227 Empty response body. HTTP 204 No Content on success. 228 """ 229 self._http.request(f"/api/v1/thread_messages/{message}/reactions", method="DELETE") 230 231 def create(self, message: str, input: ReactionCreateInput) -> ReactionCreateResponse: 232 """ 233 Add a reaction to a thread message 234 Adds an emoji reaction to the specified thread message on behalf of the 235 authenticated user. If the user has already reacted to the message with the 236 same emoji, the request returns a 409 Conflict rather than creating a 237 duplicate. 238 The authenticated user must have read access to the thread containing the 239 message. If the thread belongs to a team, the user must be a member of 240 that team. 241 242 Args: 243 message: Message ID (`msg_...`) of the thread message whose reaction should be removed. 244 input: Request body. 245 input.emoji: Emoji character or shortcode to add as a reaction, e.g. `" "` or `":thumbsup:"`. 246 247 Returns: 248 Successful response 249 """ 250 return self._http.request( 251 f"/api/v1/thread_messages/{message}/reactions", 252 method="POST", 253 body=input, 254 response_type=ReactionCreateResponse, 255 ) 256 257 258class ThreadMessageResource: 259 def __init__(self, http: SyncHttpClient): 260 self._http = http 261 self.reactions = ReactionResource(http) 262 263 def delete(self, message: str) -> None: 264 """ 265 Delete a thread message 266 Permanently removes the specified message from its thread. This action 267 cannot be undone. 268 A regular user may only delete messages they authored. Service-to-service 269 callers with elevated (`all_powerful`) scope may delete any message in a 270 thread they can access. Returns `403 Forbidden` when the caller does not 271 own the message. 272 273 Args: 274 message: ID of the message to delete (`msg_...`). 275 276 Returns: 277 Empty body. The server responds with HTTP 204 No Content on success. 278 """ 279 self._http.request(f"/api/v1/thread_messages/{message}", method="DELETE") 280 281 def replace(self, message: str, input: ThreadMessageReplaceInput) -> Message: 282 """ 283 Update a thread message 284 Edits the content of an existing thread message and returns the updated 285 message object. 286 A regular user may only edit messages they authored. Service-to-service 287 callers with elevated (`all_powerful`) scope may edit any accessible message 288 without an ownership check. Returns `403 Forbidden` when the caller does not 289 own the message. 290 291 Args: 292 message: ID of the message to update (`msg_...`). 293 input: Request body. 294 input.content: Replacement text content for the message. Omit to leave the content unchanged. 295 296 Returns: 297 The updated message object reflecting the new content. 298 """ 299 return self._http.request( 300 f"/api/v1/thread_messages/{message}", 301 method="PUT", 302 body=input, 303 response_type=Message, 304 ) 305 306 def replies( 307 self, 308 message: str, 309 *, 310 before_cursor: str | None = None, 311 after_cursor: str | None = None, 312 limit: int | None = None, 313 tree: bool | None = None, 314 ) -> PaginatedReplies: 315 """ 316 List replies to a thread message 317 Returns a cursor-paginated list of reply messages for the specified thread 318 message. By default only direct (first-level) replies are returned. Set 319 `tree` to `true` to retrieve the full nested reply tree in a flat list, 320 ordered by creation time ascending. 321 The authenticated user must have access to the thread that contains the 322 message. If the message belongs to a team-scoped thread, the viewer is 323 automatically scoped to that team before the query executes. 324 Use `before_cursor` and `after_cursor` together with `limit` to page 325 through large reply threads. The `has_more` field in the response 326 indicates whether additional pages exist. 327 328 Args: 329 message: ID of the thread message to fetch replies for (`msg_...`). 330 before_cursor: Opaque pagination cursor. Returns replies created before this point. Obtain from `before_cursor` in a previous response. 331 after_cursor: Opaque pagination cursor. Returns replies created after this point. Obtain from `after_cursor` in a previous response. 332 limit: Maximum number of replies to return per page. Defaults to 20. 333 tree: When `true`, returns all replies in the nested reply tree (flattened). When `false` or omitted, returns only direct replies to the message. 334 335 Returns: 336 Cursor-paginated list of reply messages for the requested thread message. 337 """ 338 query: dict[str, object] = {} 339 if before_cursor is not None: 340 query["before_cursor"] = before_cursor 341 if after_cursor is not None: 342 query["after_cursor"] = after_cursor 343 if limit is not None: 344 query["limit"] = limit 345 if tree is not None: 346 query["tree"] = tree 347 return self._http.request( 348 f"/api/v1/thread_messages/{message}/replies", 349 query=query, 350 response_type=PaginatedReplies, 351 )
17class ReactionCreateInput(TypedDict): 18 "Add a reaction to a thread message" 19 20 emoji: str 21 'Emoji character or shortcode to add as a reaction, e.g. `" "` or `":thumbsup:"`.'
Add a reaction to a thread message
24class ThreadMessageReplaceInput(TypedDict, total=False): 25 "Update a thread message" 26 27 content: str | None 28 "Replacement text content for the message. Omit to leave the content unchanged."
Update a thread message
31class ReactionCreateResponseData(BaseModel): 32 created_at: datetime | None = Field( 33 default=None, description="When the reaction was added (ISO 8601)." 34 ) 35 feedback_type: str | None = Field( 36 default=None, 37 description='Category of feedback. Currently `"emoji_reaction"` for emoji responses.', 38 ) 39 id: str = Field(..., description="Reaction ID (`umf_...`).") 40 message: str | None = Field( 41 default=None, description="ID of the message this reaction is attached to (`msg_...`)." 42 ) 43 payload: dict[str, Any] | None = Field( 44 default=None, 45 description='Structured data for the reaction. For `"emoji_reaction"` types, includes an `emoji` key with the Unicode emoji string.', 46 ) 47 updated_at: datetime | None = Field( 48 default=None, description="When the reaction was last modified (ISO 8601)." 49 ) 50 user: str | None = Field( 51 default=None, description="ID of the user who added the reaction (`usr_...`)." 52 )
!!! abstract "Usage Documentation" Models
A base class for creating Pydantic models.
Attributes:
- __class_vars__: The names of the class variables defined on the model.
- __private_attributes__: Metadata about the private attributes of the model.
- __signature__: The synthesized
__init__[Signature][inspect.Signature] of the model. - __pydantic_complete__: Whether model building is completed, or if there are still undefined fields.
- __pydantic_core_schema__: The core schema of the model.
- __pydantic_custom_init__: Whether the model has a custom
__init__function. - __pydantic_decorators__: Metadata containing the decorators defined on the model.
This replaces
Model.__validators__andModel.__root_validators__from Pydantic V1. - __pydantic_generic_metadata__: A dictionary containing metadata about generic Pydantic models.
The
originandargsitems map to the [__origin__][genericalias.__origin__] and [__args__][genericalias.__args__] attributes of [generic aliases][types-genericalias], and theparameteritem maps to the__parameter__attribute of generic classes. - __pydantic_parent_namespace__: Parent namespace of the model, used for automatic rebuilding of models.
- __pydantic_post_init__: The name of the post-init method for the model, if defined.
- __pydantic_root_model__: Whether the model is a [
RootModel][pydantic.root_model.RootModel]. - __pydantic_serializer__: The
pydantic-coreSchemaSerializerused to dump instances of the model. - __pydantic_validator__: The
pydantic-coreSchemaValidatorused to validate instances of the model. - __pydantic_fields__: A dictionary of field names and their corresponding [
FieldInfo][pydantic.fields.FieldInfo] objects. - __pydantic_computed_fields__: A dictionary of computed field names and their corresponding [
ComputedFieldInfo][pydantic.fields.ComputedFieldInfo] objects. - __pydantic_extra__: A dictionary containing extra values, if [
extra][pydantic.config.ConfigDict.extra] is set to'allow'. - __pydantic_fields_set__: The names of fields explicitly set during instantiation.
- __pydantic_private__: Values of private attributes set on the model instance.
Category of feedback. Currently "emoji_reaction" for emoji responses.
55class ReactionCreateResponse(BaseModel): 56 """ 57 Successful response 58 """ 59 60 data: ReactionCreateResponseData = Field(..., description="Reaction object that was created.")
Successful response
63class AsyncReactionResource: 64 def __init__(self, http: HttpClient): 65 self._http = http 66 67 async def remove(self, message: str) -> None: 68 """ 69 Remove a reaction from a thread message 70 Removes the authenticated user's emoji reaction from the specified thread 71 message. The reaction is identified by the combination of the message ID and 72 the emoji; only the reaction belonging to the calling user is removed. 73 Returns 204 No Content on success. Returns 404 if no matching reaction 74 exists for the user and emoji on that message, or if the message itself 75 cannot be found. The authenticated user must have read access to the thread 76 containing the message. 77 78 Args: 79 message: Message ID (`msg_...`) of the thread message whose reaction should be removed. 80 81 Returns: 82 Empty response body. HTTP 204 No Content on success. 83 """ 84 await self._http.request(f"/api/v1/thread_messages/{message}/reactions", method="DELETE") 85 86 async def create(self, message: str, input: ReactionCreateInput) -> ReactionCreateResponse: 87 """ 88 Add a reaction to a thread message 89 Adds an emoji reaction to the specified thread message on behalf of the 90 authenticated user. If the user has already reacted to the message with the 91 same emoji, the request returns a 409 Conflict rather than creating a 92 duplicate. 93 The authenticated user must have read access to the thread containing the 94 message. If the thread belongs to a team, the user must be a member of 95 that team. 96 97 Args: 98 message: Message ID (`msg_...`) of the thread message whose reaction should be removed. 99 input: Request body. 100 input.emoji: Emoji character or shortcode to add as a reaction, e.g. `" "` or `":thumbsup:"`. 101 102 Returns: 103 Successful response 104 """ 105 return await self._http.request( 106 f"/api/v1/thread_messages/{message}/reactions", 107 method="POST", 108 body=input, 109 response_type=ReactionCreateResponse, 110 )
67 async def remove(self, message: str) -> None: 68 """ 69 Remove a reaction from a thread message 70 Removes the authenticated user's emoji reaction from the specified thread 71 message. The reaction is identified by the combination of the message ID and 72 the emoji; only the reaction belonging to the calling user is removed. 73 Returns 204 No Content on success. Returns 404 if no matching reaction 74 exists for the user and emoji on that message, or if the message itself 75 cannot be found. The authenticated user must have read access to the thread 76 containing the message. 77 78 Args: 79 message: Message ID (`msg_...`) of the thread message whose reaction should be removed. 80 81 Returns: 82 Empty response body. HTTP 204 No Content on success. 83 """ 84 await self._http.request(f"/api/v1/thread_messages/{message}/reactions", method="DELETE")
Remove a reaction from a thread message Removes the authenticated user's emoji reaction from the specified thread message. The reaction is identified by the combination of the message ID and the emoji; only the reaction belonging to the calling user is removed. Returns 204 No Content on success. Returns 404 if no matching reaction exists for the user and emoji on that message, or if the message itself cannot be found. The authenticated user must have read access to the thread containing the message.
Arguments:
- message: Message ID (
msg_...) of the thread message whose reaction should be removed.
Returns:
Empty response body. HTTP 204 No Content on success.
86 async def create(self, message: str, input: ReactionCreateInput) -> ReactionCreateResponse: 87 """ 88 Add a reaction to a thread message 89 Adds an emoji reaction to the specified thread message on behalf of the 90 authenticated user. If the user has already reacted to the message with the 91 same emoji, the request returns a 409 Conflict rather than creating a 92 duplicate. 93 The authenticated user must have read access to the thread containing the 94 message. If the thread belongs to a team, the user must be a member of 95 that team. 96 97 Args: 98 message: Message ID (`msg_...`) of the thread message whose reaction should be removed. 99 input: Request body. 100 input.emoji: Emoji character or shortcode to add as a reaction, e.g. `" "` or `":thumbsup:"`. 101 102 Returns: 103 Successful response 104 """ 105 return await self._http.request( 106 f"/api/v1/thread_messages/{message}/reactions", 107 method="POST", 108 body=input, 109 response_type=ReactionCreateResponse, 110 )
Add a reaction to a thread message Adds an emoji reaction to the specified thread message on behalf of the authenticated user. If the user has already reacted to the message with the same emoji, the request returns a 409 Conflict rather than creating a duplicate. The authenticated user must have read access to the thread containing the message. If the thread belongs to a team, the user must be a member of that team.
Arguments:
- message: Message ID (
msg_...) of the thread message whose reaction should be removed. - input: Request body.
- input.emoji: Emoji character or shortcode to add as a reaction, e.g.
" "or":thumbsup:".
Returns:
Successful response
113class AsyncThreadMessageResource: 114 def __init__(self, http: HttpClient): 115 self._http = http 116 self.reactions = AsyncReactionResource(http) 117 118 async def delete(self, message: str) -> None: 119 """ 120 Delete a thread message 121 Permanently removes the specified message from its thread. This action 122 cannot be undone. 123 A regular user may only delete messages they authored. Service-to-service 124 callers with elevated (`all_powerful`) scope may delete any message in a 125 thread they can access. Returns `403 Forbidden` when the caller does not 126 own the message. 127 128 Args: 129 message: ID of the message to delete (`msg_...`). 130 131 Returns: 132 Empty body. The server responds with HTTP 204 No Content on success. 133 """ 134 await self._http.request(f"/api/v1/thread_messages/{message}", method="DELETE") 135 136 async def replace(self, message: str, input: ThreadMessageReplaceInput) -> Message: 137 """ 138 Update a thread message 139 Edits the content of an existing thread message and returns the updated 140 message object. 141 A regular user may only edit messages they authored. Service-to-service 142 callers with elevated (`all_powerful`) scope may edit any accessible message 143 without an ownership check. Returns `403 Forbidden` when the caller does not 144 own the message. 145 146 Args: 147 message: ID of the message to update (`msg_...`). 148 input: Request body. 149 input.content: Replacement text content for the message. Omit to leave the content unchanged. 150 151 Returns: 152 The updated message object reflecting the new content. 153 """ 154 return await self._http.request( 155 f"/api/v1/thread_messages/{message}", 156 method="PUT", 157 body=input, 158 response_type=Message, 159 ) 160 161 async def replies( 162 self, 163 message: str, 164 *, 165 before_cursor: str | None = None, 166 after_cursor: str | None = None, 167 limit: int | None = None, 168 tree: bool | None = None, 169 ) -> PaginatedReplies: 170 """ 171 List replies to a thread message 172 Returns a cursor-paginated list of reply messages for the specified thread 173 message. By default only direct (first-level) replies are returned. Set 174 `tree` to `true` to retrieve the full nested reply tree in a flat list, 175 ordered by creation time ascending. 176 The authenticated user must have access to the thread that contains the 177 message. If the message belongs to a team-scoped thread, the viewer is 178 automatically scoped to that team before the query executes. 179 Use `before_cursor` and `after_cursor` together with `limit` to page 180 through large reply threads. The `has_more` field in the response 181 indicates whether additional pages exist. 182 183 Args: 184 message: ID of the thread message to fetch replies for (`msg_...`). 185 before_cursor: Opaque pagination cursor. Returns replies created before this point. Obtain from `before_cursor` in a previous response. 186 after_cursor: Opaque pagination cursor. Returns replies created after this point. Obtain from `after_cursor` in a previous response. 187 limit: Maximum number of replies to return per page. Defaults to 20. 188 tree: When `true`, returns all replies in the nested reply tree (flattened). When `false` or omitted, returns only direct replies to the message. 189 190 Returns: 191 Cursor-paginated list of reply messages for the requested thread message. 192 """ 193 query: dict[str, object] = {} 194 if before_cursor is not None: 195 query["before_cursor"] = before_cursor 196 if after_cursor is not None: 197 query["after_cursor"] = after_cursor 198 if limit is not None: 199 query["limit"] = limit 200 if tree is not None: 201 query["tree"] = tree 202 return await self._http.request( 203 f"/api/v1/thread_messages/{message}/replies", 204 query=query, 205 response_type=PaginatedReplies, 206 )
118 async def delete(self, message: str) -> None: 119 """ 120 Delete a thread message 121 Permanently removes the specified message from its thread. This action 122 cannot be undone. 123 A regular user may only delete messages they authored. Service-to-service 124 callers with elevated (`all_powerful`) scope may delete any message in a 125 thread they can access. Returns `403 Forbidden` when the caller does not 126 own the message. 127 128 Args: 129 message: ID of the message to delete (`msg_...`). 130 131 Returns: 132 Empty body. The server responds with HTTP 204 No Content on success. 133 """ 134 await self._http.request(f"/api/v1/thread_messages/{message}", method="DELETE")
Delete a thread message
Permanently removes the specified message from its thread. This action
cannot be undone.
A regular user may only delete messages they authored. Service-to-service
callers with elevated (all_powerful) scope may delete any message in a
thread they can access. Returns 403 Forbidden when the caller does not
own the message.
Arguments:
- message: ID of the message to delete (
msg_...).
Returns:
Empty body. The server responds with HTTP 204 No Content on success.
136 async def replace(self, message: str, input: ThreadMessageReplaceInput) -> Message: 137 """ 138 Update a thread message 139 Edits the content of an existing thread message and returns the updated 140 message object. 141 A regular user may only edit messages they authored. Service-to-service 142 callers with elevated (`all_powerful`) scope may edit any accessible message 143 without an ownership check. Returns `403 Forbidden` when the caller does not 144 own the message. 145 146 Args: 147 message: ID of the message to update (`msg_...`). 148 input: Request body. 149 input.content: Replacement text content for the message. Omit to leave the content unchanged. 150 151 Returns: 152 The updated message object reflecting the new content. 153 """ 154 return await self._http.request( 155 f"/api/v1/thread_messages/{message}", 156 method="PUT", 157 body=input, 158 response_type=Message, 159 )
Update a thread message
Edits the content of an existing thread message and returns the updated
message object.
A regular user may only edit messages they authored. Service-to-service
callers with elevated (all_powerful) scope may edit any accessible message
without an ownership check. Returns 403 Forbidden when the caller does not
own the message.
Arguments:
- message: ID of the message to update (
msg_...). - input: Request body.
- input.content: Replacement text content for the message. Omit to leave the content unchanged.
Returns:
The updated message object reflecting the new content.
161 async def replies( 162 self, 163 message: str, 164 *, 165 before_cursor: str | None = None, 166 after_cursor: str | None = None, 167 limit: int | None = None, 168 tree: bool | None = None, 169 ) -> PaginatedReplies: 170 """ 171 List replies to a thread message 172 Returns a cursor-paginated list of reply messages for the specified thread 173 message. By default only direct (first-level) replies are returned. Set 174 `tree` to `true` to retrieve the full nested reply tree in a flat list, 175 ordered by creation time ascending. 176 The authenticated user must have access to the thread that contains the 177 message. If the message belongs to a team-scoped thread, the viewer is 178 automatically scoped to that team before the query executes. 179 Use `before_cursor` and `after_cursor` together with `limit` to page 180 through large reply threads. The `has_more` field in the response 181 indicates whether additional pages exist. 182 183 Args: 184 message: ID of the thread message to fetch replies for (`msg_...`). 185 before_cursor: Opaque pagination cursor. Returns replies created before this point. Obtain from `before_cursor` in a previous response. 186 after_cursor: Opaque pagination cursor. Returns replies created after this point. Obtain from `after_cursor` in a previous response. 187 limit: Maximum number of replies to return per page. Defaults to 20. 188 tree: When `true`, returns all replies in the nested reply tree (flattened). When `false` or omitted, returns only direct replies to the message. 189 190 Returns: 191 Cursor-paginated list of reply messages for the requested thread message. 192 """ 193 query: dict[str, object] = {} 194 if before_cursor is not None: 195 query["before_cursor"] = before_cursor 196 if after_cursor is not None: 197 query["after_cursor"] = after_cursor 198 if limit is not None: 199 query["limit"] = limit 200 if tree is not None: 201 query["tree"] = tree 202 return await self._http.request( 203 f"/api/v1/thread_messages/{message}/replies", 204 query=query, 205 response_type=PaginatedReplies, 206 )
List replies to a thread message
Returns a cursor-paginated list of reply messages for the specified thread
message. By default only direct (first-level) replies are returned. Set
tree to true to retrieve the full nested reply tree in a flat list,
ordered by creation time ascending.
The authenticated user must have access to the thread that contains the
message. If the message belongs to a team-scoped thread, the viewer is
automatically scoped to that team before the query executes.
Use before_cursor and after_cursor together with limit to page
through large reply threads. The has_more field in the response
indicates whether additional pages exist.
Arguments:
- message: ID of the thread message to fetch replies for (
msg_...). - before_cursor: Opaque pagination cursor. Returns replies created before this point. Obtain from
before_cursorin a previous response. - after_cursor: Opaque pagination cursor. Returns replies created after this point. Obtain from
after_cursorin a previous response. - limit: Maximum number of replies to return per page. Defaults to 20.
- tree: When
true, returns all replies in the nested reply tree (flattened). Whenfalseor omitted, returns only direct replies to the message.
Returns:
Cursor-paginated list of reply messages for the requested thread message.
209class ReactionResource: 210 def __init__(self, http: SyncHttpClient): 211 self._http = http 212 213 def remove(self, message: str) -> None: 214 """ 215 Remove a reaction from a thread message 216 Removes the authenticated user's emoji reaction from the specified thread 217 message. The reaction is identified by the combination of the message ID and 218 the emoji; only the reaction belonging to the calling user is removed. 219 Returns 204 No Content on success. Returns 404 if no matching reaction 220 exists for the user and emoji on that message, or if the message itself 221 cannot be found. The authenticated user must have read access to the thread 222 containing the message. 223 224 Args: 225 message: Message ID (`msg_...`) of the thread message whose reaction should be removed. 226 227 Returns: 228 Empty response body. HTTP 204 No Content on success. 229 """ 230 self._http.request(f"/api/v1/thread_messages/{message}/reactions", method="DELETE") 231 232 def create(self, message: str, input: ReactionCreateInput) -> ReactionCreateResponse: 233 """ 234 Add a reaction to a thread message 235 Adds an emoji reaction to the specified thread message on behalf of the 236 authenticated user. If the user has already reacted to the message with the 237 same emoji, the request returns a 409 Conflict rather than creating a 238 duplicate. 239 The authenticated user must have read access to the thread containing the 240 message. If the thread belongs to a team, the user must be a member of 241 that team. 242 243 Args: 244 message: Message ID (`msg_...`) of the thread message whose reaction should be removed. 245 input: Request body. 246 input.emoji: Emoji character or shortcode to add as a reaction, e.g. `" "` or `":thumbsup:"`. 247 248 Returns: 249 Successful response 250 """ 251 return self._http.request( 252 f"/api/v1/thread_messages/{message}/reactions", 253 method="POST", 254 body=input, 255 response_type=ReactionCreateResponse, 256 )
213 def remove(self, message: str) -> None: 214 """ 215 Remove a reaction from a thread message 216 Removes the authenticated user's emoji reaction from the specified thread 217 message. The reaction is identified by the combination of the message ID and 218 the emoji; only the reaction belonging to the calling user is removed. 219 Returns 204 No Content on success. Returns 404 if no matching reaction 220 exists for the user and emoji on that message, or if the message itself 221 cannot be found. The authenticated user must have read access to the thread 222 containing the message. 223 224 Args: 225 message: Message ID (`msg_...`) of the thread message whose reaction should be removed. 226 227 Returns: 228 Empty response body. HTTP 204 No Content on success. 229 """ 230 self._http.request(f"/api/v1/thread_messages/{message}/reactions", method="DELETE")
Remove a reaction from a thread message Removes the authenticated user's emoji reaction from the specified thread message. The reaction is identified by the combination of the message ID and the emoji; only the reaction belonging to the calling user is removed. Returns 204 No Content on success. Returns 404 if no matching reaction exists for the user and emoji on that message, or if the message itself cannot be found. The authenticated user must have read access to the thread containing the message.
Arguments:
- message: Message ID (
msg_...) of the thread message whose reaction should be removed.
Returns:
Empty response body. HTTP 204 No Content on success.
232 def create(self, message: str, input: ReactionCreateInput) -> ReactionCreateResponse: 233 """ 234 Add a reaction to a thread message 235 Adds an emoji reaction to the specified thread message on behalf of the 236 authenticated user. If the user has already reacted to the message with the 237 same emoji, the request returns a 409 Conflict rather than creating a 238 duplicate. 239 The authenticated user must have read access to the thread containing the 240 message. If the thread belongs to a team, the user must be a member of 241 that team. 242 243 Args: 244 message: Message ID (`msg_...`) of the thread message whose reaction should be removed. 245 input: Request body. 246 input.emoji: Emoji character or shortcode to add as a reaction, e.g. `" "` or `":thumbsup:"`. 247 248 Returns: 249 Successful response 250 """ 251 return self._http.request( 252 f"/api/v1/thread_messages/{message}/reactions", 253 method="POST", 254 body=input, 255 response_type=ReactionCreateResponse, 256 )
Add a reaction to a thread message Adds an emoji reaction to the specified thread message on behalf of the authenticated user. If the user has already reacted to the message with the same emoji, the request returns a 409 Conflict rather than creating a duplicate. The authenticated user must have read access to the thread containing the message. If the thread belongs to a team, the user must be a member of that team.
Arguments:
- message: Message ID (
msg_...) of the thread message whose reaction should be removed. - input: Request body.
- input.emoji: Emoji character or shortcode to add as a reaction, e.g.
" "or":thumbsup:".
Returns:
Successful response
259class ThreadMessageResource: 260 def __init__(self, http: SyncHttpClient): 261 self._http = http 262 self.reactions = ReactionResource(http) 263 264 def delete(self, message: str) -> None: 265 """ 266 Delete a thread message 267 Permanently removes the specified message from its thread. This action 268 cannot be undone. 269 A regular user may only delete messages they authored. Service-to-service 270 callers with elevated (`all_powerful`) scope may delete any message in a 271 thread they can access. Returns `403 Forbidden` when the caller does not 272 own the message. 273 274 Args: 275 message: ID of the message to delete (`msg_...`). 276 277 Returns: 278 Empty body. The server responds with HTTP 204 No Content on success. 279 """ 280 self._http.request(f"/api/v1/thread_messages/{message}", method="DELETE") 281 282 def replace(self, message: str, input: ThreadMessageReplaceInput) -> Message: 283 """ 284 Update a thread message 285 Edits the content of an existing thread message and returns the updated 286 message object. 287 A regular user may only edit messages they authored. Service-to-service 288 callers with elevated (`all_powerful`) scope may edit any accessible message 289 without an ownership check. Returns `403 Forbidden` when the caller does not 290 own the message. 291 292 Args: 293 message: ID of the message to update (`msg_...`). 294 input: Request body. 295 input.content: Replacement text content for the message. Omit to leave the content unchanged. 296 297 Returns: 298 The updated message object reflecting the new content. 299 """ 300 return self._http.request( 301 f"/api/v1/thread_messages/{message}", 302 method="PUT", 303 body=input, 304 response_type=Message, 305 ) 306 307 def replies( 308 self, 309 message: str, 310 *, 311 before_cursor: str | None = None, 312 after_cursor: str | None = None, 313 limit: int | None = None, 314 tree: bool | None = None, 315 ) -> PaginatedReplies: 316 """ 317 List replies to a thread message 318 Returns a cursor-paginated list of reply messages for the specified thread 319 message. By default only direct (first-level) replies are returned. Set 320 `tree` to `true` to retrieve the full nested reply tree in a flat list, 321 ordered by creation time ascending. 322 The authenticated user must have access to the thread that contains the 323 message. If the message belongs to a team-scoped thread, the viewer is 324 automatically scoped to that team before the query executes. 325 Use `before_cursor` and `after_cursor` together with `limit` to page 326 through large reply threads. The `has_more` field in the response 327 indicates whether additional pages exist. 328 329 Args: 330 message: ID of the thread message to fetch replies for (`msg_...`). 331 before_cursor: Opaque pagination cursor. Returns replies created before this point. Obtain from `before_cursor` in a previous response. 332 after_cursor: Opaque pagination cursor. Returns replies created after this point. Obtain from `after_cursor` in a previous response. 333 limit: Maximum number of replies to return per page. Defaults to 20. 334 tree: When `true`, returns all replies in the nested reply tree (flattened). When `false` or omitted, returns only direct replies to the message. 335 336 Returns: 337 Cursor-paginated list of reply messages for the requested thread message. 338 """ 339 query: dict[str, object] = {} 340 if before_cursor is not None: 341 query["before_cursor"] = before_cursor 342 if after_cursor is not None: 343 query["after_cursor"] = after_cursor 344 if limit is not None: 345 query["limit"] = limit 346 if tree is not None: 347 query["tree"] = tree 348 return self._http.request( 349 f"/api/v1/thread_messages/{message}/replies", 350 query=query, 351 response_type=PaginatedReplies, 352 )
264 def delete(self, message: str) -> None: 265 """ 266 Delete a thread message 267 Permanently removes the specified message from its thread. This action 268 cannot be undone. 269 A regular user may only delete messages they authored. Service-to-service 270 callers with elevated (`all_powerful`) scope may delete any message in a 271 thread they can access. Returns `403 Forbidden` when the caller does not 272 own the message. 273 274 Args: 275 message: ID of the message to delete (`msg_...`). 276 277 Returns: 278 Empty body. The server responds with HTTP 204 No Content on success. 279 """ 280 self._http.request(f"/api/v1/thread_messages/{message}", method="DELETE")
Delete a thread message
Permanently removes the specified message from its thread. This action
cannot be undone.
A regular user may only delete messages they authored. Service-to-service
callers with elevated (all_powerful) scope may delete any message in a
thread they can access. Returns 403 Forbidden when the caller does not
own the message.
Arguments:
- message: ID of the message to delete (
msg_...).
Returns:
Empty body. The server responds with HTTP 204 No Content on success.
282 def replace(self, message: str, input: ThreadMessageReplaceInput) -> Message: 283 """ 284 Update a thread message 285 Edits the content of an existing thread message and returns the updated 286 message object. 287 A regular user may only edit messages they authored. Service-to-service 288 callers with elevated (`all_powerful`) scope may edit any accessible message 289 without an ownership check. Returns `403 Forbidden` when the caller does not 290 own the message. 291 292 Args: 293 message: ID of the message to update (`msg_...`). 294 input: Request body. 295 input.content: Replacement text content for the message. Omit to leave the content unchanged. 296 297 Returns: 298 The updated message object reflecting the new content. 299 """ 300 return self._http.request( 301 f"/api/v1/thread_messages/{message}", 302 method="PUT", 303 body=input, 304 response_type=Message, 305 )
Update a thread message
Edits the content of an existing thread message and returns the updated
message object.
A regular user may only edit messages they authored. Service-to-service
callers with elevated (all_powerful) scope may edit any accessible message
without an ownership check. Returns 403 Forbidden when the caller does not
own the message.
Arguments:
- message: ID of the message to update (
msg_...). - input: Request body.
- input.content: Replacement text content for the message. Omit to leave the content unchanged.
Returns:
The updated message object reflecting the new content.
307 def replies( 308 self, 309 message: str, 310 *, 311 before_cursor: str | None = None, 312 after_cursor: str | None = None, 313 limit: int | None = None, 314 tree: bool | None = None, 315 ) -> PaginatedReplies: 316 """ 317 List replies to a thread message 318 Returns a cursor-paginated list of reply messages for the specified thread 319 message. By default only direct (first-level) replies are returned. Set 320 `tree` to `true` to retrieve the full nested reply tree in a flat list, 321 ordered by creation time ascending. 322 The authenticated user must have access to the thread that contains the 323 message. If the message belongs to a team-scoped thread, the viewer is 324 automatically scoped to that team before the query executes. 325 Use `before_cursor` and `after_cursor` together with `limit` to page 326 through large reply threads. The `has_more` field in the response 327 indicates whether additional pages exist. 328 329 Args: 330 message: ID of the thread message to fetch replies for (`msg_...`). 331 before_cursor: Opaque pagination cursor. Returns replies created before this point. Obtain from `before_cursor` in a previous response. 332 after_cursor: Opaque pagination cursor. Returns replies created after this point. Obtain from `after_cursor` in a previous response. 333 limit: Maximum number of replies to return per page. Defaults to 20. 334 tree: When `true`, returns all replies in the nested reply tree (flattened). When `false` or omitted, returns only direct replies to the message. 335 336 Returns: 337 Cursor-paginated list of reply messages for the requested thread message. 338 """ 339 query: dict[str, object] = {} 340 if before_cursor is not None: 341 query["before_cursor"] = before_cursor 342 if after_cursor is not None: 343 query["after_cursor"] = after_cursor 344 if limit is not None: 345 query["limit"] = limit 346 if tree is not None: 347 query["tree"] = tree 348 return self._http.request( 349 f"/api/v1/thread_messages/{message}/replies", 350 query=query, 351 response_type=PaginatedReplies, 352 )
List replies to a thread message
Returns a cursor-paginated list of reply messages for the specified thread
message. By default only direct (first-level) replies are returned. Set
tree to true to retrieve the full nested reply tree in a flat list,
ordered by creation time ascending.
The authenticated user must have access to the thread that contains the
message. If the message belongs to a team-scoped thread, the viewer is
automatically scoped to that team before the query executes.
Use before_cursor and after_cursor together with limit to page
through large reply threads. The has_more field in the response
indicates whether additional pages exist.
Arguments:
- message: ID of the thread message to fetch replies for (
msg_...). - before_cursor: Opaque pagination cursor. Returns replies created before this point. Obtain from
before_cursorin a previous response. - after_cursor: Opaque pagination cursor. Returns replies created after this point. Obtain from
after_cursorin a previous response. - limit: Maximum number of replies to return per page. Defaults to 20.
- tree: When
true, returns all replies in the nested reply tree (flattened). Whenfalseor omitted, returns only direct replies to the message.
Returns:
Cursor-paginated list of reply messages for the requested thread message.