Get group channel list filtered by metadata key:value


I have group channel that have metadata value like this

metadata: {
  type: "type_1" // values: type_1, type_2, type_3, type_4

The question is how can I fetch list of group channel which only have metadata.type == "type_2"?

Thank you.

Welcome to Sendbird community @holale

you can filter channels with metadataKey and metadataValues fields on GroupChannelListQuery

Hi @Woo , thanks for replying

I use something like this but it does not work

var listQuery = sb.GroupChannel.createMyGroupChannelListQuery();
listQuery.metadataKey = "type";
listQuery.metadataValues = ["type_2"];, error) {
    // ...

can you give me an example? I am using version 3.0.153

Hi @holale,

In addition to what Woo provided, you must also set order to metadata_value_alphabetical, as such:

listQuery.order = 'metadata_value_alphabetical'
1 Like

This case is resolved by upgrading my version to 3.0.154 and implementing metadataKey and metadataValues. Thank you

1 Like