# Is there a way to get messages from a group channel with access code without join?

**URL:** https://community.sendbird.com/t/is-there-a-way-to-get-messages-from-a-group-channel-with-access-code-without-join/3853
**Category:** JavaScript
**Tags:** group-channel
**Created:** [January 26, 2022, 11:47pm UTC](https://community.sendbird.com/t/is-there-a-way-to-get-messages-from-a-group-channel-with-access-code-without-join/3853 "2022-01-26T23:47:59Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Eueddem\_Kim](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/eueddem_kim/32/2007_2.png) [@Eueddem\_Kim](https://community.sendbird.com/u/Eueddem_Kim)
#### Post date: [January 26, 2022, 11:47pm UTC](https://community.sendbird.com/t/is-there-a-way-to-get-messages-from-a-group-channel-with-access-code-without-join/3853/1 "2022-01-26T23:47:59Z")

</div>

Hello,

I’m trying to implement read-only (or preview) mode, which shows messages from a specific group channel which needs access code before/without join. Is there a way to do this?  
(I saw this from the community, I’d like to do something similar - [Private Channel Preview UI Component](https://community.sendbird.com/t/private-channel-preview-ui-component/2449) - reading Tyler’s comment, it seems there is a way to achieve, but I can’t find any)

I tried this:

> ```
> const listQuery = groupChannel.createPreviousMessageListQuery();
> listQuery.load(100, false, "", (messages, error) => {
> if (error) {
> console.error("Load error", error);
> return;
> }
> 
> console.log("Load previous messages", messages);
> });
> 
> ```

but it returns _Uncaught (in promise) SendBirdException: Not a member._ exception only.  
API call returns:

> {  
> message: “Not authorized. “Channel has access code”.”,  
> code: 400108,  
> error: true  
> }

Thanks,  
Eueddem

---

<div class="post-metadata">

### Author: ![Tyler](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/tyler/32/810_2.png) [@Tyler](https://community.sendbird.com/u/Tyler)
#### Post date: [January 27, 2022, 3:11pm UTC](https://community.sendbird.com/t/is-there-a-way-to-get-messages-from-a-group-channel-with-access-code-without-join/3853/2 "2022-01-27T15:11:58Z")

</div>

Hi @Eueddem_Kim,

Welcome to the Sendbird Community. In order to retrieve the messages of a channel that a user is not a part of, you would need to utilize the Platform API. Since this means exposing your API Token, we typically recommend creating wrapper functions that make a call to your own backend to obtain the messages. This would allow you to hide your `Api-Token` and ensure its not compromised.
