How to fetch and join public group channels using Javascript SDK

I could create and join in a public group. because when I create a public group channel, I have the groupChannel object to call other functions of it.

but I want to retrieve existing public group channels and want to join in them. but the sdk.GroupChannel.createPublicGroupChannelListQuery()/ is not fetching the groups where I am not a member of it.
And I tried SDK.GroupChannel.getChannel(channelURL, fn) as well, but even it is throwing error saying - not a member of the group.

would you please help me on this?

@Alex_Preston

Hello @satyanarayana_ruppa,

Can you share with us what you’re entire query for sdk.GroupChannel.createPublicGroupChannelListQuery() looks like, and additionally what it returns?

Also, could you DM me your APP ID and an example channel you expect to get back just so I can check on it quickly?

Hi @Tyler sorry. I don’t have those details now. but I think by using sdk.GroupChannel.createPublicGroupChannelListQuery() we can get public groups(we may filter as well) but As per my experience, we cannot get the public groups that member has not joined yet.

`listQuery.memberStateFilter = 'all'; // 'all', 'joined_only', 'invited_only', 'invited_by_friend', and 'invited_by_non_friend'` 

I think here all includes ‘joined_only’, ‘invited_only’, ‘invited_by_friend’, and ‘invited_by_non_friend’` but not the groups that user not invited/not part of

.

Public groups are designed to show up for users regardless of join status as they are public and do not require an invite to join. Are you sure the channel(s) that you’re expecting to show up are in fact public?

It would be best if you could DM me your App_ID and the Channel_Url of a channel you expect to be returned in the query so I can double check. Additionally, if you could obtain your entire query and share it, that would be beneficial.

Sorry @Tyler , I cannot provide those details now as we have moved to group channels instead of public group channels.(we don’t have above case now)

If we have group channel url where I am not a member. can we join into that group channel using javascript chat SDK?(for now we are making platform API call to join in a group channel using channel url)

You would only be able to use the join() method on a channel that is considered public.

Any user can join a public group channel as a member without an invitation and chat with other members in the channel

If the channel is private, you can not use the join() method as it would require an invite. Someone who is a member of the channel would need to invite the user via inviteWithUserIds() method: