What sort fields does the threads API support?
The threads GraphQL query accepts an optional sortBy argument with one of six field values:
CREATED_AT: when the thread was created.STATUS_CHANGED_AT: when the thread status last changed.PRIORITY: thread priority, from Urgent to High, Normal and Low.LAST_INBOUND_MESSAGE_AT: the most recent inbound message from the customer.CLOSEST_TO_BREACH_SLA: which thread's SLA is closest to breaching.THREAD_FIELD: a custom thread field value. Requires thethreadFieldKeyargument. Supports number and date field types.
Sorting by last activity in either direction
There is no sort field that covers both customer messages and team member replies. LAST_INBOUND_MESSAGE_AT only advances when a customer sends a message. An outbound reply from a team member does not update it. Instead, pick the closest option for your use case:
- Use
LAST_INBOUND_MESSAGE_ATto surface threads with recent customer activity. - Use
STATUS_CHANGED_ATas a rough proxy for recent team member activity, since thread status often changes alongside outbound replies, for example from Todo to Investigating.