I’ve got a task to notify users about unread messages in group channels after N minutes. What’s the best way to do that?
I see that Sendbird has webhook about sent and read messages. I thought that I could save when the last message was sent and when the last time each member read messages. Then I could check the saved data every N minutes and send emails for members that have not read messages longer than N minutes.
Natively, there is no way to achieve this via Sendbird as we don’t track this type of data but rather only the total unread count. Your suggestion to utilize webhooks is typically what I recommend to customers when they’re looking to achieve this sort of functionality as it allows you to build out your own logic to trigger those notifications.
Hey Tyler, thanks for your reply! Do you have plans to implement such tracking?
I was thinking about another solution, like calling the API endpoint every minute to know the count of unread messages per member per channel and thus we could find members that have unread messages received approximately N minutes ago.
However, this means that we have to do channels_count * (members_in_channel_count / user_ids_limit) calls every minute that’s quite a lot. If we increase the timeout between calls we lose accuracy of the time when the first unread message was received.
And also there could be a case, when a member had 1 unread message N-1 minutes ago, then they read it and received another one, but for this implementation it would be considered as the same unread message.
We don’t currently have any plans to implement this type of granular tracking. It’s not a very comment function and not something we see requested often, if ever.
None of our unread message track actually tracks the specific messages that are unread and thus doesn’t have timestamp data. We track unread messages simply by how many messages have occurred since the users last read timestamp occurred. We definitely would not recommend polling the API as it’s not scalable within your rate limits. The Webhook method is likely the best bet as you’re not limited to a number of calls you can make per second.
We’ve been looking for a way to get unread counts for a list of channels via one api call for some time. So this is not supported? We are currently making an api call for each channel. Sometimes that list can go up to 50. This means we make 50 api calls each time to refresh the counts. We implemented this but are now getting rate limited.