6

I am building a chatting feature in my App, however, when I am trying to create an overview page similar to below

enter image description here

As you can see, I need to fetch a data which has all my channels and each channel has last message and another member's attribute.

I have been searching for this API in Twilio Doc, but it seems it's not there.

I tried to achieve this by using this SDK client List User Channel Descriptors

And RESTful API Read multiple UserChannel resources

However, I just couldn't get the last message of each channel. Am I looking into the wrong place?

Hopefully there will be answer for this, cheers.

蔡佳峰
  • 219
  • 3
  • 9
  • +1 for this. I'm also looking for a way to retrieve the user channels and with the last messages. Right now inside the channel got last message index but the message entity is empty. Imagine if the user has 50 channels, it not a good way to request the API to retrieve last message for each channel. – Faiz Dec 06 '20 at 07:59
  • Did you get any solution? – neelima Dec 09 '20 at 11:06
  • There is no straight forward way to get this done. You need to it manually one step at a time. Step 1. Load all user channels with the help of paginator Step 2. For each channel, fetch latest messages Step 3. Based on most recent message per channel, take this message's createdDate as attribute to sort these paginated channels. Not at all quick and efficient, right? Agreed but Twilio has no time to support this hot feature :) Refer to this for more details https://stackoverflow.com/questions/47297224/get-twilio-chat-user-channels-sorted-by-last-activity-or-unread-count – Pratap Singh Apr 12 '22 at 11:54

0 Answers0