copilotSessionMessages
Requires permission catalog:copilot:chat.
Messages of one of the caller's OWN chats that are older than before, oldest first. copilotSession returns only the newest window; this reads the rest.
Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.
Example:
- GraphQL
- cURL
query CopilotSessionMessages($before: ID!, $sessionId: ID!) {
copilotSessionMessages(before: $before, sessionId: $sessionId) {
hasMore
messages {
id
createdAt
cardIds
feedback
role
text
}
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "query CopilotSessionMessages($before: ID!, $sessionId: ID!) {\n copilotSessionMessages(before: $before, sessionId: $sessionId) {\n hasMore\n messages {\n id\n createdAt\n cardIds\n feedback\n role\n text\n }\n }\n}",
"variables": {
"before": "id",
"sessionId": "id"
}
}
EOF
Variables:
{
"before": "id",
"sessionId": "id"
}
Response:
{
"data": {
"copilotSessionMessages": {
"hasMore": true,
"messages": [
{
"id": "id",
"createdAt": 0,
"cardIds": [
"string"
],
"feedback": {},
"role": "string",
"text": "string"
}
]
}
}
}
copilotSessionMessages(
before: ID!
first: Int = 20
sessionId: ID!
): CopilotMessagePage!
Arguments
copilotSessionMessages.before ● ID! non-null scalar
Return only messages older than this message ID.
copilotSessionMessages.first ● Int scalar
The number of items to return.
copilotSessionMessages.sessionId ● ID! non-null scalar
The ID of the Copilot session.
Type
CopilotMessagePage object
Messages older than a given message, oldest first — reads a long chat back past its newest window.