在 twilio 中获取未读消息的有效方法?

问题描述:

我正在尝试获取用户每个频道的未读消息数.参考 twilio docs 我得出的结论是,我需要从所有渠道获取所有消息,例如 currentChannel.getMessages().getLastConsumedIndex().从 lastConsumedIndex 我们需要计算未读消息.1. 获取未读消息计数的方法是否正确?如果是唯一的方法.现在只有一个通道需要一些时间来初始化.我认为获取所有未读消息计数需要更多时间.>

I am trying to get unread messages count for each channel of user.After referring twilio docs I came to conclusion that I need to get all messages from all channels like currentChannel.getMessages().getLastConsumedIndex().From that lastConsumedIndex we need to count unread messages. 1. Is it the correct way to get unread messages count ?If it is the only way.Now for only one channel it is taking some time to be initialized.I think it will take more time to get all unread messages count.

Twilio 开发人员布道者在这里.

Twilio developer evangelist here.

您可能对getUnconsumedMessageCount 通道对象上的方法.

Looks like you might be interested in the getUnconsumedMessageCount method on the channel object.