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?
Add chat functionality to your app or browser using Twilio’s API and trusted platform that power any conversational workflow. Create engaging chat experiences for apps and the web with one flexible API. Easily extend engagement to all your customers’ preferred channels.
Each client SDK provides a method allowing the User to send a Consumption Report which supplies the User's last consumed Message index for the Channel. Besides that, there are two helper methods for most common operations used in Consumption Horizon feature: marking all messages as read and marking them back unread.
Create engaging chat experiences for apps and the web with one flexible API. Easily extend engagement to all your customers’ preferred channels. All while Twilio’s trusted platform protects your relationships with best-in-class reliability. Drive two-way engagement with cross-channel messaging for in-app chat and more using a single API.
The User Channel resource of Programmable Chat is a read-only resource that describes a Channel that the User is a Member of. Each User Channel resource contains these properties. The SID of the Account that created the User Channel resource. The SID of the Service the User Channel resource is associated with.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With