createChannelWithUserIds throws SendBirdException: Invalid parameter

I’m using Sendbird v3.1.10 in a React application with TypeScript.
I’m trying to create a channel with user Ids by calling createChannelWithUserIds().
The Type Definitions say that a possible syntax is

      userIds: Array<string>,
      isDistinct: boolean,
      name: string,
      coverUrlOrImageFile: string | FileType,
      data: string,
      customType: string,
      callback?: groupChannelCallback  // notice that this can be undefined
    ): Promise<GroupChannel>;

However any call I make without specifying a callback throws a SendBirdException: Invalid parameter, which is not a very informative error - took me a while to understand which was the parameter that was causing the issue.

This doesn’t work:

sb.GroupChannel.createChannelWithUserIds(userIds, false, channelName, "", "", "") // no callback

This doesn’t work:

sb.GroupChannel.createChannelWithUserIds(userIds, false, channelName, "", "", "", undefined) // undefined callback

This works:

sb.GroupChannel.createChannelWithUserIds(userIds, false, channelName, "", "", "", (c) => {})

Can you make it so that the callback parameter is really optional as the type definitions say?

It would also be cool if all other parameters but the userIds were also optional so that we don’t have to set them as empty strings in order for it to work, that’s just silly.


Hi @MCastanho,

Welcome to the Sendbird Community.

In order to try and better understand the overall issue, can you tell me why you’d want to create a channel via the SDK and not have a callback or promise? Seems like you’d want to get the resulting channel back.

Hi @Tyler ,


I am using a promise, I just didn’t write it there to make the code snippets compact.
I am doing this:

sb.GroupChannel.createChannelWithUserIds(userIds, false, channelName, "", "", "", (c) => {})
  .then((channel) => {/* send a message to this channel */})

And in the meantime I realized there’s a possible syntax for this function that takes only the userIds and an optional callback, like this:

sb.GroupChannel.createChannelWithUserIds(userIds, (c) => {})
  .then((channel) => {/* send a message to this channel */})

But neither of them work if I remove the callback, which makes the callback not optional, contrary to what the documentation and types definition suggest.

Hi @MCastanho,

Let me dig into this and see why this is happening. I’ll circle back when I have some more information.

1 Like

Hi @MCastanho,

I’ve confirmed that there is in fact an issue with createChannelWithUserIds. This issue actually exists with updateChannel as well.

While we look to get this corrected long term, you can work around this by calling createChannel directly while passing in an instance of GroupChannelParams. A quick example to achieve the same as createChannelWithUserIds would be this (Matching your above example):

const sb = SendBird.getInstance();
const params = new sb.GroupChannelParams();
params.addUserIds(['exampleUser01', 'exampleUser02']);
params.isDistinct = false; = channelName
const channel = await sb.GroupChannel.createChannel(params);