diff --git a/src/pages/docs/chat/rooms/messages.mdx b/src/pages/docs/chat/rooms/messages.mdx index 17f96bf783..9ce6591c76 100644 --- a/src/pages/docs/chat/rooms/messages.mdx +++ b/src/pages/docs/chat/rooms/messages.mdx @@ -180,6 +180,50 @@ room.messages.send(text = "hello") ``` +## Get a single message + + +Use the [`messages.get()`](https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-js.Messages.html#get)[`messages.get()`](https://sdk.ably.com/builds/ably/ably-chat-swift/main/AblyChat/documentation/ablychat/messages/get%28serial%3A%29)[`messages.get()`](https://sdk.ably.com/builds/ably/ably-chat-kotlin/main/dokka/chat-android/com.ably.chat/-messages/get.html) method to get a message in a chat room. + + + +Use the [`getMessage()`](https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/interfaces/chat-react.UseMessagesResponse.html#getMessage) method available from the response of the `useMessages` hook to send a message to the room: + + + +```javascript +await room.messages.get(serial); +``` + +```react +import { useMessages } from '@ably/chat/react'; + +const MyComponent = () => { + const { getMessage } = useMessages(); + + const handleMessageSend = () => { + getMessage(serial); + }; + + return ( +
+ +
+ ); +}; +``` + +```swift +let message = try await room.messages.get(serial: serial) +``` + +```kotlin +room.messages.get(serial = serial) +``` +
+ + + ## Update a message