How to fetch a unread messages of the group channels of a user with limit and offset?
Can someone post a api query how it can be done?
Thanks in Advance.
How to fetch a unread messages of the group channels of a user with limit and offset?
Can someone post a api query how it can be done?
Thanks in Advance.
Hi @BCH - thank you for reaching out to Sendbird!
Are you looking to retrieve the messages that the specific user has not read or the messages sent by the user that are unread?
Seems like you are looking for previous message query. It doesn’t have a filter to fetch the unread messages only.
Understanding your use case will help suggest other solutions. Are you open to using Platform API or JS SDK only?
Hi @taha.saghir ,
Thanks for your response.
Our use case is One user is part of multiple group channels and has unread messages from other users in the group channels.
Lets a User A is part of 100 group channels and has messages sent by other users in all hundred group channels.
I want to query using send bird platform api to pull the unread message count from the group channels.
Want pull first 20 group channels which has highest unread messages and pull the next 20 when the user moves from the page to page.
We are using this GET https://api-{application_id}.sendbird.com/v3/users/{user_id}/my_group_channels?limit=20&query_type=OR&unread_filter=unread_message"
how to fetch the next 20?
Let me know if any other info is needed
Hi @BCH,
Please refer to the next
property in the service response.
The value that can be used in the
token
parameter to retrieve the next page in the result set.
Thanks @taha.saghir … I will verify it
Hi @taha.saghir ,
I have checked the api and working fine.
https://api-{0}.sendbird.com/v3/users/{userid}/my_group_channels?limit=10&token=blahblah&query_type=OR&unread_filter=unread_message
is working to move forward.
Lets say I fetch 10 per page, after fetching next 10 - how should I go back to fetch first 10 again?
You can do that by removing the token param or leaving it blank.
Thanks @taha.saghir … What I meant was is there anything like before parameter like next .
I think we need to store the next value for every fetch query, before and after need to be fetched based on that.
One more question - Is there any api that I can make the Mark all messages read in the channel for a user?
Hi @BCH - there is no API level iterator to go back, you will have to manage it on your end.
Here is the API to mark all messages read.
Thank you for your responses @taha.saghir . This info is really helpful.
Hi @taha.saghir ,
Hopefully this is my last doubt in this thread.
How to sort by the unread messages descending order in the my_group_channels api ?
Anytime @BCH, here to help!
my_group_channels
API is to list the channels. To get the message, use the list messages API. Please refer to the reverse
parameter.
Hi @taha.saghir ,
Thanks for your response.
To get the message, use the list messages API. Please refer to the reverse
parameter.
Here the url is expecting channelurl but i want the unread messages of all the channels that user is part of and in unread count descending order.
Here is the API to mark all messages read. How many channel_urls i can pass in the request body?
Hi @BCH – sorry for the delay in getting back to you.
Here are the responses:
Thank you for your response @taha.saghir