Create Room
createRoom()
will create a new meeting room and return the room ID. This room ID can be used to join the room using joinRoom()
method on client side.
While creating room, you can pass following details.
Parameters
Params | Definition | Data Type | Mandatory |
---|---|---|---|
title | The title of the room. This will be displayed in the room list. | string | Y |
description | The description of the room. This will be displayed in the room list. | string | N |
roomType | AUDIO will be for Audio Spaces and VIDEO will be for normal meetings with Video and Audio both. | AUDIO | VIDEO | N |
startTime | The start time of the room. This will be displayed in the room list. | string (ISO 8601) | N |
expiryTime | The expiry time of the room. This will be displayed in the room list. | string (ISO 8601) | N |
hostWallets | The host wallets how who will have admin access to the room. | string [ ] | N |
roomLocked | The start time of the room. This will be displayed in the room list. | boolean | true |
muteOnEntry | Every new peer who joins, must be muted | boolean | false |
videoOnEntry | Every new peer who joins, must have their video turned off | boolean | false |
Example
import { API } from '@huddle01/server-sdk/api';
const getRoomId = async () => {
const api = new API({
apiKey: process.env.API_KEY!,
});
const createNewRoom = await api.createRoom({
title: 'Huddle01 Room',
});
const roomId = createNewRoom?.data;
return roomId;
};
Creating Token Gated Room
Token gated rooms are like normal rooms with an additional information about token gating. While creating room, you can pass token gating details, which will be further used to authenticate user while joining room.
Additional Parameters for Token Gating
Params | Definition | Data Type | Options |
---|---|---|---|
tokenType | Type of token used for the room. | string | ERC20, ERC721, ERC1155, BEP20, BEP721, BEP1155, LENS, POAP, CYBERCONNECT, COSMOS, TEZOS, SPL |
chain | Chain the token is on. | string | ETHEREUM, COSMOS, SOLANA, TEZOS, POLYGON, BSC, ARBITRUM, GOERLI |
contractAddress | Contract address of the token. | string[] | N/A |
conditionType | Type of condition to be used for the room for LENS and CYBERCONNECT | string | COLLECT_POST, FOLLOW_HANDLE, HAVE_HANDLE, MIRROR_POST |
conditionValue | Condition type value for Lens and Cyberconnect,TokenId for ERC 1155 Tokens | string | TokenId for ERC1155, |
Example
import { API } from '@huddle01/server-sdk/api';
const getRoomId = async () => {
const api = new API({
apiKey: process.env.API_KEY!,
});
const createNewTokenGatedRoom = await api.createRoom({
title: 'Huddle01 Room',
chain: 'ETHEREUM',
tokenType: 'ERC721',
contractAddress: ['0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85'],
});
const roomId = createNewTokenGatedRoom?.data;
return roomId;
};
Returns
Fields | Definition | Data Type |
---|---|---|
message | The message returned from the server. | string |
roomId | The id of the room created. | string |
{
"data": {
"message": "Room created successfully",
"data": {
"roomId": "YOUR_ROOM_ID"
}
}
}