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
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]);