1

When using Twilio Programmable Chat channel's 'sendMessage' method to send a message what is the best way to immediately retrieve the newly created message's sid and timestamp?

The promise it returns does not contain these values. I have a use case where I need to persist these messages in a separate data store and I need to track their original sid, index, and timestamp.

William Edmondson
  • 3,619
  • 3
  • 32
  • 41

1 Answers1

1

Twilio Developer Evangelist here

Using the JavaScript SDK you could use the Channel class which has a lastMessage property. The lastMessage consists of the sid, author and timestamp.

Here is a link to the documentation for the Channel class.

I hope that helps.

LaylaCodesIt
  • 156
  • 6
  • can you tell me how can we load the latest messages first. In our web app UI we placed chat input field first and chat messages below the input. So when the user enter a message we need to show the latest message he entered at first place. Can you please guide me. – Sankar Jul 17 '18 at 07:30