0

I'm struggling with the following problem. I'm using Twilio Conversations SDK: http://media.twiliocdn.com/sdk/js/conversations/releases/1.1.0/docs/

When I'm trying to set a conversation's lastReadMessageIndex the promise always return 0 (which should be the index)

Ways I have tried:

const conversation = this._client.getConversationBySid(sid);


const res = await conversation.updateLastReadMessageIndex(null) // returns 0

--- OR ---

const res = await conversation.setAllMessagesRead() // returns undefined

--- OR ---

const res = await conversation.updateLastReadMessageIndex(10000) // returns 0

After fetching conversation again the lastReadMessageIndex = null

Can anyone help?

Apród Illés
  • 266
  • 1
  • 12
  • I am pretty sure there is a bug in the sdk where `lastReadMessageIndex` is incorrectly set when the conversation is first loaded. I took a look at the data coming over the wire and there is a value `last_consumed_message_index` that is the correct. During initialization they are using the wrong property name (one that does not exist) and so `lastReadMessageIndex` is always set to null. I sent a message to support (not sure how bugs are supposed to be reported). I'll let you know if they get back to me. – Spencer Feb 05 '21 at 00:49

1 Answers1

0

According to the Twilio docs here :

If a Participant in a Conversation has no read status, their last-read index and timestamp will be null or 0. If the Read Horizon hasn't been set, the following methods will return null on all platforms (Android, iOS, JavaScript):

Conversation.getLastReadMessageIndex

Conversation.getUnreadMessagesCount (asynchronous, so null is passed to the listener)

Participant.getLastReadMessageIndex

Phil Dukhov
  • 67,741
  • 15
  • 184
  • 220