How to specific channel access code when listing messages?

Hi there!

I’m creating group channels via API and use the access_code to create public, protected channels.
In a next step, I’m trying to list messages on those channels now using the API again but it fails with a “access denied” server response.

How can I hand over the group’s access code when using the API to list messages? Can’t find anything in the docs…

Thanks
Andreas

Hi Andreas,

If you have created a channel using an access code, you need to add the access code when joining the channel to join.

docs are here.

  • HTTP request
    https://api-{application_id}.sendbird.com/v3/group_channels/{channel_url}/join

  • Request body example
    {
    “user_id”: “user3”,
    “access_code”:“code424”
    }

Hi Scott,

Thanks! I don’t want to add a user to the channel but just list the messages in it using the server API (for migration purposes). I’ve tried handing over the access code in different ways (query param, header) but nothing seems to work.

Channel messages created with access codes cannot be listed.

How about clearing the access code for migration and updating the access code again after the job is done?

Update Channel

{
“access_code”:""
}