Get Twilio Chat User Channels sorted by last activity or unread count?

Viewed 1312

We are developing a chat system where users can be in many chat rooms, and I'd like to be able to show the most recent channels first.

This could be either by the time the last message was sent, or even by the number of unread messages, as long as there is some order and I don't need to go through all the pages of channels and get additional metadata to sort it manually.

I can't see any options in the docs and even though the response metadata has a "key" set to "channels", I haven't been able to figure out a query parameter that can change that.

It seems like channels will always be returned ordered by the random unique channel ID, so for pretty much every use case you'd need to get all channels and sort manually. Is that the case or am I missing something?

1 Answers

Twilio developer evangelist here.

I'm afraid you cannot order the channels within the API right now. This feature is on the roadmap though, however I can't give any time estimates for it.

The solution for now is sorting manually. I will update once that changes though.

Related