- Retrieve - Read messages
Retrieves list of messages from messaging/chat datasources (e.g. Slack, Teams).
package main
import(
"context"
"os"
apiclientgo "github.com/gleanwork/api-client-go"
"github.com/gleanwork/api-client-go/models/components"
"log"
)
func main() {
ctx := context.Background()
s := apiclientgo.New(
apiclientgo.WithSecurity(os.Getenv("GLEAN_API_TOKEN")),
)
res, err := s.Client.Messages.Retrieve(ctx, components.MessagesRequest{
IDType: components.IDTypeConversationID,
ID: "<id>",
Datasource: components.DatasourceGchat,
}, nil)
if err != nil {
log.Fatal(err)
}
if res.MessagesResponse != nil {
// handle response
}
}| Parameter | Type | Required | Description |
|---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
messagesRequest |
components.MessagesRequest | ✔️ | Includes request params such as the id for channel/message and direction. |
locale |
*string |
➖ | 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. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.MessagesResponse, error
| Error Type | Status Code | Content Type |
|---|---|---|
| apierrors.APIError | 4XX, 5XX | */* |