Skip to content
gist.link ↗

searchMessages

Query Teams API — POST https://teams.api.gist.link/graphql

Case-insensitive substring search over chat message bodies in every channel and conversation the caller can see, newest first (max 50). Authenticated.

teams:query:searchMessages

The calling IAM key must hold this permission (or a wildcard that covers it: teams:query:* or teams:*) and the access token must have been minted with audience=teams. See Permissions.

type Query {
searchMessages(query: String!, first: Int): [ActivityItem!]!
}
Argument Type Required Description
query String! Yes —
first Int No —

[ActivityItem!]! — see the Teams types reference.

Terminal window
curl https://teams.api.gist.link/graphql \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H 'Content-Type: application/json' \
-d @- <<'JSON'
{
"query": "query SearchMessages($query: String!, $first: Int) { searchMessages(query: $query, first: $first) { message_id source_kind team_id team_name channel_id channel_name conversation_id conversation_title } }",
"variables": {
"query": "example",
"first": 10
}
}
JSON