# How to use createMessage.optimistically?

**URL:** https://forum.social.plus/t/how-to-use-createmessage-optimistically/1397
**Category:** TS SDK
**Created:** [July 16, 2024, 9:25pm UTC](https://forum.social.plus/t/how-to-use-createmessage-optimistically/1397 "2024-07-16T21:25:26Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![amezal](https://avatars.discourse-cdn.com/v4/letter/a/848f3c/32.png) [@amezal](https://forum.social.plus/u/amezal)
#### Post date: [July 16, 2024, 9:25pm UTC](https://forum.social.plus/t/how-to-use-createmessage-optimistically/1397/1 "2024-07-16T21:25:26Z")

</div>

I’m trying to create a message locally to display a ‘sending’ message status on the app I’m working on. Using `MessageRepository.sendMessage` doesn’t cut it, as it only updates the messages live object once the message has been sent and has gotten an acknowledge response from the server. I’m trying to use `MessageRepository.sendMessage.optimistically`, and it does seem to create a message, it’s id is prefixed with `LOCAL_`, but it doesn’t send a request and doesn’t update the messages LiveObject. Please help, am I missing something? I’ve looked through the docs and source code but can’t get it to work.

---

<div class="post-metadata">

### Author: ![SocialPlus\_Support](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.social.plus/socialplus_support/32/798_2.png) [@SocialPlus\_Support](https://forum.social.plus/u/SocialPlus_Support)
#### Post date: [July 17, 2024, 2:28am UTC](https://forum.social.plus/t/how-to-use-createmessage-optimistically/1397/2 "2024-07-17T02:28:31Z")

</div>

@amezal Could you please specify which platform and version you are using?

---

<div class="post-metadata">

### Author: ![amezal](https://avatars.discourse-cdn.com/v4/letter/a/848f3c/32.png) [@amezal](https://forum.social.plus/u/amezal)
#### Post date: [July 17, 2024, 2:56am UTC](https://forum.social.plus/t/how-to-use-createmessage-optimistically/1397/3 "2024-07-17T02:56:15Z")

</div>

Sure! I’m using version 2.25.2 of the ts-sdk, paired with React

---

<div class="post-metadata">

### Author: ![SocialPlus\_Support](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.social.plus/socialplus_support/32/798_2.png) [@SocialPlus\_Support](https://forum.social.plus/u/SocialPlus_Support)
#### Post date: [July 17, 2024, 3:38am UTC](https://forum.social.plus/t/how-to-use-createmessage-optimistically/1397/4 "2024-07-17T03:38:30Z")

</div>

@amezal Can you confirm the TS SDK version you are using? Please refer to this link for details: [TS SDK Changelogs and Versioning](https://docs.amity.co/amity-sdk/changelogs-and-versioning/ts).

---

<div class="post-metadata">

### Author: ![amezal](https://avatars.discourse-cdn.com/v4/letter/a/848f3c/32.png) [@amezal](https://forum.social.plus/u/amezal)
#### Post date: [July 17, 2024, 4:13am UTC](https://forum.social.plus/t/how-to-use-createmessage-optimistically/1397/5 "2024-07-17T04:13:13Z")

</div>

Yes, I’m sorry, it was a typo, I meant 6.25.2

---

<div class="post-metadata">

### Author: ![SocialPlus\_Support](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.social.plus/socialplus_support/32/798_2.png) [@SocialPlus\_Support](https://forum.social.plus/u/SocialPlus_Support)
#### Post date: [July 17, 2024, 4:16am UTC](https://forum.social.plus/t/how-to-use-createmessage-optimistically/1397/6 "2024-07-17T04:16:08Z")

</div>

@amezal Thank you for your information, I will pass to our team to check on this.

---

<div class="post-metadata">

### Author: ![SocialPlus\_Support](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.social.plus/socialplus_support/32/798_2.png) [@SocialPlus\_Support](https://forum.social.plus/u/SocialPlus_Support)
#### Post date: [July 17, 2024, 7:34am UTC](https://forum.social.plus/t/how-to-use-createmessage-optimistically/1397/7 "2024-07-17T07:34:23Z")

</div>

Hello @amezal , Could you please provide the document you mentioned for further check?

---

<div class="post-metadata">

### Author: ![amezal](https://avatars.discourse-cdn.com/v4/letter/a/848f3c/32.png) [@amezal](https://forum.social.plus/u/amezal)
#### Post date: [July 17, 2024, 12:26pm UTC](https://forum.social.plus/t/how-to-use-createmessage-optimistically/1397/8 "2024-07-17T12:26:34Z")

</div>

Here.

> **[Send a Message | Amity Docs](https://docs.amity.co/amity-sdk/chat/messaging/send-a-message)**

The examples don’t include typescript, but I’m guessing the behavior should be similar anyways. Couldn’t find any examples or mentions of createMessage.optimistically but found the method on the source code and it says it creates an Amity message in cache.

---

<div class="post-metadata">

### Author: ![amezal](https://avatars.discourse-cdn.com/v4/letter/a/848f3c/32.png) [@amezal](https://forum.social.plus/u/amezal)
#### Post date: [July 18, 2024, 12:10pm UTC](https://forum.social.plus/t/how-to-use-createmessage-optimistically/1397/9 "2024-07-18T12:10:23Z")

</div>

Hello!  
Is there any updates?

---

<div class="post-metadata">

### Author: ![SocialPlus\_Support](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.social.plus/socialplus_support/32/798_2.png) [@SocialPlus\_Support](https://forum.social.plus/u/SocialPlus_Support)
#### Post date: [July 18, 2024, 1:05pm UTC](https://forum.social.plus/t/how-to-use-createmessage-optimistically/1397/10 "2024-07-18T13:05:18Z")

</div>

Hello, thank you for bringing this to our attention. Our team will update the documentation sample for the TypeScript SDK accordingly.

---

<div class="post-metadata">

### Author: ![amezal](https://avatars.discourse-cdn.com/v4/letter/a/848f3c/32.png) [@amezal](https://forum.social.plus/u/amezal)
#### Post date: [July 18, 2024, 2:07pm UTC](https://forum.social.plus/t/how-to-use-createmessage-optimistically/1397/11 "2024-07-18T14:07:28Z")

</div>

Nice! Can I get a brief of how I’m supposed to use it in the meantime? I need this feature done by next week

---

<div class="post-metadata">

### Author: ![SocialPlus\_Support](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.social.plus/socialplus_support/32/798_2.png) [@SocialPlus\_Support](https://forum.social.plus/u/SocialPlus_Support)
#### Post date: [July 19, 2024, 8:57am UTC](https://forum.social.plus/t/how-to-use-createmessage-optimistically/1397/12 "2024-07-19T08:57:52Z")

</div>

Hello, our team is currently working on providing the code. We will update the documentation as soon as it becomes available. Thank you for your patience.

---

<div class="post-metadata">

### Author: ![SocialPlus\_Support](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.social.plus/socialplus_support/32/798_2.png) [@SocialPlus\_Support](https://forum.social.plus/u/SocialPlus_Support)
#### Post date: [July 24, 2024, 6:31am UTC](https://forum.social.plus/t/how-to-use-createmessage-optimistically/1397/13 "2024-07-24T06:31:24Z")

</div>

Hello @amezal , We have updated the documentation. Please check the updated information at this link: [Send a Message - Message Synchronization](https://docs.amity.co/amity-sdk/chat/messaging/send-a-message#message-synchronization)

---

<div class="post-metadata">

### Author: ![amezal](https://avatars.discourse-cdn.com/v4/letter/a/848f3c/32.png) [@amezal](https://forum.social.plus/u/amezal)
#### Post date: [July 24, 2024, 12:26pm UTC](https://forum.social.plus/t/how-to-use-createmessage-optimistically/1397/14 "2024-07-24T12:26:00Z")

</div>

Thank you guys, appreciate it!
