# ListChannelMessagesAsync returns empty array after sending a direct chat message

**URL:** <https://forum.heroiclabs.com/t/listchannelmessagesasync-returns-empty-array-after-sending-a-direct-chat-message/5808>\
**Category:** Client Libraries\
**Created:** [November 15, 2024, 9:32am UTC](https://forum.heroiclabs.com/t/listchannelmessagesasync-returns-empty-array-after-sending-a-direct-chat-message/5808 "2024-11-15T09:32:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vladislav-chunikhin](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/vladislav-chunikhin/32/2133_2.png) [@vladislav-chunikhin](https://forum.heroiclabs.com/u/vladislav-chunikhin)\
**Post date:** [November 15, 2024, 9:32am UTC](https://forum.heroiclabs.com/t/listchannelmessagesasync-returns-empty-array-after-sending-a-direct-chat-message/5808/1 "2024-11-15T09:32:01Z")

</div>

**Details:**

The WriteChatMessageAsync method successfully sends a message to a direct chat. The server responds correctly with details such as message\_id and channel\_id. However, when calling ListChannelMessagesAsync for the same channel, it returns an empty array.

**Env:**

Client SDK: Unity SDK

---

<div class="post-metadata">

**Author:** ![sesposito](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/sesposito/32/2594_2.png) [@sesposito](https://forum.heroiclabs.com/u/sesposito)\
**Post date:** [November 15, 2024, 10:17am UTC](https://forum.heroiclabs.com/t/listchannelmessagesasync-returns-empty-array-after-sending-a-direct-chat-message/5808/2 "2024-11-15T10:17:37Z")

</div>

Hello @vladislav-chunikhin,

Was the chat joined with the `persist` option to true? Otherwise the messages in the channel are ephemeral and won’t be persisted.

See here: [Real-time Chat - Heroic Labs Documentation](https://heroiclabs.com/docs/nakama/concepts/chat/#persistence)

Hope this clarifies.

---

<div class="post-metadata">

**Author:** ![vladislav-chunikhin](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/vladislav-chunikhin/32/2133_2.png) [@vladislav-chunikhin](https://forum.heroiclabs.com/u/vladislav-chunikhin)\
**Post date:** [November 15, 2024, 11:43am UTC](https://forum.heroiclabs.com/t/listchannelmessagesasync-returns-empty-array-after-sending-a-direct-chat-message/5808/3 "2024-11-15T11:43:14Z")

</div>

@sesposito Thank you! It works
