# createChannel giving SendBirdException: Invalid parameter

**URL:** https://community.sendbird.com/t/createchannel-giving-sendbirdexception-invalid-parameter/5476
**Category:** JavaScript
**Tags:** group-channel
**Created:** [August 31, 2022, 7:48pm UTC](https://community.sendbird.com/t/createchannel-giving-sendbirdexception-invalid-parameter/5476 "2022-08-31T19:48:08Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![shahmed](https://avatars.discourse-cdn.com/v4/letter/s/90ced4/32.png) [@shahmed](https://community.sendbird.com/u/shahmed)
#### Post date: [August 31, 2022, 7:48pm UTC](https://community.sendbird.com/t/createchannel-giving-sendbirdexception-invalid-parameter/5476/1 "2022-08-31T19:48:08Z")

</div>

HI Folks,

Hope u r in good health,

I am **STUCK** , Kindly help in any possible way

Here’s the usecase : we have users and customers, when the customer clicks on **SUPPORT** we check if he is new or old , if old we already have his channel url and voila, but in case of new we create a channel on the fly with the available support team users. the below code is for new user, kindly give a look and let me know why i am getting **INVALID PARAMETER ERROR**

```auto
import { sendBirdSelectors, useSendbirdStateContext } from '@sendbird/uikit-react';

const context = useSendbirdStateContext();
const sdkInstance = sendBirdSelectors.getSdk(context);

const getAllApplicationUsers = async () => {
    try {
        const userQuery = sdkInstance.createApplicationUserListQuery({ limit: 100 });
        const users = await userQuery.next();
        return [users, null];
    } catch (error) {
        return [null, error];
    }
  }

  const handleUsers = async () => {
    const [users, error] = await getAllApplicationUsers();
    const applicationUsers = users?.length > 0 && users.map(user => user.userId);
    return applicationUsers;
  }

const createChannel = async (groupChannelParams) => {
    try {
        const groupChannel = await sdkInstance.GroupChannel.createChannel(groupChannelParams);
        return [groupChannel, null];
    } catch (error) {
        return [null, error];
    }
  }

  const handleCreateChannel = async () => {
    const applicationUsers = await handleUsers();
    const groupChannelParams = {
      invitedUserIds: applicationUsers,
      name: 'Group Channel',
      coverUrl: 'https://media.glassdoor.com/sql/269361/welldoc-squarelogo-1609788656262.png',
      operatorUserIds: applicationUsers,
      customType: 'Case Managers',
      isDistinct: true,
    }
    const [groupChannel, error] = await createChannel(groupChannelParams);
  }

useEffect(() => {
    handleCreateChannel();
}, [sdkInstance]);

```

---

<div class="post-metadata">

### Author: ![shahmed](https://avatars.discourse-cdn.com/v4/letter/s/90ced4/32.png) [@shahmed](https://community.sendbird.com/u/shahmed)
#### Post date: [August 31, 2022, 7:50pm UTC](https://community.sendbird.com/t/createchannel-giving-sendbirdexception-invalid-parameter/5476/2 "2022-08-31T19:50:08Z")

</div>

> [@createChannelWithUserIds throws SendBirdException: Invalid parameter](https://community.sendbird.com/t/createchannelwithuserids-throws-sendbirdexception-invalid-parameter/4344):
>
> 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 createChannelWithUserIds( userIds: Array\<string\>, isDistinct: boolean, name: string, coverUrlOrImageFile: string | FileType, data: string, customType: string, callback?: groupChannelCallback // notice that this can be undefined ): Promise\<Group…

this is another ticket facing issue

---

<div class="post-metadata">

### Author: ![Ian](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/ian/32/2077_2.png) [@Ian](https://community.sendbird.com/u/Ian)
#### Post date: [September 1, 2022, 3:07am UTC](https://community.sendbird.com/t/createchannel-giving-sendbirdexception-invalid-parameter/5476/3 "2022-09-01T03:07:16Z")

</div>

Hello @shahmed, and welcome to the Sendbird Community!

I added your code to this example on [codesandbox.io](https://codesandbox.io/s/welldoc-group-channel-example-86wqee?file=/src/Chat.jsx:1008-1081).

On line 31 of the `Chat.jsx` file, changing `sdkInstance.GroupChannel.createChannel()` to `sdkInstance.groupChannel.createChannel()` corrected the issue and created the channel with no errors.
