Retrieves list of messages from messaging/chat datasources (e.g. Slack, Teams).
from glean.api_client import Glean, models
import os
with Glean(
api_token=os.getenv("GLEAN_API_TOKEN", ""),
) as glean:
res = glean.client.messages.retrieve(id_type=models.IDType.CONVERSATION_ID, id="<id>", datasource=models.Datasource.GCHAT)
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
id_type |
models.IDType |
✔️ |
Type of the id in the incoming request. |
id |
str |
✔️ |
ID corresponding to the requested idType. Note that channel and threads are represented by the underlying datasource's ID and conversations are represented by their document's ID. |
datasource |
models.Datasource |
✔️ |
The type of the data source. |
locale |
Optional[str] |
➖ |
The client's preferred locale in rfc5646 format (e.g. en, ja, pt-BR). If omitted, the Accept-Language will be used. If not present or not supported, defaults to the closest match or en. |
workspace_id |
Optional[str] |
➖ |
Id for the for the workspace in case of multiple workspaces. |
direction |
Optional[models.Direction] |
➖ |
The direction of the results asked with respect to the reference timestamp. Missing field defaults to OLDER. Only applicable when using a message_id. |
timestamp_millis |
Optional[int] |
➖ |
Timestamp in millis of the reference message. Only applicable when using a message_id. |
include_root_message |
Optional[bool] |
➖ |
Whether to include root message in response. |
datasource_instance_display_name |
Optional[str] |
➖ |
The datasource instance display name from which the document was extracted. This is used for appinstance facet filter for datasources that support multiple instances. |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.MessagesResponse
| Error Type |
Status Code |
Content Type |
| errors.GleanError |
4XX, 5XX |
*/* |