1

1) How we can update Twilio chat message body and attribute using iOS sdk? We need to edit message attributes after message sent so is this possible to edit message body by iOS sdk. I found update message body thind api doc for php but not for iOS so please help to do this.

2) How we can get Messages counter for read and unread messages for a User or channel?

1 Answers1

1

Twilio developer evangelist here.

  1. In the iOS SDK you can update a message body using updateBody:completion and you can update message attributes with setAttributes:completion.

  2. To get the number of unread messages for a channel you can use getUnconsumedMessagesCountWithCompletion and for the total messages in a channel you can use getMessagesCountWithCompletion.

Let me know if that helps at all.

philnash
  • 70,667
  • 10
  • 60
  • 88
  • Is it necessary to set the Consumption Horizon, how woudl you do this anyway with the Swift API? Also @philnash what defines an unconsumed message? Currently I send messages to a channel and before opening up my chat window I check the channel for unconsumed messages, but it always say no messages even if I call setNoMessagesConsumedWithCompletion. I am using the Swift API...can you help? What do I need to do to find out how many messages in my channel have not been read yet? At what point do they become read? (when the user opens up a chat channel and requests to getLastWithCount? – Ben Smith Aug 19 '18 at 16:44
  • Hi @BenSmith. That's a lot of questions. I reckon most can be answered with a read through the [consumption horizon documentation](https://www.twilio.com/docs/chat/consumption-horizon). If you have a specific questions about something that isn't working, then I recommend asking a new question on Stack Overflow. – philnash Aug 21 '18 at 21:55
  • Yes U fixed it now https://stackoverflow.com/questions/51919861/twilio-swift-api-get-consumed-messages-always-returns-0 – Ben Smith Sep 03 '18 at 10:17