List Twilio Chat Channel with last message
Asked Answered
P

0

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.

Paramorphism answered 14/10, 2020 at 8:22 Comment(3)
+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.Whiles
Did you get any solution?Tamera
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 #47297724Selfsuggestion

© 2022 - 2024 — McMap. All rights reserved.