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

ParamsDefinitionData TypeMandatory
titleThe title of the room. This will be displayed in the room list.stringY
descriptionThe description of the room. This will be displayed in the room list.stringN
roomTypeAUDIO will be for Audio Spaces and VIDEO will be for normal meetings with Video and Audio both.AUDIO | VIDEON
startTimeThe start time of the room. This will be displayed in the room list.string (ISO 8601)N
expiryTimeThe expiry time of the room. This will be displayed in the room list.string (ISO 8601)N
hostWalletsThe host wallets how who will have admin access to the room.string [ ]N
roomLockedThe start time of the room. This will be displayed in the room list.booleantrue
muteOnEntryEvery new peer who joins, must be mutedbooleanfalse
videoOnEntryEvery new peer who joins, must have their video turned offbooleanfalse

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

ParamsDefinitionData TypeOptions
tokenTypeType of token used for the room.stringERC20, ERC721, ERC1155, BEP20, BEP721, BEP1155, LENS, POAP, CYBERCONNECT, COSMOS, TEZOS, SPL
chainChain the token is on.stringETHEREUM, COSMOS, SOLANA, TEZOS, POLYGON, BSC, ARBITRUM, GOERLI
contractAddressContract address of the token.string[]N/A
conditionTypeType of condition to be used for the room for LENS and CYBERCONNECTstringCOLLECT_POST, FOLLOW_HANDLE, HAVE_HANDLE, MIRROR_POST
conditionValueCondition type value for Lens and Cyberconnect,TokenId for ERC 1155 TokensstringTokenId 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

FieldsDefinitionData Type
messageThe message returned from the server.string
roomIdThe id of the room created.string
{
  "data": {
    "message": "Room created successfully",
    "data": {
      "roomId": "YOUR_ROOM_ID"
    }
  }
} 
Audio/Video Infrastructure designed for the developers to empower them ship simple yet powerful Audio/Video Apps.
support
company
Copyright © 2024 Graphene 01, Inc. All Rights Reserved.